Closed xiedeacc closed 2 months ago
my mistake, it seems this option added by linker from https://github.com/tpoechtrager/cctools-port
does this option added by bazel or linker?
oops, it's really added by bazel, in ./tools/cpp/unix_cc_toolchain_config.bzl +1509
can guys handle this?
it looks like the issue is that gcc doesn't accept this flag. bazel's toolchain assumes that if you're building for macOS you're building with clang. you should likely create your own CC toolchain instead and handle the flags how you'd like
it looks like the issue is that gcc doesn't accept this flag. bazel's toolchain assumes that if you're building for macOS you're building with clang. you should likely create your own CC toolchain instead and handle the flags how you'd like
yes, if change toolchain to clang will works well, I finally copy unix_cc_toolchain_config.bzl from bazel to toolchain, and remove that flag fixed this problem, but bazel can handle this small defect if have time
I believe you can also disable the default macOS link flags if using GCC:
--features=-macos_default_link_flags
--linkopt=-no-canonical-prefixes
Description of the bug:
my host is linux x86_64, I setup a cross-compiling toolchain for macosx, bazel will add -fobjc-link-runtime to link params file automatic when cross compiling for macosx, if manually remove -fobjc-link-runtime in bazel-out/x86_64-opt/bin/external/xz/xz-2.params, link passed and generated binary can executed on mac
ps: cross-compiling toolchain is gcc
error log:
external/cc_toolchain_config_x86_64_osx_generic_macosx_gcc/BUILD.bazel
cc_toolchain_config.bzl
Which category does this issue belong to?
No response
What's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.
No response
Which operating system are you running Bazel on?
ubuntu 22.04 x86_64
What is the output of
bazel info release
?7.2.0
If
bazel info release
returnsdevelopment version
or(@non-git)
, tell us how you built Bazel.No response
What's the output of
git remote get-url origin; git rev-parse HEAD
?No response
If this is a regression, please try to identify the Bazel commit where the bug was introduced with bazelisk --bisect.
No response
Have you found anything relevant by searching the web?
No response
Any other information, logs, or outputs that you want to share?
No response