【硬件配置】 1、整机 型号:3C5000L 2、处理器:loongson-3A5000L 3、内存信息:128G 12、显卡 型号:集显 13、网卡 Intel Corporation 82599ES 10-Gigabit 【版本信息】 1、固件版本: Vendor : Loongson Version : Loongson-UDK2018-V1.4.2-8W ROM Size : 63 KB Release Date : 11/05/2021 Board Information Manufacturer : Loongson Board Name : Loongson-LS2C5LE Family : LOONGSON3 2.系统版本:anolis-8-loongarch64-dvd1-20211210.1.iso 3.内核版本 :Linux localhost.localdomain 4.19.190-3.an8.loongarch64 #1 SMP Tue Dec 7 17:19:44 UTC 2021 loongarch64 loongarch64 loongarch64 GNU/Linux 【重现概率】: 必现100% 【测试步骤】 1. yum install clang llvm -y 2. 生成test.c内容如下 #include <stdio.h> int main(){ printf("hello"); return 0; } 3.编译 clang test.c -o test 【预期结果】: 编译成功,生成test可执行文件 【实际结果】: 报错如下 /usr/bin/ld: 找不到 crtbegin.o: 没有那个文件或目录 /usr/bin/ld: 找不到 -lgcc /usr/bin/ld: 找不到 -lgcc_s clang-8: error: linker command failed with exit code 1 (use -v to see invocation)
Created attachment 38 [details] gcc rpm包
用附件中gcc替换原有gcc,gcc llvm clang因为提供的是二进制,但是gcc构建系统与llvm和clang不一致,导致文件存在差异,更新后解决
使用新的clang <mock-chroot> sh-4.4# clang test.c -o test 'la464' is not a recognized processor for this target (ignoring processor) 'la464' is not a recognized processor for this target (ignoring processor) 'la464' is not a recognized processor for this target (ignoring processor) 'la464' is not a recognized processor for this target (ignoring processor) 'la464' is not a recognized processor for this target (ignoring processor) 'la464' is not a recognized processor for this target (ignoring processor) 'la464' is not a recognized processor for this target (ignoring processor) 'la464' is not a recognized processor for this target (ignoring processor) 'la464' is not a recognized processor for this target (ignoring processor) 'la464' is not a recognized processor for this target (ignoring processor) 'la464' is not a recognized processor for this target (ignoring processor) 'la464' is not a recognized processor for this target (ignoring processor) Stack dump: 0. Program arguments: /usr/bin/clang-8 -cc1 -triple loongarch64-loongson-linux-gnu -emit-obj -mrelax-all -disable-free -disable-llvm-verifier -discard-value-names -main-file-name test.c -mrelocation-model pic -pic-level 1 -mthread-model posix -mdisable-fp-elim -fmath-errno -masm-verbose -mconstructor-aliases -fuse-init-array -target-cpu la464 -target-feature +fp64 -target-abi lp64 -mfloat-abi hard -dwarf-column-info -debugger-tuning=gdb -resource-dir /usr/lib64/clang/8.0.1 -internal-isystem /usr/local/include -internal-isystem /usr/lib64/clang/8.0.1/include -internal-externc-isystem /include -internal-externc-isystem /usr/include -fdebug-compilation-dir / -ferror-limit 19 -fmessage-length 130 -fobjc-runtime=gcc -fdiagnostics-show-option -o /tmp/test-9a900f.o -x c test.c -faddrsig 1. <eof> parser at end of file 2. Code generation 3. Running pass 'Function Pass Manager' on module 'test.c'. 4. Running pass 'LoongArch DAG->DAG Pattern Instruction Selection' on function '@main' /lib64/libLLVM-8.so(_ZN4llvm3sys15PrintStackTraceERNS_11raw_ostreamE+0x24)[0xfff3b9f254] clang-8: error: unable to execute command: Segmentation fault (core dumped) clang-8: error: clang frontend command failed due to signal (use -v to see invocation) clang version 8.0.1 (Loognson 8.0.1-1.3.an8) Target: loongarch64-loongson-linux-gnu Thread model: posix InstalledDir: /usr/bin clang-8: note: diagnostic msg: PLEASE submit a bug report to and include the crash backtrace, preprocessed source, and associated run script. clang-8: note: diagnostic msg: ******************** PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT: Preprocessed source(s) and associated run script(s) are located at: clang-8: note: diagnostic msg: /tmp/test-2f9d6e.c clang-8: note: diagnostic msg: /tmp/test-2f9d6e.sh clang-8: note: diagnostic msg: ******************** <mock-chroot> sh-4.4# cat test.c #include <stdio.h> int main(){ printf("hello"); return 0; }
(In reply to geliwei-ali from comment #3) > 使用新的clang > <mock-chroot> sh-4.4# clang test.c -o test > 'la464' is not a recognized processor for this target (ignoring processor) > 'la464' is not a recognized processor for this target (ignoring processor) > 'la464' is not a recognized processor for this target (ignoring processor) > 'la464' is not a recognized processor for this target (ignoring processor) > 'la464' is not a recognized processor for this target (ignoring processor) > 'la464' is not a recognized processor for this target (ignoring processor) > 'la464' is not a recognized processor for this target (ignoring processor) > 'la464' is not a recognized processor for this target (ignoring processor) > 'la464' is not a recognized processor for this target (ignoring processor) > 'la464' is not a recognized processor for this target (ignoring processor) > 'la464' is not a recognized processor for this target (ignoring processor) > 'la464' is not a recognized processor for this target (ignoring processor) > Stack dump: > 0. Program arguments: /usr/bin/clang-8 -cc1 -triple > loongarch64-loongson-linux-gnu -emit-obj -mrelax-all -disable-free > -disable-llvm-verifier -discard-value-names -main-file-name test.c > -mrelocation-model pic -pic-level 1 -mthread-model posix -mdisable-fp-elim > -fmath-errno -masm-verbose -mconstructor-aliases -fuse-init-array > -target-cpu la464 -target-feature +fp64 -target-abi lp64 -mfloat-abi hard > -dwarf-column-info -debugger-tuning=gdb -resource-dir /usr/lib64/clang/8.0.1 > -internal-isystem /usr/local/include -internal-isystem > /usr/lib64/clang/8.0.1/include -internal-externc-isystem /include > -internal-externc-isystem /usr/include -fdebug-compilation-dir / > -ferror-limit 19 -fmessage-length 130 -fobjc-runtime=gcc > -fdiagnostics-show-option -o /tmp/test-9a900f.o -x c test.c -faddrsig > 1. <eof> parser at end of file > 2. Code generation > 3. Running pass 'Function Pass Manager' on module 'test.c'. > 4. Running pass 'LoongArch DAG->DAG Pattern Instruction Selection' on > function '@main' > /lib64/libLLVM-8. > so(_ZN4llvm3sys15PrintStackTraceERNS_11raw_ostreamE+0x24)[0xfff3b9f254] > clang-8: error: unable to execute command: Segmentation fault (core dumped) > clang-8: error: clang frontend command failed due to signal (use -v to see > invocation) > clang version 8.0.1 (Loognson 8.0.1-1.3.an8) > Target: loongarch64-loongson-linux-gnu > Thread model: posix > InstalledDir: /usr/bin > clang-8: note: diagnostic msg: PLEASE submit a bug report to and include > the crash backtrace, preprocessed source, and associated run script. > clang-8: note: diagnostic msg: > ******************** > > PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT: > Preprocessed source(s) and associated run script(s) are located at: > clang-8: note: diagnostic msg: /tmp/test-2f9d6e.c > clang-8: note: diagnostic msg: /tmp/test-2f9d6e.sh > clang-8: note: diagnostic msg: > > ******************** > <mock-chroot> sh-4.4# cat test.c > #include <stdio.h> > int main(){ > printf("hello"); > return 0; > } 需要同时升级llvm,问题解决
已经导入rpm
RC2版本 yum源compose源http://8.131.87.1/kojifiles/output/an-8-loongarch64-RC2/compose/ 复测编译.c文件仍然报错,如下 [root@localhost clang+LLVM]# clang test.c -o test 'gs464v' is not a recognized processor for this target (ignoring processor) 'gs464v' is not a recognized processor for this target (ignoring processor) 'gs464v' is not a recognized processor for this target (ignoring processor) 'gs464v' is not a recognized processor for this target (ignoring processor) 'gs464v' is not a recognized processor for this target (ignoring processor) 'gs464v' is not a recognized processor for this target (ignoring processor) 'gs464v' is not a recognized processor for this target (ignoring processor) 'gs464v' is not a recognized processor for this target (ignoring processor) 'gs464v' is not a recognized processor for this target (ignoring processor) 'gs464v' is not a recognized processor for this target (ignoring processor) 'gs464v' is not a recognized processor for this target (ignoring processor) 'gs464v' is not a recognized processor for this target (ignoring processor) Stack dump: 0. Program arguments: /usr/bin/clang-8 -cc1 -triple loongarch64-redhat-linux-gnu -emit-obj -mrelax-all -disable-free -disable-llvm-verifier -discard-value-names -main-file-name test.c -mrelocation-model pic -pic-level 1 -mthread-model posix -mdisable-fp-elim -fmath-errno -masm-verbose -mconstructor-aliases -fuse-init-array -target-cpu gs464v -target-feature +fp64 -target-abi lp64 -mfloat-abi hard -dwarf-column-info -debugger-tuning=gdb -resource-dir /usr/lib64/clang/8.0.1 -internal-isystem /usr/local/include -internal-isystem /usr/lib64/clang/8.0.1/include -internal-externc-isystem /include -internal-externc-isystem /usr/include -fdebug-compilation-dir /home/loongson/loongnix-testsuite/19-dev_language/clang+LLVM -ferror-limit 19 -fmessage-length 238 -fobjc-runtime=gcc -fdiagnostics-show-option -fcolor-diagnostics -o /tmp/test-47abaa.o -x c test.c -faddrsig 1. <eof> parser at end of file 2. Code generation 3. Running pass 'Function Pass Manager' on module 'test.c'. 4. Running pass 'LoongArch DAG->DAG Pattern Instruction Selection' on function '@main' #0 0x000000fff45e5a84 llvm::sys::PrintStackTrace(llvm::raw_ostream&) (/lib64/libLLVM-8.so+0x985a84) clang-8: error: unable to execute command: Segmentation fault (core dumped) clang-8: error: clang frontend command failed due to signal (use -v to see invocation) clang version 8.0.1 (Loognson 8.0.1-1.1.lns8) Target: loongarch64-redhat-linux-gnu Thread model: posix InstalledDir: /usr/bin clang-8: note: diagnostic msg: PLEASE submit a bug report to and include the crash backtrace, preprocessed source, and associated run script. clang-8: note: diagnostic msg: ******************** PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT: Preprocessed source(s) and associated run script(s) are located at: clang-8: note: diagnostic msg: /tmp/test-e53a0b.c clang-8: note: diagnostic msg: /tmp/test-e53a0b.sh clang-8: note: diagnostic msg: ******************** [root@localhost clang+LLVM]# clang -O3 -emit-llvm test.c -c -o test.bc 'gs464v' is not a recognized processor for this target (ignoring processor) 'gs464v' is not a recognized processor for this target (ignoring processor) 'gs464v' is not a recognized processor for this target (ignoring processor) 'gs464v' is not a recognized processor for this target (ignoring processor) 'gs464v' is not a recognized processor for this target (ignoring processor) 'gs464v' is not a recognized processor for this target (ignoring processor) 'gs464v' is not a recognized processor for this target (ignoring processor) [root@localhost clang+LLVM]# clang -O3 -emit-llvm test.c -S -o test.ll 'gs464v' is not a recognized processor for this target (ignoring processor) 'gs464v' is not a recognized processor for this target (ignoring processor) 'gs464v' is not a recognized processor for this target (ignoring processor) 'gs464v' is not a recognized processor for this target (ignoring processor) 'gs464v' is not a recognized processor for this target (ignoring processor) 'gs464v' is not a recognized processor for this target (ignoring processor) 'gs464v' is not a recognized processor for this target (ignoring processor) 报“段错误 (核心已转储)” 如下 [root@localhost clang+LLVM]# lli test.bc 'gs464v' is not a recognized processor for this target (ignoring processor) 'gs464v' is not a recognized processor for this target (ignoring processor) 'gs464v' is not a recognized processor for this target (ignoring processor) 'gs464v' is not a recognized processor for this target (ignoring processor) 'gs464v' is not a recognized processor for this target (ignoring processor) Stack dump: 0. Program arguments: lli test.bc 1. Running pass 'Function Pass Manager' on module 'test.bc'. 2. Running pass 'LoongArch DAG->DAG Pattern Instruction Selection' on function '@main' #0 0x000000fff4b75a84 llvm::sys::PrintStackTrace(llvm::raw_ostream&) (/lib64/libLLVM-8.so+0x985a84) 段错误 (核心已转储) [root@localhost clang+LLVM]# llc test.bc -o test.s 'gs464v' is not a recognized processor for this target (ignoring processor) 'gs464v' is not a recognized processor for this target (ignoring processor) 'gs464v' is not a recognized processor for this target (ignoring processor) 'gs464v' is not a recognized processor for this target (ignoring processor) 'gs464v' is not a recognized processor for this target (ignoring processor) Stack dump: 0. Program arguments: llc test.bc -o test.s 1. Running pass 'Function Pass Manager' on module 'test.bc'. 2. Running pass 'LoongArch DAG->DAG Pattern Instruction Selection' on function '@main' #0 0x000000fff2ac1a84 llvm::sys::PrintStackTrace(llvm::raw_ostream&) (/lib64/libLLVM-8.so+0x985a84) 段错误 (核心已转储) [root@localhost clang+LLVM]#
这个用的是最新提供的gcc,llvm,clang吗
替换最新的gcc、llvm、clang,然后更新repo源之后即可解决
更新源后复测通过