【求助】clang18适配oh clang15编译libunwind报错
摘要:错误提示如下: -- Using libunwind testing configuration: /home/water/llvm/toolchain/llvm-project/libunwind/test/configs/llvm-libunwind-shared.cfg.in STATUS,"LIBUNWIND_ENABLE_SHARED=O
摘要:错误提示如下:
-- Using libunwind testing configuration: /home/water/llvm/toolchain/llvm-project/libunwind/test/configs/llvm-libunwind-shared.cfg.in
STATUS,"LIBUNWIND_ENABLE_SHARED=ON,CXX_SUPPORTS_FNO_EXCEPTIONS_FLAG=,CXX_SUPPORTS_FUNWIND_TABLES_FLAG=1"
CMake Error at /home/water/llvm/toolchain/llvm-project/libunwind/src/CMakeLists.txt:97 (message):
Compiler doesn't support generation of unwind tables if exception support
is disabled. Building libunwind DSO with runtime dependency on C++ ABI
library is not supported.
看代码报错的位置应该是这里:
toolchain\llvm-project\libunwind\src\CMakeLists.txt
if (LIBUNWIND_ENABLE_SHARED AND
NOT (CXX_SUPPORTS_FNO_EXCEPTIONS_FLAG AND
CXX_SUPPORTS_FUNWIND_TABLES_FLAG))
message(FATAL_ERROR
"Compiler doesn't support generation of unwind tables if exception "
"support is disabled. Building libunwind DSO with runtime dependency "
"on C++ ABI library is not supported.")
endif()
是有这几个宏控制的:
LIBUNWIND_ENABLE_SHARED,CXX_SUPPORTS_FNO_EXCEPTIONS_FLAG,CXX_SUPPORTS_FUNWIND_TABLES_FLAG
具体的编译错误如下:
home/water/llvm/toolchain/llvm-project/lldb/tools/lldb-server/lldb-platform.cpp:51:12: warning: unused variable 'g_timeout_sec' [-Wunused-variable]
static int g_timeout_sec = 300;
^
1 warning generated.
[1063/2026] Linking CXX shared module lib/BugpointPasses.so
clang-15: warning: argument unused during compilation: '-pie' [-Wunused-command-line-argument]
[1186/2026] Linking CXX shared library lib/liblldb.so.18.0.0git
clang-15: warning: argument unused during compilation: '-pie' [-Wunused-command-line-argument]
[1197/2026] Linking CXX shared library lib/liblldbIntelFeatures.so.18git
clang-15: warning: argument unused during compilation: '-pie' [-Wunused-command-line-argument]
[1234/2026] Performing configure step for 'builtins'
Not searching for unused variables given on the command line.
-- The C compiler identification is Clang 18.0.0
-- The ASM compiler identification is Clang with GNU-like command-line
-- Found assembler: /home/water/llvm/out/llvm_make/./bin/clang
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /home/water/llvm/out/llvm_make/./bin/clang - skipped
-- Detecting C compile features
-- Detecting C compile features - done
CMake Warning at /home/water/llvm/toolchain/llvm-project/compiler-rt/cmake/Modules/CompilerRTUtils.cmake:281 (message):
LLVM_CONFIG_PATH is deprecated, please use LLVM_CMAKE_DIR instead
Call Stack (most recent call first):
CMakeLists.txt:29 (load_llvm_config)
-- Could NOT find ZLIB (missing: ZLIB_LIBRARY) (found version "1.2.11")
CMake Warning at /home/water/llvm/toolchain/llvm-project/compiler-rt/cmake/Modules/CompilerRTUtils.cmake:326 (message):
LLVMTestingSupport not found in LLVM_AVAILABLE_LIBS
Call Stack (most recent call first):
CMakeLists.txt:29 (load_llvm_config)
-- LLVM_MAIN_SRC_DIR: "/home/water/llvm/toolchain/llvm-project/llvm"
-- Builtin supported architectures:
-- Configuring done
-- Generating done
-- Build files have been written to: /home/water/llvm/out/llvm_make/runtimes/builtins-bins
[1235/2026] Performing build step for 'builtins'
ninja: no work to do.
[1236/2026] No install step for 'builtins'
[1243/2026] Performing configure step for 'runtimes'
Not searching for unused variables given on the command line.
-- The C compiler identification is Clang 18.0.0
-- The CXX compiler identification is Clang 18.0.0
-- The ASM compiler identification is Clang with GNU-like command-line
-- Found assembler: /home/water/llvm/out/llvm_make/./bin/clang
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /home/water/llvm/out/llvm_make/./bin/clang - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /home/water/llvm/out/llvm_make/./bin/clang++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found ZLIB: /usr/lib/x86_64-linux-gnu/libz.so (found version "1.2.11")
-- Building with -fPIC
-- LLVM host triple: x86_64-unknown-linux-gnu
-- LLVM default target triple: x86_64-unknown-linux-gnu
-- Using libunwind testing configuration: /home/water/llvm/toolchain/llvm-project/libunwind/test/configs/llvm-libunwind-shared.cfg.in
STATUS,"LIBUNWIND_ENABLE_SHARED=ON,CXX_SUPPORTS_FNO_EXCEPTIONS_FLAG=,CXX_SUPPORTS_FUNWIND_TABLES_FLAG=1"
CMake Error at /home/water/llvm/toolchain/llvm-project/libunwind/src/CMakeLists.txt:97 (message):
Compiler doesn't support generation of unwind tables if exception support
is disabled. Building libunwind DSO with runtime dependency on C++ ABI
library is not supported.
-- Configuring incomplete, errors occurred!
See also "/home/water/llvm/out/llvm_make/runtimes/runtimes-bins/CMakeFiles/CMakeOutput.log".
See also "/home/water/llvm/out/llvm_make/runtimes/runtimes-bins/CMakeFiles/CMakeError.log".
FAILED: runtimes/runtimes-stamps/runtimes-configure /home/water/llvm/out/llvm_make/runtimes/runtimes-stamps/runtimes-configure
cd /home/water/llvm/out/llvm_make/runtimes/runtimes-bins && /home/water/llvm/prebuilts/cmake/bin/cmake --no-warn-unused-cli -DCMAKE_C_COMPILER=/home/water/llvm/out/llvm_make/./bin/clang -DCMAKE_CXX_COMPILER=/home/water/llvm/out/llvm_make/./bin/clang++ -DCMAKE_ASM_COMPILER=/home/water/llvm/out/llvm_make/./bin/clang -DCMAKE_LINKER=/home/water/llvm/out/llvm_make/./bin/ld.lld -DCMAKE_AR=/home/water/llvm/out/llvm_make/./bin/llvm-ar -DCMAKE_RANLIB=/home/water/llvm/out/llvm_make/./bin/llvm-ranlib -DCMAKE_NM=/home/water/llvm/out/llvm_make/./bin/llvm-nm -DCMAKE_OBJDUMP=/home/water/llvm/out/llvm_make/./bin/llvm-objdump -DCMAKE_OBJCOPY=/home/water/llvm/out/llvm_make/./bin/llvm-objcopy -DCMAKE_STRIP=/home/water/llvm/out/llvm_make/./bin/llvm-strip -DCMAKE_READELF=/home/water/llvm/out/llvm_make/./bin/llvm-readelf -DCMAKE_C_COMPILER_TARGET=x86_64-unknown-linux-gnu -DCMAKE_CXX_COMPILER_TARGET=x86_64-unknown-linux-gnu -DCMAKE_ASM_COMPILER_TARGET=x86_64-unknown-linux-gnu -DCMAKE_INSTALL_PREFIX=/home/water/llvm/out/llvm-install -DLLVM_BINARY_DIR=/home/water/llvm/out/llvm_make -DLLVM_CONFIG_PATH=/home/water/llvm/out/llvm_make/bin/llvm-config -DLLVM_ENABLE_WERROR=OFF -DLLVM_HOST_TRIPLE=x86_64-unknown-linux-gnu -DLLVM_HAVE_LINK_VERSION_SCRIPT=1 -DLLVM_USE_RELATIVE_PATHS_IN_DEBUG_INFO=OFF -DLLVM_USE_RELATIVE_PATHS_IN_FILES=OFF -DLLVM_LIT_ARGS=-sv -DLLVM_SOURCE_PREFIX= -DPACKAGE_VERSION=18.0.0git -DCMAKE_BUILD_TYPE=Release -DCMAKE_MAKE_PROGRAM=/home/water/llvm/prebuilts/cmake/bin/ninja -DCMAKE_EXPORT_COMPILE_COMMANDS=1 -DCOMPILER_RT_BUILD_BUILTINS=Off -DLLVM_INCLUDE_TESTS=ON -DLLVM_DEFAULT_TARGET_TRIPLE=x86_64-unknown-linux-gnu -DLLVM_ENABLE_PROJECTS_USED=ON -DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=ON -DLLVM_BUILD_TOOLS=ON -DCMAKE_C_COMPILER_WORKS=ON -DCMAKE_CXX_COMPILER_WORKS=ON -DCMAKE_ASM_COMPILER_WORKS=ON -DHAVE_LLVM_LIT=ON "-DLLVM_ENABLE_RUNTIMES=libunwind;libcxxabi;libcxx;compiler-rt" -DLLVM_USE_LINKER=lld -DLIBUNWIND_USE_COMPILER_RT=ON -DLIBCXXABI_ENABLE_STATIC_UNWINDER=ON -DLIBCXXABI_STATICALLY_LINK_UNWINDER_IN_STATIC_LIBRARY=YES -DLIBCXXABI_USE_COMPILER_RT=ON -DLIBCXXABI_USE_LLVM_UNWINDER=ON -DLIBCXXABI_ENABLE_STATIC_UNWINDER=ON -DLIBCXXABI_STATICALLY_LINK_UNWINDER_IN_STATIC_LIBRARY=YES -DLIBCXXABI_USE_COMPILER_RT=ON -DLIBCXXABI_USE_LLVM_UNWINDER=ON -DLIBCXX_ENABLE_ABI_LINKER_SCRIPT=OFF -DLIBCXX_ENABLE_STATIC_ABI_LIBRARY=ON -DLIBCXX_USE_COMPILER_RT=ON -DCOMPILER_RT_BUILD_LIBFUZZER=ON -DCOMPILER_RT_BUILD_MEMPROF=OFF -DCOMPILER_RT_BUILD_ORC=OFF -DCOMPILER_RT_BUILD_SANITIZERS=OFF -DCOMPILER_RT_BUILD_XRAY=OFF -DCOMPILER_RT_ENABLE_STATIC_UNWINDER=ON -DCOMPILER_RT_USE_BUILTINS_LIBRARY=ON -DCOMPILER_RT_USE_LLVM_UNWINDER=ON -DSANITIZER_ALLOW_CXXABI=OFF -GNinja /home/water/llvm/toolchain/llvm-project/llvm/runtimes/../../runtimes && /home/water/llvm/prebuilts/cmake/bin/cmake -E touch /home/water/llvm/out/llvm_make/runtimes/runtimes-stamps/runtimes-configure
[1245/2026] Linking CXX executable bin/llvm-lto2
去掉CXX_SUPPORTS_FNO_EXCEPTIONS_FLAG ON)后报了如下错误:
ld.lld: error: unable to find library -lNOTFOUND
ld.lld: error: cannot open /home/water/llvm/out/llvm_make/lib/clang/18/lib/linux/libclang_rt.builtins-x86_64.a: No such file or directory
Out目录下只生成了静态库:
INFO:__main__:check_call:15:59:27 /home/water/llvm/prebuilts/cmake/bin/ninja
[3/28] Linking CXX shared library lib/libRemarks.so.18git
clang-15: warning: argument unused during compilation: '-pie' [-Wunused-command-line-argument]
[7/28] Performing build step for 'builtins'
ninja: no work to do.
[8/28] No install step for 'builtins'
[10/28] Performing configure step for 'runtimes'
Not searching for unused variables given on the command line.
-- Building with -fPIC
-- LLVM host triple: x86_64-unknown-linux-gnu
-- LLVM default target triple: x86_64-unknown-linux-gnu
-- Using libunwind testing configuration: /home/water/llvm/toolchain/llvm-project/libunwind/test/configs/llvm-libunwind-shared.cfg.in
STATUS,"LIBUNWIND_ENABLE_SHARED=ON,CXX_SUPPORTS_FNO_EXCEPTIONS_FLAG=,CXX_SUPPORTS_FUNWIND_TABLES_FLAG=1"
-- Failed to locate sphinx-build executable (missing: SPHINX_EXECUTABLE)
-- Using libc++abi testing configuration: /home/water/llvm/toolchain/llvm-project/libcxxabi/test/configs/llvm-libc++abi-shared.cfg.in
CMake Warning at /home/water/llvm/toolchain/llvm-project/libcxxabi/cmake/config-ix.cmake:47 (message):
Could not find builtins library from libc++abi
Call Stack (most recent call first):
/home/water/llvm/toolchain/llvm-project/libcxxabi/CMakeLists.txt:261 (include)
-- Using libc++ testing configuration: /home/water/llvm/toolchain/llvm-project/libcxx/test/configs/llvm-libc++-shared.cfg.in
CMake Warning at /home/water/llvm/toolchain/llvm-project/libcxx/cmake/config-ix.cmake:67 (message):
Could not find builtins library from libc++
Call Stack (most recent call first):
/home/water/llvm/toolchain/llvm-project/libcxx/CMakeLists.txt:466 (include)
WARNING,"config-ix.cmake:--_find_compiler_rt_library_--"
-- Performing Test -ftrivial-auto-var-init=pattern
-- Performing Test -ftrivial-auto-var-init=pattern - Failed
-- Compiler-RT supported architectures:
STATUS,"LLVM_MAIN_SRC_DIR=/home/water/llvm/toolchain/llvm-project/runtimes/../llvm."
STATUS,"COMPILER_RT_LIBCXXABI_PATH=/home/water/llvm/toolchain/llvm-project/runtimes/../libcxxabi."
-- check-shadowcallstack does nothing.
-- check-compiler-rt does nothing.
-- Configuring done
-- Generating done
-- Build files have been written to: /home/water/llvm/out/llvm_make/runtimes/runtimes-bins
[11/28] Performing build step for 'runtimes'
[5/1037] Linking C shared library /home/water/llvm/out/llvm_make/lib/x86_64-unknown-linux-gnu/libunwind.so.1.0
FAILED: /home/water/llvm/out/llvm_make/lib/x86_64-unknown-linux-gnu/libunwind.so.1.0
: && /home/water/llvm/out/llvm_make/./bin/clang --target=x86_64-unknown-linux-gnu -fPIC -fPIC -fno-semantic-interposition -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -Wimplicit-fallthrough -Wcovered-switch-default -Wstring-conversion -Wmisleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -ffunction-sections -fdata-sections -O3 -DNDEBUG -Wl,-z,defs -Wl,-z,nodelete -fuse-ld=lld -Wl,--color-diagnostics -rtlib=compiler-rt --unwindlib=none -nostdlib++ -shared -Wl,-soname,libunwind.so.1 -o /home/water/llvm/out/llvm_make/lib/x86_64-unknown-linux-gnu/libunwind.so.1.0 libunwind/src/CMakeFiles/unwind_shared_objects.dir/libunwind.cpp.o libunwind/src/CMakeFiles/unwind_shared_objects.dir/Unwind-EHABI.cpp.o libunwind/src/CMakeFiles/unwind_shared_objects.dir/Unwind-seh.cpp.o libunwind/src/CMakeFiles/unwind_shared_objects.dir/UnwindLevel1.c.o libunwind/src/CMakeFiles/unwind_shared_objects.dir/UnwindLevel1-gcc-ext.c.o libunwind/src/CMakeFiles/unwind_shared_objects.dir/Unwind-sjlj.c.o libunwind/src/CMakeFiles/unwind_shared_objects.dir/UnwindRegistersRestore.S.o libunwind/src/CMakeFiles/unwind_shared_objects.dir/UnwindRegistersSave.S.o -lc -lNOTFOUND && :
ld.lld: error: unable to find library -lNOTFOUND
ld.lld: error: cannot open /home/water/llvm/out/llvm_make/lib/clang/18/lib/linux/libclang_rt.builtins-x86_64.a: No such file or directory
ld.lld: error: cannot open /home/water/llvm/out/llvm_make/lib/clang/18/lib/linux/libclang_rt.builtins-x86_64.a: No such file or directory
clang: error: linker command failed with exit code 1 (use -v to see invocation)
更多推荐
所有评论(0)