mathis-s / SoomRV

A simple superscalar out-of-order RISC-V microprocessor
MIT License
175 stars 9 forks source link

Issue while calling make #45

Open lovisXII opened 4 days ago

lovisXII commented 4 days ago

Hello, it seems i have many errors while trying to run the project because of gcc and verilator version. First of all you are missing that flag in the makefile : -std=c++17 It will remove errors for std::optionnal.

Also it seems it requires a recent version of g++, could you tell me which one you are using ? I also have that kind of error i didnt managed to fix : /usr/bin/ld: extensions.cc:(.text+0x266): undefined reference to `dlopen'

mathis-s commented 4 days ago

Hi, thanks for the issue! Easiest solution here will be using the docker image. Different distros have different Verilator and compiler versions/configs which is why you run into these sort of problems. The docker image sidesteps these issues.

If you still want to run locally: To fix the dlopen error, you need to make sure your linking to libdl. That should be handled with -LDFLAGS "-ldl" in the Makefile already, but something seems to prevent that from working.

lovisXII commented 4 days ago

Yes indeed that may be an issue. Yes it should be properly linked since your makefile already contains the ld flags. I suspect a conflict version between my gcc and my linker. I'm running on wsl and by default it uses gcc9 and verilator4, I have compiled verilator 5 and I have changed gcc to v13 but it doesnt seem to solve the issue

I found that -ldl option matter : https://stackoverflow.com/questions/956640/linux-c-error-undefined-reference-to-dlopen And indeed when i call : make trace the last command is : g++ Simif.o Top_tb.o verilated.o verilated_dpi.o verilated_save.o verilated_fst_c.o verilated_threads.o VTop__ALL.a -ldl -lz ../riscv-isa-sim/libriscv.a ../riscv-isa-sim/libsoftfloat.a ../riscv-isa-sim/libdisasm.a -pthread -lpthread -latomic -o VTop Which fail, but if i manually run this it works : g++ Simif.o Top_tb.o verilated.o verilated_dpi.o verilated_save.o verilated_fst_c.o verilated_threads.o VTop__ALL.a -lz ../riscv-isa-sim/libriscv.a ../riscv-isa-sim/libsoftfloat.a ../riscv-isa-sim/libdisasm.a -pthread -lpthread -latomic -o VTop -ldl

lovisXII commented 4 days ago

See :

g++    Simif.o Top_tb.o verilated.o verilated_dpi.o verilated_save.o verilated_threads.o VTop__ALL.a   -ldl ../riscv-isa-sim/libriscv.a ../riscv-isa-sim/libsoftfloat.a ../riscv-isa-sim/libdisasm.a  -pthread -lpthread -latomic   -o VTop
/usr/bin/ld: ../riscv-isa-sim/libriscv.a(extensions.o): in function `find_extension(char const*)':
extensions.cc:(.text+0x250): undefined reference to `dlopen'
/usr/bin/ld: extensions.cc:(.text+0x266): undefined reference to `dlopen'
collect2: error: ld returned 1 exit status

And :

g++    Simif.o Top_tb.o verilated.o verilated_dpi.o verilated_save.o verilated_threads.o VTop__ALL.a ../riscv-isa-sim/libriscv.a ../riscv-isa-sim/libsoftfloat.a ../riscv-isa-sim/libdisasm.a  -pthread -lpthread -latomic   -o VTop -ldl