bazel-contrib / bazel-contrib/toolchains_llvm

clang: error: unable to execute command: Executable "ld" doesn't exist!

Open
#516 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Starlark
Stars
371
Forks
283
Avg merge
1d 55m
Merged PRs (30d)
25

Description

It seems sometimes the `ld` tool is not present in the path. Is it possible to add a symlink from `ld` to `ld.lld`.

This happens when a downstream dependency (`aws-lc-sys`) invokes the `CC` wrapper script it seems clang always tries to call out to `ld` and on a empty machine with no compiling tools this fails.

```
/root/.cache/bazel/_bazel_root/f0307b93a4e15de94d1739eb6cc8c44a/sandbox/processwrapper-sandbox/2371/execroot/_main/external/toolchains_llvm++llvm+llvm_toolchain/bin/cc_wrapper.shARGS: ["-O0", "-ffunction-sections", "-fdata-sections", "-fPIC", "-gdwarf-4", "-fno-omit-frame-pointer", "-m64", "--target=x86_64-unknown-linux-gnu", "-U_FORTIFY_SOURCE", "--target=x86_64-unknown-linux-gnu", "-U_FORTIFY_SOURCE", "-fstack-protector", "-fno-omit-frame-pointer", "-fcolor-diagnostics", "-Wall", "-Wthread-safety", "-Wself-assign", "--sysroot=/root/.cache/bazel/_bazel_root/f0307b93a4e15de94d1739eb6cc8c44a/sandbox/processwrapper-sandbox/2371/execroot/_main/external/+_repo_rules+linux-x86_64-sysroots/", "-no-canonical-prefixes", "-Wno-builtin-macro-redefined", "-D__DATE__=\"redacted\"", "-D__TIMESTAMP__=\"redacted\"", "-D__TIME__=\"redacted\"", "-U_FORTIFY_SOURCE", "--target=x86_64-unknown-linux-gnu", "-U_FORTIFY_SOURCE", "-fstack-protector", "-fno-omit-frame-pointer", "-fcolor-diagnostics", "-Wall", "-Wthread-safety", "-Wself-assign", "--sysroot=/root/.cache/bazel/_bazel_root/f0307b93a4e15de94d1739eb6cc8c44a/sandbox/processwrapper-sandbox/2371/execroot/_main/external/+_repo_rules+linux-x86_64-sysroots/", "-no-canonical-prefixes", "-Wno-builtin-macro-redefined", "-D__DATE__=\"redacted\"", "-D__TIMESTAMP__=\"redacted\"", "-D__TIME__=\"redacted\"", "/root/.cache/bazel/_bazel_root/f0307b93a4e15de94d1739eb6cc8c44a/sandbox/processwrapper-sandbox/2371/execroot/_main/bazel-out/k8-fastbuild/bin/external/+vendored+crates_vendor__aws-lc-sys-0.29.0/_bs.cargo_runfiles/+vendored+crates_vendor__aws-lc-sys-0.29.0/aws-lc/tests/compiler_features_tests/memcmp_invalid_stripped_check.c", "-Wno-unused-parameter", "-o", "/root/.cache/bazel/_bazel_root/f0307b93a4e15de94d1739eb6cc8c44a/sandbox/processwrapper-sandbox/2371/execroot/_main/bazel-out/k8-fastbuild/bin/external/+vendored+crates_vendor__aws-lc-sys-0.29.0/_bs.out_dir/memcmp_invalid_stripped_check"]
EXECUTED: true
ERROR: clang: error: unable to execute command: Executable "ld" doesn't exist!
clang: error: linker command failed with exit code 1 (use -v to see invocation)
OUTPUT: Failed to compile memcmp_invalid_stripped_check
```

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the aws-lc-sys compiler check in the Bazel toolchain environment using the cc_wrapper.sh invocation shown in the report. Verify how clang searches for ld and confirm the requested ld/ld.lld behavior; done means the reported compile no longer fails because ld cannot be found.

Written by the indexing model from the issue text.

Assessment

Domain
build-system, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.