bazelbuild / rules_cc

C++ Rules for Bazel
https://bazel.build
Apache License 2.0
181 stars 89 forks source link

linker warnings on macOS XCode 14: `ld: warning: -undefined dynamic_lookup may not work with chained fixups` #149

Closed garymm closed 1 year ago

garymm commented 1 year ago

Description of the problem / feature request:

cc_binary built on MacOS with XCode 14 results in warnings link the following being printed: ld: warning: -undefined dynamic_lookup may not work with chained fixups

Bugs: what's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.

git clone https://github.com/bazelbuild/examples
cd examples/cpp-tutorial/stage3
bazel build //...

Output:

➜  bazel build //...
Starting local Bazel server and connecting to it...
INFO: Analyzed 3 targets (38 packages loaded, 172 targets configured).
INFO: Found 3 targets...
INFO: From Linking main/libhello-greet.so:
ld: warning: -undefined dynamic_lookup may not work with chained fixups
INFO: From Linking lib/libhello-time.so:
ld: warning: -undefined dynamic_lookup may not work with chained fixups
INFO: From Linking main/hello-world:
ld: warning: -undefined dynamic_lookup may not work with chained fixups

What operating system are you running Bazel on?

MacOS 12.6

What's the output of bazel info release?

release 5.3.1

What version of rules_cc do you use? Can you paste the workspace rule used to fetch rules_cc? What other relevant dependencies does your project have?

built in, but also tried 0.0.4

What Bazel options do you use to trigger the issue? What C++ toolchain do you use?

Didn't specify any bazel options or configure any custom toolchain.

Have you found anything relevant by searching the web?

https://github.com/python/cpython/issues/97524 https://github.com/ruby/ruby/pull/6193 https://issues.guix.gnu.org/issue/57849

CsBigDataHub commented 1 year ago

FYI.. https://issues.guix.gnu.org/issue/57849

Looks like using -Wl,-w will help.

garymm commented 1 year ago

I think the issue is in the built-in rules so I moved this to the main bazel repo: https://github.com/bazelbuild/bazel/issues/16413