【求助】在OpenHarmony / third_party_llvm-project(master分支,4.0版本)基础上适配最新的clang18
参考:llvm-build · OpenHarmony/third_party_llvm-project - 码云 - 开源中国 (gitee.com) 在OpenHarmony / third_party_llvm-project()基础上,在toolchain目录使用clang18版本,然后同步oh clang15的修改&#
参考:third_party_llvm-project: 管理员 liwentao_uiw dhy308 huanghuijin - Gitee.com
在OpenHarmony / third_party_llvm-project(master分支,4.0版本)基础上,在toolchain目录使用clang18版本,然后同步oh clang15的修改,然后编译修改过的clang18。
1.更新cmake到20版本。
2.更新third_party目录下的musl。
使用python3 ./toolchain/llvm-project/llvm-build/build.py命令编译整个工程,提示如下报错:
提示找不到AArch64::TCRETURNriAA,看了下代码,发现这个变量是自动生成的,具体实现不是很清楚。有大神可以帮忙解答一下么??
r@ubuntu:~/llvm$ python3 ./toolchain/llvm-project/llvm-build/build.py
INFO:__main__:check_call:14:41:36 /home/water/llvm/prebuilts/cmake/bin/cmake -G Ninja -DCMAKE_PREFIX_PATH=/home/water/llvm/prebuilts/cmake/bin -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_ASSERTIONS=OFF -DLLVM_ENABLE_TERMINFO=OFF -DLLVM_ENABLE_THREADS=ON -DLLVM_USE_NEWPM=ON -DLLVM_ENABLE_BINDINGS=OFF -DCLANG_REPOSITORY_STRING=llvm-project -DPython3_EXECUTABLE=/home/water/llvm/prebuilts/python3/linux-x86/3.10.2/bin/python3 -DPython3_INCLUDE_DIRS=/home/water/llvm/prebuilts/python3/linux-x86/3.10.2/include/python3.10 -DPython3_LIBRARIES=/home/water/llvm/prebuilts/python3/linux-x86/3.10.2/lib/libpython3.10.so -DCOMPILER_RT_BUILD_XRAY=OFF -DCMAKE_INSTALL_PREFIX=/home/water/llvm/out/llvm-install -DLLVM_INSTALL_UTILS=ON -DLLVM_TARGETS_TO_BUILD=AArch64;ARM;BPF;Mips;RISCV;X86;LoongArch -DLLVM_BUILD_LLVM_DYLIB=ON "-DCLANG_VENDOR=OHOS (dev) " -DCLANG_VENDOR_BUILD_VERSION= -DLLVM_ENABLE_LLD=ON -DCOMPILER_RT_BUILD_LIBFUZZER=ON -DLIBCXX_ENABLE_STATIC_ABI_LIBRARY=ON -DLIBCXX_ENABLE_ABI_LINKER_SCRIPT=OFF -DLIBCXX_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 -DCOMPILER_RT_USE_LLVM_UNWINDER=ON -DCOMPILER_RT_ENABLE_STATIC_UNWINDER=ON -DCOMPILER_RT_USE_BUILTINS_LIBRARY=ON -DCOMPILER_RT_BUILD_ORC=OFF -DLIBUNWIND_USE_COMPILER_RT=ON -DLLVM_BINUTILS_INCDIR=/usr/include -DLLDB_PYTHON_EXT_SUFFIX=.so -DLLVM_ENABLE_LTO=Thin -DLLVM_ENABLE_PROJECTS=clang;lld;clang-tools-extra;openmp;lldb -DLLVM_ENABLE_RUNTIMES=libunwind;libcxxabi;libcxx;compiler-rt -DCMAKE_C_COMPILER=/home/water/llvm/prebuilts/clang/ohos/linux-x86_64/clang-15.0.4/bin/clang -DCMAKE_CXX_COMPILER=/home/water/llvm/prebuilts/clang/ohos/linux-x86_64/clang-15.0.4/bin/clang++ -DCMAKE_AR=/home/water/llvm/prebuilts/clang/ohos/linux-x86_64/clang-15.0.4/bin/llvm-ar -DCMAKE_RANLIB=/home/water/llvm/prebuilts/clang/ohos/linux-x86_64/clang-15.0.4/bin/llvm-ranlib -DLLVM_ENABLE_LIBCXX=ON -DSANITIZER_ALLOW_CXXABI=OFF -DLIBOMP_ENABLE_SHARED=FALSE -DOPENMP_TEST_FLAGS=-Wl,-ldl -DCLANG_BUILD_EXAMPLES=OFF -DLLDB_ENABLE_LIBEDIT=OFF -DCOMPILER_RT_BUILD_SANITIZERS=OFF -DCOMPILER_RT_BUILD_MEMPROF=OFF -DCMAKE_ASM_FLAGS=-fstack-protector-strong -DCMAKE_C_FLAGS=-fstack-protector-strong "-DCMAKE_CXX_FLAGS=-fstack-protector-strong -stdlib=libc++" "-DCMAKE_EXE_LINKER_FLAGS=-fuse-ld=lld -L/home/water/llvm/prebuilts/clang/ohos/linux-x86_64/clang-15.0.4/lib -l:libunwind.a -l:libc++abi.a --rtlib=compiler-rt -stdlib=libc++ -static-libstdc++ -Wl,-z,relro,-z,now -pie" "-DCMAKE_SHARED_LINKER_FLAGS=-fuse-ld=lld -L/home/water/llvm/prebuilts/clang/ohos/linux-x86_64/clang-15.0.4/lib -l:libunwind.a -l:libc++abi.a --rtlib=compiler-rt -stdlib=libc++ -static-libstdc++ -Wl,-z,relro,-z,now -pie" "-DCMAKE_MODULE_LINKER_FLAGS=-fuse-ld=lld -L/home/water/llvm/prebuilts/clang/ohos/linux-x86_64/clang-15.0.4/lib -l:libunwind.a -l:libc++abi.a --rtlib=compiler-rt -stdlib=libc++ -static-libstdc++ -Wl,-z,relro,-z,now -pie" -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DLLDB_ENABLE_PYTHON=ON -DLLDB_EMBED_PYTHON_HOME=ON -DLLDB_PYTHON_HOME=../python3 -DLLDB_PYTHON_RELATIVE_PATH=bin/python/lib/python3.10 -DLLDB_PYTHON_EXE_RELATIVE_PATH=bin/python3 -DSWIG_EXECUTABLE=/usr/bin/swig -DLLDB_ENABLE_CURSES=OFF -DCMAKE_LINKER=/home/water/llvm/prebuilts/clang/ohos/linux-x86_64/llvm/bin/ld.lld /home/water/llvm/toolchain/llvm-project/llvm
-- bolt project is disabled
-- clang project is enabled
-- clang-tools-extra project is enabled
-- compiler-rt project is disabled
-- cross-project-tests project is disabled
-- libc project is disabled
-- libclc project is disabled
-- lld project is enabled
-- lldb project is enabled
-- mlir project is disabled
-- openmp project is enabled
-- polly project is disabled
-- pstl project is disabled
-- flang project is disabled
-- Found Python3: /home/water/llvm/prebuilts/python3/linux-x86/3.10.2/bin/python3 (found suitable version "3.10.2", minimum required is "3.6") found components: Interpreter
-- Could NOT find ZLIB (missing: ZLIB_LIBRARY) (found version "1.2.11")
-- Found LibXml2: /usr/lib/x86_64-linux-gnu/libxml2.so (found version "2.9.10")
-- Could NOT find LibEdit (missing: LibEdit_INCLUDE_DIRS LibEdit_LIBRARIES)
-- Native target architecture is X86
-- Threads enabled.
-- Doxygen disabled.
-- Ninja version: 1.9.0
-- Could NOT find OCaml (missing: OCAMLFIND OCAML_VERSION OCAML_STDLIB_PATH)
-- OCaml bindings disabled.
-- LLVM host triple: x86_64-unknown-linux-gnu
-- LLVM default target triple: x86_64-unknown-linux-gnu
-- ThinLTO provides its own parallel linking - limiting parallel link jobs to 2.
-- Building with -fPIC
-- Targeting AArch64
-- Targeting ARM
-- Targeting BPF
-- Targeting Mips
-- Targeting RISCV
-- Targeting X86
-- Targeting LoongArch
-- ITT Notify not supported for static libraries - forcing ITT Notify off
-- Version symbols not supported for static libraries - forcing Version symbols functionality off
-- Using LLVM include directories: /home/water/llvm/toolchain/llvm-project/llvm/include;/home/water/llvm/out/llvm_make/include
-- Could NOT find LIBOMPTARGET_DEP_LIBFFI (missing: LIBOMPTARGET_DEP_LIBFFI_LIBRARIES LIBOMPTARGET_DEP_LIBFFI_INCLUDE_DIRS)
-- OMPT target enabled
-- OpenMP tools dir in libomptarget: /home/water/llvm/out/llvm_make/projects/openmp/runtime/src
-- LIBOMPTARGET: Building offloading runtime library libomptarget.
-- LIBOMPTARGET: Not building aarch64 NextGen offloading plugin: machine not found in the system.
-- LIBOMPTARGET: Building AMDGPU NextGen plugin for dlopened libhsa
-- LIBOMPTARGET: Not generating AMDGPU tests, no supported devices detected.
-- LIBOMPTARGET: Building CUDA NextGen offloading plugin.
-- LIBOMPTARGET: Building CUDA plugin for dlopened libcuda
-- LIBOMPTARGET: Not generating NVIDIA tests, no supported devices detected.
-- LIBOMPTARGET: Not building PPC64 NextGen offloading plugin: machine not found in the system.
-- LIBOMPTARGET: Not building PPC64le NextGen offloading plugin: machine not found in the system.
-- LIBOMPTARGET: Not building x86_64 NextGen offloading plugin: libffi dependency not found.
-- LIBOMPTARGET: Building DeviceRTL. Using clang from in-tree build
-- LIBOMPTARGET: Building the llvm-omp-device-info tool
-- LIBOMPTARGET: Building the llvm-omp-kernel-replay tool
-- check-libomptarget does nothing.
-- Found Python3: /home/water/llvm/prebuilts/python3/linux-x86/3.10.2/bin/python3 (found version "3.10.2") found components: Interpreter Development Development.Module Development.Embed
-- Clang version: 18.0.0
-- LLD version: 18.0.0
-- Enable SWIG to generate LLDB bindings: TRUE
-- Enable editline support in LLDB: FALSE
-- Enable curses support in LLDB: FALSE
-- Could NOT find LibLZMA (missing: LIBLZMA_LIBRARY LIBLZMA_HAS_AUTO_DECODER LIBLZMA_HAS_EASY_ENCODER LIBLZMA_HAS_LZMA_PRESET) (found version "5.2.4")
-- Enable LZMA compression support in LLDB: FALSE
-- Could NOT find Lua (missing: LUA_LIBRARIES LUA_INCLUDE_DIR) (Required is exact version "5.3")
-- Could NOT find LuaAndSwig (missing: LUA_LIBRARIES LUA_INCLUDE_DIR)
-- Enable Lua scripting support in LLDB: FALSE
-- Enable Python scripting support in LLDB: TRUE
-- Found LibXml2: /usr/lib/x86_64-linux-gnu/libxml2.so (found suitable version "2.9.10", minimum required is "2.8")
-- Enable Libxml 2 support in LLDB: TRUE
-- Enable libfbsdvmcore support in LLDB: 0
-- LLDB version: 18.0.0git
-- SWIG version 4.0.1 uses `-py3` flag.
-- Skipping FreeBSDKernel plugin due to missing libfbsdvmcore
-- Symbols (liblldb): exporting all symbols from the lldb namespace
-- Registering ExampleIRTransforms as a pass plugin (static build: OFF)
-- Registering Bye as a pass plugin (static build: OFF)
-- Failed to find LLVM FileCheck
-- git version: v0.0.0-dirty normalized to 0.0.0
-- Version: 1.6.0
-- Performing Test HAVE_THREAD_SAFETY_ATTRIBUTES -- failed to compile
-- Performing Test HAVE_GNU_POSIX_REGEX -- failed to compile
-- Performing Test HAVE_POSIX_REGEX -- success
-- Performing Test HAVE_STEADY_CLOCK -- success
-- Configuring done
-- Generating done
-- Build files have been written to: /home/water/llvm/out/llvm_make
INFO:__main__:check_call:14:41:51 /home/water/llvm/prebuilts/cmake/bin/ninja
[34/5079] Building CXX object lib/Target/AArch64/CMakeFiles/LLVMAArch64CodeGen.dir/AArch64AsmPrinter.cpp.o
FAILED: lib/Target/AArch64/CMakeFiles/LLVMAArch64CodeGen.dir/AArch64AsmPrinter.cpp.o
/home/water/llvm/prebuilts/clang/ohos/linux-x86_64/clang-15.0.4/bin/clang++ -DGTEST_HAS_RTTI=0 -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -Ilib/Target/AArch64 -I/home/water/llvm/toolchain/llvm-project/llvm/lib/Target/AArch64 -Iinclude -I/home/water/llvm/toolchain/llvm-project/llvm/include -fstack-protector-strong -stdlib=libc++ -stdlib=libc++ -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic -Wno-long-long -Wc++98-compat-extra-semi -Wimplicit-fallthrough -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wsuggest-override -Wno-comment -Wstring-conversion -Wmisleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -ffunction-sections -fdata-sections -flto=thin -O3 -DNDEBUG -fPIC -fvisibility=hidden -fno-exceptions -funwind-tables -fno-rtti -std=c++17 -MD -MT lib/Target/AArch64/CMakeFiles/LLVMAArch64CodeGen.dir/AArch64AsmPrinter.cpp.o -MF lib/Target/AArch64/CMakeFiles/LLVMAArch64CodeGen.dir/AArch64AsmPrinter.cpp.o.d -o lib/Target/AArch64/CMakeFiles/LLVMAArch64CodeGen.dir/AArch64AsmPrinter.cpp.o -c /home/water/llvm/toolchain/llvm-project/llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp
/home/water/llvm/toolchain/llvm-project/llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp:1516:17: error: no member named 'TCRETURNriAA' in namespace 'llvm::AArch64'
case AArch64::TCRETURNriAA: {
~~~~~~~~~^
1 error generated.
[39/5079] Building CXX object lib/Target/AArch64/CMakeFiles/LLVMAArch64CodeGen.dir/AArch64CondBrTuning.cpp.o
ninja: build stopped: subcommand failed.
Traceback (most recent call last):
File "./toolchain/llvm-project/llvm-build/build.py", line 2339, in <module>
main()
File "./toolchain/llvm-project/llvm-build/build.py", line 2284, in main
llvm_core.llvm_compile(
File "./toolchain/llvm-project/llvm-build/build.py", line 749, in llvm_compile
self.build_llvm(targets=self.build_config.TARGETS,
File "./toolchain/llvm-project/llvm-build/build.py", line 575, in build_llvm
self.invoke_ninja(out_path=build_dir,
File "./toolchain/llvm-project/llvm-build/build.py", line 333, in invoke_ninja
self.check_call([ninja_bin_path] + ninja_list + ninja_target, cwd=out_path, env=env)
File "./toolchain/llvm-project/llvm-build/build.py", line 402, in check_call
subprocess.check_call(cmd, *args, **kwargs)
File "/usr/lib/python3.8/subprocess.py", line 364, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['/home/water/llvm/prebuilts/cmake/bin/ninja']' returned non-zero exit status 1.
更多推荐
所有评论(0)