I have successfully built the clang compiler. The cmake parameter specifies “- DLLVM_TARGETS_TO_BUILD=” RISCV “- DLLVM_DEFAULT_TARGET_TRIPLE=riscv32 unknown elf”. Then I want to build compiler-rt, following the steps given on the official website:
cd llvm project;
mkdir build-compiler-rt;
cd build-compiler-rt;
cmake ../compiler-rt -DLLVM_ CONFIG_ PATH=/path/to/llvm-config;
make;
but it reports error:
[ 19%] Building ASM object lib/builtins/CMakeFiles/clang_rt.builtins-riscv32.dir/riscv/save.S.o
[ 20%] Building C object lib/profile/CMakeFiles/clang_rt.profile-riscv32.dir/InstrProfilingPlatformLinux.c.o
/home/suncheng/llvm-project-15.0.4.src/compiler-rt/lib/builtins/riscv/save.S:185:3: error: "xlen must be 32 or 64 for save-restore implementation
# error "xlen must be 32 or 64 for save-restore implementation
^
1 error generated.
make[2]: *** [lib/builtins/CMakeFiles/clang_rt.builtins-riscv32.dir/build.make:68: lib/builtins/CMakeFiles/clang_rt.builtins-riscv32.dir/riscv/save.S.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:622: lib/builtins/CMakeFiles/clang_rt.builtins-riscv32.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
[ 20%] Building C object lib/profile/CMakeFiles/clang_rt.profile-riscv32.dir/InstrProfilingPlatformOther.c.o
[ 21%] Building C object lib/profile/CMakeFiles/clang_rt.profile-riscv32.dir/InstrProfilingPlatformWindows.c.o
[ 21%] Building CXX object lib/profile/CMakeFiles/clang_rt.profile-riscv32.dir/InstrProfilingRuntime.cpp.o
[ 22%] Building C object lib/profile/CMakeFiles/clang_rt.profile-riscv32.dir/InstrProfilingUtil.c.o
[ 22%] Linking CXX static library ../linux/libclang_rt.profile-riscv32.a
[ 22%] Built target clang_rt.profile-riscv32
make: *** [Makefile:130: all] Error 2
how to resolve this problem?