Build failure due to config.h absence
Closed this issue · 1 comments
jserv commented
With commit 3b899ba, I can move forward. I realized that riscv-isa-sim depends on some features of C++-17 and applied the following change:
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,7 @@
VERILATOR_FLAGS = \
--cc --build --threads 2 --unroll-stmts 999999 -unroll-count 999999 --assert -Wall -Wno-BLKSEQ -Wno-UNUSED \
-Wno-PINCONNECTEMPTY -Wno-DECLFILENAME --x-assign unique --x-initial unique -O3 -sv \
- -CFLAGS "-march=native" \
+ -CFLAGS "-march=native -std=c++17" \
-MAKEFLAGS -j16
VERILATOR_CFG = --exe Top_tb.cpp ../riscv-isa-sim/libriscv.a ../riscv-isa-sim/libsoftfloat.a ../riscv-isa-sim/libdisasm.a -CFLAGS -g -CFLAGS -I../riscv-isa-sim --top-module Top -Ihardfloat
However, I then encountered the following error:
ccache clang++-15 -I. -MMD -I/home/jserv/share/verilator/include -I/home/jserv/share/verilator/include/vltstd -DVM_COVERAGE=0 -DVM_SC=0 -DVM_TRACE=0 -DVM_TRACE_FST=0 -DVM_TRACE_VCD=0 -faligned-new -fbracket-depth=4096 -fcf-protection=none -Qunused-arguments -Wno-bool-operation -Wno-tautological-bitwise-compare -Wno-parentheses-equality -Wno-sign-compare -Wno-uninitialized -Wno-unused-but-set-variable -Wno-unused-parameter -Wno-unused-variable -Wno-shadow -march=native -std=c++17 -g -I../riscv-isa-sim -c -o VTop_IF_Mem__Slow.o VTop_IF_Mem__Slow.cpp
In file included from ../Top_tb.cpp:35:
In file included from ../riscv-isa-sim/riscv/mmu.h:10:
In file included from ../riscv-isa-sim/riscv/processor.h:18:
In file included from ../riscv-isa-sim/riscv/../fesvr/memif.h:9:
../riscv-isa-sim/riscv/../fesvr/byteorder.h:6:10: fatal error: 'config.h' file not found
#include "config.h"
^~~~~~~~~~
1 error generated.
make[1]: *** [VTop.mk:67: Top_tb.o] Error 1
It seems that riscv-isa-sim has not been configured properly.
mathis-s commented
Thanks again! The submodule requires manual building, I've added this to the build instructions.
The C++ standard situation is more difficult -- the -std
flag is reset back to -std=gnu++14
by old versions of Verilator, causing a version mismatch between Spike and Verilator, see here.
The easiest fix for this is using Verilator >5.0, which defaults to c++17. See the GitHub Workflow (though untested as of now).