Closed thii closed 4 years ago
Adding the linktopts via the build command or the .bazelrc file worked for us. Bazel doesn’t add the extra -Wl
here like it does for the rule’s linktopts
attribute.
For getting the zld executable tobe at the right place, right now we’re having to build w/o sandbox, but yeah modifying the toolchain to declare it as an input would definitely a proper way.
ha, i thought this was a github issue, not a pr. yes, this makes sense. could you add a bit about it needing to be not in the sandbox?
also, how do you download and determine the path to zld? can you do it with a repository rule?
We download it via a bazel wrapper at tools/bazel
(which is invoked by Homebrew installed bazel), and give it an absolute path (e.g. /tmp/zld-09ea158
, so at least zld version is part of the cache key).
thanks!
when you find out how to use it with bazel, let me know :P
there are two issues that i know of right now: getting the zld executable to be at the right place during linking, and getting clang to invoke it instead of ld, via
-fuse-ld=...
. if we add that arg to linkopts, we get-Wl,-fuse-ld=...
, and we don't want that -Wl. one can also mess with the toolchain, but my understanding is that that's quite a pain. PR here: https://github.com/bazelbuild/rules_apple/pull/945