bazel: Bazel 0.15.0 breaks C++ linking on MacOS

Description of the problem / feature request:

After updating to Bazel 0.15.0, C++ binaries are being linked with the flag -Wl,-no-as-needed which does not exist in the MacOS linker.

$ bazel-0.15.0 build //:hello
ERROR: /Users/jmillikin/src/test-bazel-gcc/BUILD:1:1: Linking of rule '//:hello' failed (Exit 1)
ld: unknown option: -no-as-needed
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Target //:hello failed to build
Use --verbose_failures to see the command lines of failed build steps.
$ cc --version
Apple LLVM version 10.0.0 (clang-1000.10.25.5)
Target: x86_64-apple-darwin17.4.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin

$ ld -v
@(#)PROGRAM:ld  PROJECT:ld64-408.1.1
BUILD 05:18:43 May 25 2018
configured to support archs: armv6 armv7 armv7s arm64 i386 x86_64 x86_64h armv6m armv7k armv7m armv7em
LTO support using: LLVM version 10.0.0, (clang-1000.10.25.5) (static support for 21, runtime is 21)
TAPI support using: Apple TAPI version 10.0.0 (tapi-1000.0.7.3)

What operating system are you running Bazel on?

MacOS

What’s the output of bazel info release?

release 0.15.0

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 23 (18 by maintainers)

Commits related to this issue

Most upvoted comments

OK, I can prepare a patch release.

@laurentlb Is there a ticket to track the patch release? This is still causing problems for us.

Can confirm, 0.15.0 working with clang-902.0.39.2.