-
-
Notifications
You must be signed in to change notification settings - Fork 14.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
lld_14 with clang_14 cannot use libstdc++.so.6: cannot open shared object file: No such file or directory #215260
Comments
According to some of my local tests, [user@system:~]$ cmake --build build
[313/5616] Linking CXX executable bin/not
/nix/store/r2b9k28c6aghczpqfvh71y9xavm7rr68-binutils-2.39/bin/ld: warning: librt.so.1, needed by lib/libLLVMSupport.so.17git, not found (try using -rpath or -rpath-link)
/nix/store/r2b9k28c6aghczpqfvh71y9xavm7rr68-binutils-2.39/bin/ld: warning: libdl.so.2, needed by lib/libLLVMSupport.so.17git, not found (try using -rpath or -rpath-link)
[328/5616] Linking CXX executable bin/UnicodeNameMappingGenerator
/nix/store/r2b9k28c6aghczpqfvh71y9xavm7rr68-binutils-2.39/bin/ld: warning: librt.so.1, needed by lib/libLLVMSupport.so.17git, not found (try using -rpath or -rpath-link)
/nix/store/r2b9k28c6aghczpqfvh71y9xavm7rr68-binutils-2.39/bin/ld: warning: libdl.so.2, needed by lib/libLLVMSupport.so.17git, not found (try using -rpath or -rpath-link)
[331/5616] Linking CXX executable bin/split-file
/nix/store/r2b9k28c6aghczpqfvh71y9xavm7rr68-binutils-2.39/bin/ld: warning: librt.so.1, needed by lib/libLLVMSupport.so.17git, not found (try using -rpath or -rpath-link)
/nix/store/r2b9k28c6aghczpqfvh71y9xavm7rr68-binutils-2.39/bin/ld: warning: libdl.so.2, needed by lib/libLLVMSupport.so.17git, not found (try using -rpath or -rpath-link)
[333/5616] Linking CXX executable bin/yaml-bench
/nix/store/r2b9k28c6aghczpqfvh71y9xavm7rr68-binutils-2.39/bin/ld: warning: librt.so.1, needed by lib/libLLVMSupport.so.17git, not found (try using -rpath or -rpath-link)
/nix/store/r2b9k28c6aghczpqfvh71y9xavm7rr68-binutils-2.39/bin/ld: warning: libdl.so.2, needed by lib/libLLVMSupport.so.17git, not found (try using -rpath or -rpath-link)
[529/5616] Linking CXX executable bin/FileCheck
/nix/store/r2b9k28c6aghczpqfvh71y9xavm7rr68-binutils-2.39/bin/ld: warning: librt.so.1, needed by lib/libLLVMSupport.so.17git, not found (try using -rpath or -rpath-link)
/nix/store/r2b9k28c6aghczpqfvh71y9xavm7rr68-binutils-2.39/bin/ld: warning: libdl.so.2, needed by lib/libLLVMSupport.so.17git, not found (try using -rpath or -rpath-link)
[553/5616] Linking CXX executable bin/llvm-tblgen
/nix/store/r2b9k28c6aghczpqfvh71y9xavm7rr68-binutils-2.39/bin/ld: warning: librt.so.1, needed by lib/libLLVMSupport.so.17git, not found (try using -rpath or -rpath-link)
/nix/store/r2b9k28c6aghczpqfvh71y9xavm7rr68-binutils-2.39/bin/ld: warning: libdl.so.2, needed by lib/libLLVMSupport.so.17git, not found (try using -rpath or -rpath-link)
[594/5616] Linking CXX executable bin/clang-tblgen
/nix/store/r2b9k28c6aghczpqfvh71y9xavm7rr68-binutils-2.39/bin/ld: warning: librt.so.1, needed by lib/libLLVMSupport.so.17git, not found (try using -rpath or -rpath-link)
/nix/store/r2b9k28c6aghczpqfvh71y9xavm7rr68-binutils-2.39/bin/ld: warning: libdl.so.2, needed by lib/libLLVMSupport.so.17git, not found (try using -rpath or -rpath-link) |
CC @Ericson2314 |
Reduced repro: #include <iostream>
int main() {
std::cout << "Test" << std::endl;
} [user@system:~]$ clang++ -fuse-ld=lld test.cpp -o test
[user@system:~]$ ./test
./test: error while loading shared libraries: libstdc++.so.6: cannot open shared object file: No such file or directory
[user@system:~]$ which lld
/run/current-system/sw/bin/lld
[user@system:~]$ ll `which lld`
lrwxrwxrwx 3 root root 62 Jan 1 1970 /run/current-system/sw/bin/lld -> /nix/store/k1kpcazajfi8k2lkpnf98idxapxdbhf0-lld-14.0.6/bin/lld*
[user@system:~]$ ll `which clang`
lrwxrwxrwx 3 root root 74 Jan 1 1970 /run/current-system/sw/bin/clang -> /nix/store/1bmrs2b76lzzn90zj2zg6049fxii7g3z-clang-wrapper-14.0.6/bin/clang* |
Working fine with following shell. with import <nixpkgs> { };
pkgs.clangStdenv.mkDerivation {
name = "test";
nativeBuildInputs = with pkgs; [
lld
];
} |
I made a nix flake that reproduces this problem: {
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
};
outputs = { self, nixpkgs, flake-utils, ... }@inputs:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs { inherit system; };
in
{
devShells.default = pkgs.mkShell
{
nativeBuildInputs = with pkgs; [
clang_14
lld_14
];
};
});
} https://gist.github.com/inclyc/8df38510fd141965da238c6d4d6edeca |
CC maintainers: @Ericson2314 @sternenseemann @lovek323 @dtzWill @primeos |
Does |
Happy to test whether the current staging-next branch nixpkgs would solve the issue. However, after I switch to staging-next, lld_14 and clang_14 need to compile a lot of packages when I tried to enter
|
|
Thanks! @trofi Confirmed that the problem has been solved in 123c88b. {
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/123c88bcd0acd32c1d224187fd27cc9001b0e1a8";
};
outputs = { self, nixpkgs, ... }@inputs:
{
nixosConfigurations.container = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules =
[
({ pkgs, ... }: {
boot.isContainer = true;
environment.systemPackages = with pkgs; [
clang_14
lld_14
];
})
];
};
};
} |
Describe the bug
llvm-tblgen can not find libstdc++.so.6.
Confirmed that g++/clang++ can generate correct minimal C++ binary (with libstdc++), but recently llvm-tblgen breaks.
Steps To Reproduce
Steps to reproduce the behavior:
LLVM Revision: d768b97424f9e1a0aae45440a18b99f21c4027ce
Flags:
Expected behavior
Compile LLVM successfully as before
Notify maintainers
Metadata
Please run
nix-shell -p nix-info --run "nix-info -m"
and paste the result.The text was updated successfully, but these errors were encountered: