Skip to content

lld_14 with clang_14 cannot use libstdc++.so.6: cannot open shared object file: No such file or directory #215260

@inclyc

Description

@inclyc

Describe the bug

llvm-tblgen can not find libstdc++.so.6.

FAILED: include/llvm/IR/Attributes.inc <llvm-project>/llvm-project/build/include/llvm/IR/Attributes.inc 
cd <llvm-project>/llvm-project/build && <llvm-project>/llvm-project/build/bin/llvm-tblgen -gen-attrs -I <llvm-project>/llvm-project/llvm/include/llvm/IR -I<llvm-project>/llvm-project/build/include -I<llvm-project>/llvm-project/llvm/include <llvm-project>/llvm-project/llvm/include/llvm/IR/Attributes.td --write-if-changed -o include/llvm/IR/Attributes.inc -d include/llvm/IR/Attributes.inc.d
<llvm-project>/llvm-project/build/bin/llvm-tblgen: error while loading shared libraries: libstdc++.so.6: cannot open shared object file: No such file or directory

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:

  1. Use recent nixpkgs/nixos-unstable
  2. build the llvm-project

LLVM Revision: d768b97424f9e1a0aae45440a18b99f21c4027ce

Flags:

LLVM=~llvm-project

llvm_base="$LLVM"
build_mode="Debug"
build_dir="build"
build_base="${llvm_base}/${build_dir}"
llvm_enable_projects="clang;mlir"


cmake -DBUILD_SHARED_LIBS:STRING=On \
-DCMAKE_BUILD_TYPE:STRING=${build_mode} \
-DLLVM_APPEND_VC_REV:STRING=Off \
-DLLVM_ENABLE_LLD:STRING=On \
-DLLVM_ENABLE_PROJECTS:STRING="${llvm_enable_projects}" \
-DLLVM_LINK_LLVM_DYLIB:STRING=Off \
-DLLVM_OPTIMIZED_TABLEGEN=Off \
-DLLVM_CCACHE_BUILD:BOOL=FALSE \
-DLLVM_USE_SPLIT_DWARF=On \
-DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE \
-DCMAKE_C_COMPILER:FILEPATH=${CC:-"gcc"} \
-DCMAKE_CXX_COMPILER:FILEPATH=${CXX:-"g++"} \
-S${llvm_base}/llvm \
-B${build_base} -G Ninja \
-DLLVM_TARGETS_TO_BUILD="host;RISCV;"

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.

[user@system:~]$ nix-shell -p nix-info --run "nix-info -m"
 - system: `"x86_64-linux"`
 - host os: `Linux 6.1.9, NixOS, 23.05 (Stoat), 23.05.20230206.5a350a8`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.13.2`
 - nixpkgs: `/nix/var/nix/profiles/per-user/root/channels/nixos`

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions