1

Pass "-Wl,-undefined=dynamic_lookup" for dynamic libraries on darwin.

This linker flag causes undefined symbols to be ignored, which is the
default behavior on linux but not macos. This is required when building
shared libraries to use as e.g. Python modules. This also matches what
Bazel's built-in macos cc toolchain does.
This commit is contained in:
Jeremy Volkman 2022-05-24 17:17:33 -07:00 committed by Motiejus Jakštys
parent 921fda9260
commit a0511ca5ee

View File

@ -54,7 +54,7 @@ def _target_darwin(gocpu, zigcpu):
"libc/include/any-macos-any",
],
linkopts = [],
dynamic_library_linkopts = [],
dynamic_library_linkopts = ["-Wl,-undefined=dynamic_lookup"],
copts = [],
bazel_target_cpu = "darwin",
constraint_values = [