Open jez opened 2 months ago
I didn't see an easy way to access absolute_paths
from inside the cc_wrapper.sh
file, so I just applied a patch like this to make progress:
if [[ -f "%{toolchain_path_prefix}bin/ld64.lld" ]]; then
echo "-fuse-ld=%{toolchain_path_prefix}bin/ld64.lld"
else
echo "-fuse-ld=${execroot_abs_path}%{toolchain_path_prefix}bin/ld64.lld"
fi
which is bad for its own reasons (if that file happens to exist, it might be the wrong one?) but I'm not sure if that matters. At the very least, it's not explicit to the user what's going on and deserves a comment that this condition needs to be here in support of absolute_paths
.
Feel free to use this code or another solution at your leisure.
https://github.com/bazel-contrib/toolchains_llvm/blob/f0a43a598b8f0e69c6402fe964e336220fc3c4c9/toolchain/osx_cc_wrapper.sh.tpl#L76-L77
When
absolute_paths = True
, thetoolchain_path_prefix
variable is an absolute path, so attempting to prefix it withexecroot_abs_path
means that the execroot absolute path is duplicated, leading clang to fail to invoke the linker.In the error message, this:
needs to be this:
or else the file does not exist.
This appeared in #286, which was a fix for #212.