Skip to content

Commit d92732e

Browse files
authored
fix: fix make_build.bzl for macos. (#1422)
1 parent 56a40a3 commit d92732e

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

foreign_cc/built_tools/make_build.bzl

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,15 @@ def _make_tool_impl(ctx):
8181
if os_name(ctx) == "macos":
8282
non_sysroot_ldflags += ["-undefined", "error"]
8383

84+
# On macOS, remove "-lm".
85+
# During compilation, the ./configure script disables USE_SYSTEM_GLOB,
86+
# and chooses its own glob implementation (lib/glob.h, lib/glob.c).
87+
# all source files in lib/* are compiled to ./lib/libgnu.a
88+
# However, at link time, "-lm" appears before "-lgnu".
89+
# This linker commandline is like this: LINKER ... -lm -L./lib -o xxx ... -lgnu
90+
# So the system glob is linked instead, causing ABI conflicts.
91+
non_sysroot_ldflags = [x for x in non_sysroot_ldflags if x != "-lm"]
92+
8493
configure_options = [
8594
"--without-guile",
8695
"--with-guile=no",

0 commit comments

Comments
 (0)