Open jungleraptor opened 1 year ago
We're observing this too. From what I could tell, the final LDFLAGS
passed to bootstrap GNUMake end up being -Wl,-S -headerpad_max_install_names -lc++ -lm -undefined error -undefined dynamic_lookup
. Which seems to make it so that the -undefined dynamic_lookup
overrides -undefined error
(which was a fixed introduced in https://github.com/bazelbuild/rules_foreign_cc/pull/894).
This patch seems to fix it:
From f84270c6bd0b513dbd77431688ab387ddd0f4916 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ricard=20Sol=C3=A9?= <ricard.sole@datadoghq.com>
Date: Thu, 12 Oct 2023 18:03:11 +0200
Subject: [PATCH] gnumake: unsets -undefined dynamic_build if found
---
foreign_cc/built_tools/make_build.bzl | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/foreign_cc/built_tools/make_build.bzl b/foreign_cc/built_tools/make_build.bzl
index 0baaa5c..f807d27 100644
--- a/foreign_cc/built_tools/make_build.bzl
+++ b/foreign_cc/built_tools/make_build.bzl
@@ -71,8 +71,10 @@ def _make_tool_impl(ctx):
if absolute_ar == "libtool" or absolute_ar.endswith("/libtool"):
arflags.append("-o")
+ _joined_non_sysroot_ldflags = _join_flags_list(ctx.workspace_name, non_sysroot_ldflags)
if os_name(ctx) == "macos":
- non_sysroot_ldflags += ["-undefined", "error"]
+ _joined_non_sysroot_ldflags = _joined_non_sysroot_ldflags.replace("-undefined dynamic_lookup", "")
+ _joined_non_sysroot_ldflags += " -undefined error"
env.update({
"AR": absolute_ar,
@@ -80,7 +82,7 @@ def _make_tool_impl(ctx):
"CC": absolute_cc,
"CFLAGS": _join_flags_list(ctx.workspace_name, non_sysroot_cflags),
"LD": absolute_ld,
- "LDFLAGS": _join_flags_list(ctx.workspace_name, non_sysroot_ldflags),
+ "LDFLAGS": _joined_non_sysroot_ldflags,
})
configure_env = " ".join(["%s=\"%s\"" % (key, value) for key, value in env.items()])
--
2.38.1
Believe I am seeing this as well, MacOS 13.5
(transformers-v2) victor@Victors-MBP cpp % pkgutil --pkg-info=com.apple.pkg.CLTools_Executables
package-id: com.apple.pkg.CLTools_Executables
version: 15.0.0.0.1.1690355577
volume: /
location: /
install-time: 1691358267
Same issue on MacOS 14
pkgutil --pkg-info=com.apple.pkg.CLTools_Executables
package-id: com.apple.pkg.CLTools_Executables
version: 15.0.0.0.1.1694021235
volume: /
location: /
install-time: 1696925492
I am using the latest version: rules_foreign_cc-0.10.1
We've observed at least two separate issues during the
BootstrapGNUMake
step on users who've upgraded their machines to the latestv15
release of the mac command line tools or the new xcode sdk.Macos version: Venture 13.6
Bazel version: 6.2.0
rules_foreign_cc: d4b19bb010ca5d433850c1d9db0510c2fd395aae758ae37f02930944596220ec
Error 1:
Error 2: