bazel-contrib / bazel-contrib/toolchains_llvm
Linking error with libxml2
- Dominant language
- Starlark
- Stars
- 371
- Forks
- 283
- Avg merge
- 1d 55m
- Merged PRs (30d)
- 25
Description
I tried setting up toolchains_llvm in a minimal repo on a current CachyOS. On an MacOS it works flawlessly.
This is the `MODULE.bazel`
```python
module(
name = "terrain_displacer",
version = "0.1.0",
)
bazel_dep(name = "rules_cc", version = "0.2.16")
bazel_dep(name = "toolchains_llvm", version = "1.6.0")
llvm = use_extension("@toolchains_llvm//toolchain/extensions:llvm.bzl", "llvm")
llvm.toolchain(
llvm_version = "21.1.6",
)
use_repo(llvm, "llvm_toolchain")
register_toolchains("@llvm_toolchain//:all")
```
A simple `BUILD.bazel`
```Python
load("@rules_cc//cc:defs.bzl", "cc_binary")
package(default_visibility = ["//visibility:public"])
cc_binary(
name = "main",
srcs = ["main.cc"],
)
```
A C++ test file
```C++
#include
int main(int argc, char *argv[]) {
std::cout << "hi";
return 0;
}
```
Where I'm getting the error
```
ERROR: /home/peterbaintner/repos/terrain_displacer/src/BUILD.bazel:16:10: Linking src/scratchpad failed: (Exit 1): cc_wrapper.sh failed: error executing CppLink command (from cc_binary rule target //src:scratchpad) external/toolchains_llvm++llvm+llvm_toolchain/bin/cc_wrapper.sh @bazel-out/k8-fastbuild/bin/src/scratchpad-0.params
Use --sandbox_debug to see verbose messages from the sandbox and retain the sandbox build root for debugging
external/toolchains_llvm++llvm+llvm_toolchain_llvm/bin/ld.lld: error while loading shared libraries: libxml2.so.2: cannot open shared object file: No such file or directory
clang: error: unable to execute command: No such file or directory
```
Contributor guide
Research direction
Start with the minimal MODULE.bazel, BUILD.bazel, and main.cc example and reproduce the build on CachyOS. Inspect the linker failure showing that libxml2.so.2 is unavailable to ld.lld; done means the example links successfully with the documented toolchain setup.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp, linux
- Domain
- build-system, compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100