riscv-software-src / riscv-tools

RISC-V Tools (ISA Simulator and Tests)
1.13k stars 446 forks source link

ld returned 1 exit status ../isa/Makefile:74: rv32ui-v-simple] Error 1 #362

Open ardeal opened 1 year ago

ardeal commented 1 year ago

Hi,

I am working on ubuntu 20.04. I am not building riscv-tools and am experiencing the following issues.

Here are my steps about how to build it: I downloaded riscv-gnu-toolchain and riscv-tools from: 1) https://github.com/riscv-collab/riscv-gnu-toolchain/releases/download/2022.12.17/riscv64-elf-ubuntu-20.04-nightly-2022.12.17-nightly.tar.gz 2) https://github.com/RISCV-Tools/riscv-tools

then I tar the tool to /opt/riscv folder with the command: tar -xzvf riscv64-elf-ubuntu-20.04-nightly-2022.12.17-nightly.tar.gz -C /opt

In my bashrc file, I added: export RISCV="/opt/riscv" export PATH=$PATH:$RISCV/bin and run source ~/.bashrc

when I run ./build.sh in riscv-tools folder, I encountered the following issue: to my analysis, there are a few possible reason for this error: I may miss some dependency libs? I didn't add the path of the lib to LD_LIBRARY_PATH, but I couldn't find the lib in the folder.

I just noticed that riscv-tools/riscv-tests/isa/Makefile has correctly built some files, but failed to build some other files. Please check the following picture.

/opt/riscv/lib/gcc/riscv64-unknown-elf/12.2.0/../../../../riscv64-unknown-elf/bin/ld: warning: dhrystone.riscv has a LOAD segment with RWX permissions
/opt/riscv/lib/gcc/riscv64-unknown-elf/12.2.0/../../../../riscv64-unknown-elf/bin/ld: warning: spmv.riscv has a LOAD segment with RWX permissions
/opt/riscv/lib/gcc/riscv64-unknown-elf/12.2.0/../../../../riscv64-unknown-elf/bin/ld: warning: mt-vvadd.riscv has a LOAD segment with RWX permissions
/opt/riscv/lib/gcc/riscv64-unknown-elf/12.2.0/../../../../riscv64-unknown-elf/bin/ld: warning: mt-matmul.riscv has a LOAD segment with RWX permissions
/opt/riscv/lib/gcc/riscv64-unknown-elf/12.2.0/../../../../riscv64-unknown-elf/bin/ld: warning: pmp.riscv has a LOAD segment with RWX permissions
/opt/riscv/lib/gcc/riscv64-unknown-elf/12.2.0/../../../../riscv64-unknown-elf/bin/ld: /tmp/cc4YhrCz.o: in function `tohost':
(.tohost+0x0): multiple definition of `tohost'; /tmp/ccqVeXUB.o:(.sbss+0x10): first defined here
/opt/riscv/lib/gcc/riscv64-unknown-elf/12.2.0/../../../../riscv64-unknown-elf/bin/ld: /tmp/cc4YhrCz.o: in function `fromhost':
(.tohost+0x40): multiple definition of `fromhost'; /tmp/ccqVeXUB.o:(.sbss+0x8): first defined here
/opt/riscv/lib/gcc/riscv64-unknown-elf/12.2.0/../../../../riscv64-unknown-elf/bin/ld: warning: rv32ui-v-simple has a LOAD segment with RWX permissions
collect2: error: ld returned 1 exit status
make[1]: *** [/home/au/e203/riscv-tools/riscv-tests/build/../isa/Makefile:74: rv32ui-v-simple] Error 1
make: *** [Makefile:29: isa] Error 2

image

image

ardeal commented 1 year ago

I experienced the upper issues when I run build.sh in WSL ubuntu 20.04. I then installed a new and clean VMware ubuntu 20.04 (then installed all necessary packages/dependencies) , I still experienced the same issue.