Open jwbee opened 3 years ago
It may be because bazel invokes the compiler to do linking, and the compiler knows which ld it wants to use. I've worked around similar issues with (as you say) action modifiers adding the --dynamic-linker flag to the invocation.
The whole tutorial fails at step 7. There, it expects Bazel to throw an error, because no path to a compiler has been configured. However, it happily compiles and runs the hello world program.
For the record, I tried this using versions 4.1, 4.2, 5.0 and 5.1 on a recent Ubuntu system.
Note: I had some existing code in my workspace. Among that, there was a .bazelrc with the line
build --incompatible_enable_cc_toolchain_resolution
which makes the difference there.
Documentation URL: https://docs.bazel.build/versions/main/tutorial/cc-toolchain-config.html
As this documentation stands it misleads the user into believing that the
ld
stanza oftool_paths
controls the invocation of the linker, but it doesn't. If you put/usr/games/cowsay
in for the linker, it still invokes the default host linker. I'm not smart enough to know why yet, but I guess it is because thefeatures
override things.It seems to me that if you want to influence the linker, you are required to provide a list of ActionConfigInfo.