Skip to content

ld.lld: error: cannot open /lib/x86_64-linux-gnu/libm.so.6: No such file or directory (Arch linux) #24

@DCNick3

Description

@DCNick3

First of all, thanks a lot for this wonderful project, allowing to use hermetic toolchains without going through a lot of pain, trial and error to set up.

Unfortunately, it seems that I can't build any executable due to linker error: ld.lld: error: cannot open /lib/x86_64-linux-gnu/libm.so.6: No such file or directory.

I use arch linux distribution, and it seems to work fine on ubuntu (tested in docker). Also, the error goes away if I disable the sandboxing (--launch_strategy=standalone).

I've made a repro case with docker: you should be able to setup the environment with a simple docker build . -t bazel_rules_cc_toolchain_repro and docker run --rm -it -v $(pwd):/root bazel_rules_cc_toolchain_repro

https://gitlab.com/DCNick3/bazel_rules_cc_toolchain_repro

It seems that it has something to do with how sandboxing is implemented in bazel, but I can't seem to find a good direction to dig in. Here some my thoughts though:

Why is clang trying to look for /lib/x86_64-linux-gnu/libm.so.6? This is not where libm resides on arch. Maybe it's because the clang is built for ubuntu? But it works without sandbox, and, even more, I was fine using prebuilt clang binaries for ubuntu previously, so the problem seems to lie in interaction between clang linker and bazel sandboxing... No idea how to debug this though.

Metadata

Metadata

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions