Open paleknight894 opened 2 months ago
CC @Endilll
Looking at
https://github.com/llvm/llvm-project/blob/3d5e1ec6508c8425601d4cfaba4c8a8f18791e2b/clang/CMakeLists.txt#L253-L268
I think what happens is that -DCLANG_DEFAULT_RTLIB="compiler-rt"
is not properly propagated to CLANG_DEFAULT_UNWINDLIB
, because compiler-rt
is not libunwind
. I'm not sure whether and how this should be fixed, but can you try building with -DCLANG_DEFAULT_UNWINDLIB="libunwind"
on top of your CMake configuration?
Looking at
I think what happens is that
-DCLANG_DEFAULT_RTLIB="compiler-rt"
is not properly propagated toCLANG_DEFAULT_UNWINDLIB
, becausecompiler-rt
is notlibunwind
. I'm not sure whether and how this should be fixed, but can you try building with-DCLANG_DEFAULT_UNWINDLIB="libunwind"
on top of your CMake configuration? Add "-DCLANG_DEFAULT_UNWINDLIB="libunwind"" solved part of my problems,now I can build static c executables in "gcc way",but when I try to build static c++ executable,it complains some undefined reference about libcxxabi. Also,build dynamic c++ executables works normally. I try to build it by "clang++ -static -lc++abi hello.cpp",It works.... Is there some configuration needed with libcxxabi, should I try LIBCXX_STATICALLY_LINK_ABI_IN_SHARED_LIBRARY=on but it should turn on in linux by default.
my env is ubuntu 24.04 the llvm source code is git clone from the last(20.0) Configured by:
when i compile by
clang hello.c
,it works as i expected.(hello.c
is just aprintf
hello world test) but if i compile byclang -static hello.c
looks like something missing about
libunwind,so
I compile byclang -static -lunwind hello.c
, It works just fine. Is there something wrong about my configuration,I want build a llvm toolchain replace gcc