Skip to content

unable to find library -lc++, -lgcc_s #24

@Sinfolke

Description

@Sinfolke

I think i could do something wrong but i wasn't familiar with cross building with clang before. What i did is downloaded this toolchain and libc++. I did not use compiler-rt and libunwind as i do not understand this. Then i executed following command:

clang++ hello.cpp --target=x86_64-v3-linux -isystem stdlib/include --sysroot=C:\cclang\sysroot\linux-x86_64 -s
tdlib=libc++ -fuse-ld="C:\cclang\clang\LLVM\bin\ld.lld" -v

and got the output:

clang version 17.0.5
Target: x86_64-v3-linux
Thread model: posix
InstalledDir: C:\cclang\clang\LLVM\bin
Found candidate GCC installation: C:\cclang\sysroot\linux-x86_64/lib/gcc/x86_64-linux-gnu\9
Selected GCC installation: C:\cclang\sysroot\linux-x86_64/lib/gcc/x86_64-linux-gnu/9
Candidate multilib: .;@m64
Selected multilib: .;@m64
 "C:\\cclang\\clang\\LLVM\\bin\\clang++.exe" -cc1 -triple x86_64-v3-linux -emit-obj -mrelax-all -dumpdir a- -disable-free -clear-ast-before-backend -disable-llvm-verifier -discard-value-names -main-file-name hello.cpp -mrelocation-model pic -pic-level 2 -pic-is-pie -mframe-pointer=all -fmath-errno -ffp-contract=on -fno-rounding-math -mconstructor-aliases -funwind-tables=2 -target-cpu x86-64 -tune-cpu generic -debugger-tuning=gdb -v "-fcoverage-compilation-dir=C:\\cclang" -resource-dir "C:\\cclang\\clang\\LLVM\\lib\\clang\\17" -isystem stdlib/include -isysroot "C:\\cclang\\sysroot\\linux-x86_64" -internal-isystem "C:\\cclang\\clang\\LLVM\\lib\\clang\\17\\include" -internal-isystem "C:\\cclang\\sysroot\\linux-x86_64/usr/local/include" -internal-isystem "C:\\cclang\\sysroot\\linux-x86_64/lib/gcc/x86_64-linux-gnu/9/../../../../x86_64-linux-gnu/include" -internal-externc-isystem "C:\\cclang\\sysroot\\linux-x86_64/usr/include/x86_64-linux-gnu" -internal-externc-isystem "C:\\cclang\\sysroot\\linux-x86_64/include" -internal-externc-isystem "C:\\cclang\\sysroot\\linux-x86_64/usr/include" -fdeprecated-macro "-fdebug-compilation-dir=C:\\cclang" -ferror-limit 19 -fmessage-length=120 -fgnuc-version=4.2.1 -fcxx-exceptions -fexceptions -fcolor-diagnostics -faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o "C:\\Users\\Admin\\AppData\\Local\\Temp\\hello-f3784d.o" -x c++ hello.cpp
clang -cc1 version 17.0.5 based upon LLVM 17.0.5 default target x86_64-pc-windows-msvc
ignoring nonexistent directory "C:\cclang\sysroot\linux-x86_64/usr/local/include"
ignoring nonexistent directory "C:\cclang\sysroot\linux-x86_64/lib/gcc/x86_64-linux-gnu/9/../../../../x86_64-linux-gnu/include"
ignoring nonexistent directory "C:\cclang\sysroot\linux-x86_64/include"
#include "..." search starts here:
#include <...> search starts here:
 stdlib/include
 C:\cclang\clang\LLVM\lib\clang\17\include
 C:\cclang\sysroot\linux-x86_64/usr/include/x86_64-linux-gnu
 C:\cclang\sysroot\linux-x86_64/usr/include
End of search list.
 "C:\\cclang\\clang\\LLVM\\bin\\ld.lld" "--sysroot=C:\\cclang\\sysroot\\linux-x86_64" -pie --hash-style=gnu --eh-frame-hdr -m elf_x86_64 -dynamic-linker /lib64/ld-linux-x86-64.so.2 -o a.out "C:\\cclang\\sysroot\\linux-x86_64/lib/gcc/x86_64-linux-gnu/9/../../../../lib64\\Scrt1.o" "C:\\cclang\\sysroot\\linux-x86_64/usr/lib/../lib64\\crti.o" "C:\\cclang\\sysroot\\linux-x86_64/lib/gcc/x86_64-linux-gnu/9\\crtbeginS.o" "-LC:\\cclang\\sysroot\\linux-x86_64/lib/gcc/x86_64-linux-gnu/9" "-LC:\\cclang\\sysroot\\linux-x86_64/lib/gcc/x86_64-linux-gnu/9/../../../../lib64" "-LC:\\cclang\\sysroot\\linux-x86_64/lib/../lib64" "-LC:\\cclang\\sysroot\\linux-x86_64/usr/lib/../lib64" "-LC:\\cclang\\sysroot\\linux-x86_64/lib" "-LC:\\cclang\\sysroot\\linux-x86_64/usr/lib" "C:\\Users\\Admin\\AppData\\Local\\Temp\\hello-f3784d.o" -lc++ -lm -lgcc_s -lgcc -lc -lgcc_s -lgcc "C:\\cclang\\sysroot\\linux-x86_64/lib/gcc/x86_64-linux-gnu/9\\crtendS.o" "C:\\cclang\\sysroot\\linux-x86_64/usr/lib/../lib64\\crtn.o"
ld.lld: error: unable to find library -lc++
ld.lld: error: unable to find library -lgcc_s
ld.lld: error: unable to find library -lgcc_s
clang++: error: linker command failed with exit code 1 (use -v to see invocation)

These libraries are seems removed out but the compiler still want link agains them.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions