ruyisdk / ruyi

RuyiSDK Package Manager
Apache License 2.0
16 stars 8 forks source link

llvm-upstream: clang: fatal error: no configured target found for command clang #209

Closed weilinfox closed 1 month ago

weilinfox commented 1 month ago

影响版本

0.19.0

复现流程

ruyi update
ruyi install llvm-upstream gnu-upstream
ruyi venv -t llvm-upstream --sysroot-from gnu-upstream generic venv
. venv/bin/ruyi-activate
clang

fatal error: no configured target found for command clang
weilinfox commented 1 month ago

影响版本

0.20.0-beta.20241020

问题描述

报错改变为

fatal error: no configured target found for command ld.lld
clang: error: linker command failed with exit code 1 (use -v to see invocation)

clang 添加 -v 参数后

clang version 17.0.5
Target: riscv64-unknown-linux-gnu
Thread model: posix
InstalledDir: /home/hachi/.local/share/ruyi/binaries/x86_64/llvm-upstream-17.0.5-ruyi.20231121/bin
Selected GCC installation: /home/hachi/.local/share/ruyi/binaries/x86_64/gnu-plct-0.20240324.0/lib/gcc/riscv64-plct-linux-gnu/13.1.0
Candidate multilib: lib32/ilp32;@m32@mabi=ilp32
Candidate multilib: lib32/ilp32d;@m32@mabi=ilp32d
Candidate multilib: lib64/lp64;@m64@mabi=lp64
Candidate multilib: lib64/lp64d;@m64@mabi=lp64d
Selected multilib: lib64/lp64d;@m64@mabi=lp64d
 "/home/hachi/.local/share/ruyi/binaries/x86_64/llvm-upstream-17.0.5-ruyi.20231121/bin/clang-17" -cc1 -triple riscv64-unknown-linux-gnu -emit-obj -dumpdir hello_ruyi.o- -disable-free -clear-ast-before-backend -disable-llvm-verifier -discard-value-names -main-file-name hello_ruyi.c -mrelocation-model pic -pic-level 2 -pic-is-pie -mframe-pointer=none -fmath-errno -ffp-contract=on -fno-rounding-math -mconstructor-aliases -funwind-tables=2 -target-cpu generic-rv64 -target-feature +m -target-feature +a -target-feature +f -target-feature +d -target-feature +c -target-feature +zicsr -target-feature +zifencei -target-feature -e -target-feature -h -target-feature -svinval -target-feature -svnapot -target-feature -svpbmt -target-feature -v -target-feature -xcvbitmanip -target-feature -xcvmac -target-feature -xsfcie -target-feature -xsfvcp -target-feature -xtheadba -target-feature -xtheadbb -target-feature -xtheadbs -target-feature -xtheadcmo -target-feature -xtheadcondmov -target-feature -xtheadfmemidx -target-feature -xtheadmac -target-feature -xtheadmemidx -target-feature -xtheadmempair -target-feature -xtheadsync -target-feature -xtheadvdot -target-feature -xventanacondops -target-feature -zawrs -target-feature -zba -target-feature -zbb -target-feature -zbc -target-feature -zbkb -target-feature -zbkc -target-feature -zbkx -target-feature -zbs -target-feature -zca -target-feature -zcb -target-feature -zcd -target-feature -zce -target-feature -zcf -target-feature -zcmp -target-feature -zcmt -target-feature -zdinx -target-feature -zfh -target-feature -zfhmin -target-feature -zfinx -target-feature -zhinx -target-feature -zhinxmin -target-feature -zicbom -target-feature -zicbop -target-feature -zicboz -target-feature -zicntr -target-feature -zihintpause -target-feature -zihpm -target-feature -zk -target-feature -zkn -target-feature -zknd -target-feature -zkne -target-feature -zknh -target-feature -zkr -target-feature -zks -target-feature -zksed -target-feature -zksh -target-feature -zkt -target-feature -zmmul -target-feature -zve32f -target-feature -zve32x -target-feature -zve64d -target-feature -zve64f -target-feature -zve64x -target-feature -zvfh -target-feature -zvl1024b -target-feature -zvl128b -target-feature -zvl16384b -target-feature -zvl2048b -target-feature -zvl256b -target-feature -zvl32768b -target-feature -zvl32b -target-feature -zvl4096b -target-feature -zvl512b -target-feature -zvl64b -target-feature -zvl65536b -target-feature -zvl8192b -target-feature -experimental-smaia -target-feature -experimental-ssaia -target-feature -experimental-zacas -target-feature -experimental-zfa -target-feature -experimental-zfbfmin -target-feature -experimental-zicond -target-feature -experimental-zihintntl -target-feature -experimental-ztso -target-feature -experimental-zvbb -target-feature -experimental-zvbc -target-feature -experimental-zvfbfmin -target-feature -experimental-zvfbfwma -target-feature -experimental-zvkg -target-feature -experimental-zvkn -target-feature -experimental-zvknc -target-feature -experimental-zvkned -target-feature -experimental-zvkng -target-feature -experimental-zvknha -target-feature -experimental-zvknhb -target-feature -experimental-zvks -target-feature -experimental-zvksc -target-feature -experimental-zvksed -target-feature -experimental-zvksg -target-feature -experimental-zvksh -target-feature -experimental-zvkt -target-feature +relax -target-feature -save-restore -target-abi lp64d -msmall-data-limit 8 -debugger-tuning=gdb -v -fcoverage-compilation-dir=/home/hachi/Documents/Working/ruyi-test-workspace -resource-dir /home/hachi/.local/share/ruyi/binaries/x86_64/llvm-upstream-17.0.5-ruyi.20231121/lib/clang/17 -isysroot /home/hachi/Documents/Working/ruyi-test-workspace/llvm-venv-gnu-upstream/sysroot.riscv64-unknown-linux-gnu -internal-isystem /home/hachi/.local/share/ruyi/binaries/x86_64/llvm-upstream-17.0.5-ruyi.20231121/lib/clang/17/include -internal-isystem /home/hachi/Documents/Working/ruyi-test-workspace/llvm-venv-gnu-upstream/sysroot.riscv64-unknown-linux-gnu/usr/local/include -internal-isystem /home/hachi/.local/share/ruyi/binaries/x86_64/gnu-plct-0.20240324.0/lib/gcc/riscv64-plct-linux-gnu/13.1.0/../../../../riscv64-plct-linux-gnu/include -internal-externc-isystem /home/hachi/Documents/Working/ruyi-test-workspace/llvm-venv-gnu-upstream/sysroot.riscv64-unknown-linux-gnu/include -internal-externc-isystem /home/hachi/Documents/Working/ruyi-test-workspace/llvm-venv-gnu-upstream/sysroot.riscv64-unknown-linux-gnu/usr/include -O3 -fdebug-compilation-dir=/home/hachi/Documents/Working/ruyi-test-workspace -ferror-limit 19 -fno-signed-char -fgnuc-version=4.2.1 -vectorize-loops -vectorize-slp -faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o /tmp/hello_ruyi-fee72e.o -x c hello_ruyi.c
clang -cc1 version 17.0.5 based upon LLVM 17.0.5 default target x86_64-unknown-linux-gnu
ignoring nonexistent directory "/home/hachi/Documents/Working/ruyi-test-workspace/llvm-venv-gnu-upstream/sysroot.riscv64-unknown-linux-gnu/usr/local/include"
ignoring nonexistent directory "/home/hachi/Documents/Working/ruyi-test-workspace/llvm-venv-gnu-upstream/sysroot.riscv64-unknown-linux-gnu/include"
#include "..." search starts here:
#include <...> search starts here:
 /home/hachi/.local/share/ruyi/binaries/x86_64/llvm-upstream-17.0.5-ruyi.20231121/lib/clang/17/include
 /home/hachi/.local/share/ruyi/binaries/x86_64/gnu-plct-0.20240324.0/lib/gcc/riscv64-plct-linux-gnu/13.1.0/../../../../riscv64-plct-linux-gnu/include
 /home/hachi/Documents/Working/ruyi-test-workspace/llvm-venv-gnu-upstream/sysroot.riscv64-unknown-linux-gnu/usr/include
End of search list.
 "/home/hachi/Documents/Working/ruyi-test-workspace/llvm-venv-gnu-upstream/bin/riscv64-unknown-linux-gnu-ld" --sysroot=/home/hachi/Documents/Working/ruyi-test-workspace/llvm-venv-gnu-upstream/sysroot.riscv64-unknown-linux-gnu -pie --hash-style=gnu --eh-frame-hdr -m elf64lriscv -X -dynamic-linker /lib/ld-linux-riscv64-lp64d.so.1 -o hello_ruyi.o /home/hachi/Documents/Working/ruyi-test-workspace/llvm-venv-gnu-upstream/sysroot.riscv64-unknown-linux-gnu/usr/lib64/lp64d/Scrt1.o /home/hachi/.local/share/ruyi/binaries/x86_64/gnu-plct-0.20240324.0/lib/gcc/riscv64-plct-linux-gnu/13.1.0/lib64/lp64d/crti.o /home/hachi/.local/share/ruyi/binaries/x86_64/gnu-plct-0.20240324.0/lib/gcc/riscv64-plct-linux-gnu/13.1.0/lib64/lp64d/crtbeginS.o -L/home/hachi/.local/share/ruyi/binaries/x86_64/gnu-plct-0.20240324.0/lib/gcc/riscv64-plct-linux-gnu/13.1.0/lib64/lp64d -L/home/hachi/Documents/Working/ruyi-test-workspace/llvm-venv-gnu-upstream/sysroot.riscv64-unknown-linux-gnu/lib/../lib64 -L/home/hachi/Documents/Working/ruyi-test-workspace/llvm-venv-gnu-upstream/sysroot.riscv64-unknown-linux-gnu/usr/lib/../lib64 -L/home/hachi/Documents/Working/ruyi-test-workspace/llvm-venv-gnu-upstream/sysroot.riscv64-unknown-linux-gnu/lib64/lp64d -L/home/hachi/Documents/Working/ruyi-test-workspace/llvm-venv-gnu-upstream/sysroot.riscv64-unknown-linux-gnu/usr/lib64/lp64d -L/home/hachi/Documents/Working/ruyi-test-workspace/llvm-venv-gnu-upstream/sysroot.riscv64-unknown-linux-gnu/lib -L/home/hachi/Documents/Working/ruyi-test-workspace/llvm-venv-gnu-upstream/sysroot.riscv64-unknown-linux-gnu/usr/lib /tmp/hello_ruyi-fee72e.o -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed /home/hachi/.local/share/ruyi/binaries/x86_64/gnu-plct-0.20240324.0/lib/gcc/riscv64-plct-linux-gnu/13.1.0/lib64/lp64d/crtendS.o /home/hachi/.local/share/ruyi/binaries/x86_64/gnu-plct-0.20240324.0/lib/gcc/riscv64-plct-linux-gnu/13.1.0/lib64/lp64d/crtn.o
fatal error: no configured target found for command ld.lld
clang: error: linker command failed with exit code 1 (use -v to see invocation)

编译 venv 目录为 /home/hachi/Documents/Working/ruyi-test-workspace/llvm-venv-gnu-upstream, ld.lld 完整路径应当是 /home/hachi/Documents/Working/ruyi-test-workspace/llvm-venv-gnu-upstream/bin/ld.lld。