Install rocket-chip on Ubuntu

124 views Asked by At

I've been trying to build and run rocket-chip on Ubuntu for days and failed to understand what I'm doing wrong.

Following all the README files recursively (starting from rocket-chip v1.6 all the way back to basic apt install build-essential), I ended up with the script rocket-chip.jammy.sh for Ubuntu 22.04 (Jammy).

After running the script, in the make command under ~/rocket-chip/simulator, I get the following error:

<logs-trimmed-up-to-here>
.
touch verilator/src/verilator-4.028/bin/verilator
make -C verilator/src/verilator-4.028 installbin installdata
make[1]: Entering directory '/home/ubuntu/rocket-chip/emulator/verilator/src/verilator-4.028'
/bin/sh ./src/mkinstalldirs /home/ubuntu/rocket-chip/emulator/verilator/install/bin
mkdir /home/ubuntu/rocket-chip/emulator/verilator/install
mkdir /home/ubuntu/rocket-chip/emulator/verilator/install/bin
( cd ./bin ; /usr/bin/install -c verilator /home/ubuntu/rocket-chip/emulator/verilator/install/bin/verilator )
( cd ./bin ; /usr/bin/install -c verilator_coverage /home/ubuntu/rocket-chip/emulator/verilator/install/bin/verilator_coverage )
( cd ./bin ; /usr/bin/install -c verilator_gantt /home/ubuntu/rocket-chip/emulator/verilator/install/bin/verilator_gantt )
( cd ./bin ; /usr/bin/install -c verilator_profcfunc /home/ubuntu/rocket-chip/emulator/verilator/install/bin/verilator_profcfunc )
( cd bin ; /usr/bin/install -c verilator_bin /home/ubuntu/rocket-chip/emulator/verilator/install/bin/verilator_bin )
( cd bin ; /usr/bin/install -c verilator_bin_dbg /home/ubuntu/rocket-chip/emulator/verilator/install/bin/verilator_bin_dbg )
( cd bin ; /usr/bin/install -c verilator_coverage_bin_dbg /home/ubuntu/rocket-chip/emulator/verilator/install/bin/verilator_coverage_bin_dbg )
/bin/sh ./src/mkinstalldirs /home/ubuntu/rocket-chip/emulator/verilator/install/share/verilator/bin
mkdir /home/ubuntu/rocket-chip/emulator/verilator/install/share
mkdir /home/ubuntu/rocket-chip/emulator/verilator/install/share/verilator
mkdir /home/ubuntu/rocket-chip/emulator/verilator/install/share/verilator/bin
( cd ./bin ; /usr/bin/install -c verilator_includer /home/ubuntu/rocket-chip/emulator/verilator/install/share/verilator/bin/verilator_includer )
/bin/sh ./src/mkinstalldirs /home/ubuntu/rocket-chip/emulator/verilator/install/share/verilator/include/gtkwave
mkdir /home/ubuntu/rocket-chip/emulator/verilator/install/share/verilator/include
mkdir /home/ubuntu/rocket-chip/emulator/verilator/install/share/verilator/include/gtkwave
/bin/sh ./src/mkinstalldirs /home/ubuntu/rocket-chip/emulator/verilator/install/share/verilator/include/vltstd
mkdir /home/ubuntu/rocket-chip/emulator/verilator/install/share/verilator/include/vltstd
for p in include/verilated_config.h include/verilated.mk  ; do \
  /usr/bin/install -c -m 644 $p /home/ubuntu/rocket-chip/emulator/verilator/install/share/verilator/$p; \
done
cd . \
; for p in include/*.[chv]* include/gtkwave/*.[chv]* include/vltstd/*.[chv]*  ; do \
  /usr/bin/install -c -m 644 $p /home/ubuntu/rocket-chip/emulator/verilator/install/share/verilator/$p; \
done
/bin/sh ./src/mkinstalldirs /home/ubuntu/rocket-chip/emulator/verilator/install/share/verilator/examples/make_hello_c
mkdir /home/ubuntu/rocket-chip/emulator/verilator/install/share/verilator/examples
mkdir /home/ubuntu/rocket-chip/emulator/verilator/install/share/verilator/examples/make_hello_c
/bin/sh ./src/mkinstalldirs /home/ubuntu/rocket-chip/emulator/verilator/install/share/verilator/examples/make_hello_sc
mkdir /home/ubuntu/rocket-chip/emulator/verilator/install/share/verilator/examples/make_hello_sc
/bin/sh ./src/mkinstalldirs /home/ubuntu/rocket-chip/emulator/verilator/install/share/verilator/examples/make_tracing_c
mkdir /home/ubuntu/rocket-chip/emulator/verilator/install/share/verilator/examples/make_tracing_c
/bin/sh ./src/mkinstalldirs /home/ubuntu/rocket-chip/emulator/verilator/install/share/verilator/examples/make_tracing_sc
mkdir /home/ubuntu/rocket-chip/emulator/verilator/install/share/verilator/examples/make_tracing_sc
/bin/sh ./src/mkinstalldirs /home/ubuntu/rocket-chip/emulator/verilator/install/share/verilator/examples/make_protect_lib
mkdir /home/ubuntu/rocket-chip/emulator/verilator/install/share/verilator/examples/make_protect_lib
/bin/sh ./src/mkinstalldirs /home/ubuntu/rocket-chip/emulator/verilator/install/share/verilator/examples/cmake_hello_c
mkdir /home/ubuntu/rocket-chip/emulator/verilator/install/share/verilator/examples/cmake_hello_c
/bin/sh ./src/mkinstalldirs /home/ubuntu/rocket-chip/emulator/verilator/install/share/verilator/examples/cmake_hello_sc
mkdir /home/ubuntu/rocket-chip/emulator/verilator/install/share/verilator/examples/cmake_hello_sc
/bin/sh ./src/mkinstalldirs /home/ubuntu/rocket-chip/emulator/verilator/install/share/verilator/examples/cmake_tracing_c
mkdir /home/ubuntu/rocket-chip/emulator/verilator/install/share/verilator/examples/cmake_tracing_c
/bin/sh ./src/mkinstalldirs /home/ubuntu/rocket-chip/emulator/verilator/install/share/verilator/examples/cmake_tracing_sc
mkdir /home/ubuntu/rocket-chip/emulator/verilator/install/share/verilator/examples/cmake_tracing_sc
/bin/sh ./src/mkinstalldirs /home/ubuntu/rocket-chip/emulator/verilator/install/share/verilator/examples/cmake_protect_lib
mkdir /home/ubuntu/rocket-chip/emulator/verilator/install/share/verilator/examples/cmake_protect_lib
cd . \
; for p in examples/*/*.[chv]*  examples/*/Makefile* examples/*/CMakeLists.txt ; do \
  /usr/bin/install -c -m 644 $p /home/ubuntu/rocket-chip/emulator/verilator/install/share/verilator/$p; \
done
/usr/bin/install: cannot create regular file '/home/ubuntu/rocket-chip/emulator/verilator/install/share/verilator/examples/xml_py/sub.v': No such file or directory
/usr/bin/install: cannot create regular file '/home/ubuntu/rocket-chip/emulator/verilator/install/share/verilator/examples/xml_py/top.v': No such file or directory
/usr/bin/install: cannot create regular file '/home/ubuntu/rocket-chip/emulator/verilator/install/share/verilator/examples/xml_py/Makefile': No such file or directory
/bin/sh ./src/mkinstalldirs /home/ubuntu/rocket-chip/emulator/verilator/install/share/pkgconfig
mkdir /home/ubuntu/rocket-chip/emulator/verilator/install/share/pkgconfig
/usr/bin/install -c -m 644 verilator.pc /home/ubuntu/rocket-chip/emulator/verilator/install/share/pkgconfig
/usr/bin/install -c -m 644 verilator-config.cmake /home/ubuntu/rocket-chip/emulator/verilator/install/share/verilator
/usr/bin/install -c -m 644 verilator-config-version.cmake /home/ubuntu/rocket-chip/emulator/verilator/install/share/verilator
make[1]: Leaving directory '/home/ubuntu/rocket-chip/emulator/verilator/src/verilator-4.028'
touch /home/ubuntu/rocket-chip/emulator/verilator/install/bin/verilator
cd /home/ubuntu/rocket-chip/emulator/generated-src && \
/home/ubuntu/rocket-chip/scripts/vlsi_mem_gen /home/ubuntu/rocket-chip/emulator/generated-src/freechips.rocketchip.system.DefaultConfig.conf > /home/ubuntu/rocket-chip/emulator/generated-src/freechips.rocketchip.system.DefaultConfig.behav_srams.v.tmp && \
mv -f /home/ubuntu/rocket-chip/emulator/generated-src/freechips.rocketchip.system.DefaultConfig.behav_srams.v.tmp /home/ubuntu/rocket-chip/emulator/generated-src/freechips.rocketchip.system.DefaultConfig.behav_srams.v
mkdir -p /home/ubuntu/rocket-chip/emulator/generated-src/freechips.rocketchip.system.DefaultConfig
/home/ubuntu/rocket-chip/emulator/verilator/install/bin/verilator --cc --exe --top-module TestHarness +define+PRINTF_COND=\$c\(\"verbose\",\"\&\&\"\,\"done_reset\"\) +define+RANDOMIZE_GARBAGE_ASSIGN +define+STOP_COND=\$c\(\"done_reset\"\) --assert --output-split 20000 --output-split-cfuncs 20000 --threads 2 -Wno-UNOPTTHREADS -Wno-STMTDLY --x-assign unique -I/home/ubuntu/rocket-chip/src/main/resources/vsrc -O3 -CFLAGS "-O1 -std=c++11 -I/home/ubuntu/riscv/include -DVERILATOR -DTEST_HARNESS=VTestHarness -include /home/ubuntu/rocket-chip/src/main/resources/csrc/verilator.h -include /home/ubuntu/rocket-chip/emulator/generated-src/freechips.rocketchip.system.DefaultConfig.plusArgs" --max-num-width 1048576 -Mdir /home/ubuntu/rocket-chip/emulator/generated-src/freechips.rocketchip.system.DefaultConfig \
-o /home/ubuntu/rocket-chip/emulator/emulator-freechips.rocketchip.system-freechips.rocketchip.system.DefaultConfig /home/ubuntu/rocket-chip/emulator/generated-src/freechips.rocketchip.system.DefaultConfig.v /home/ubuntu/rocket-chip/emulator/generated-src/freechips.rocketchip.system.DefaultConfig.behav_srams.v  /home/ubuntu/rocket-chip/src/main/resources/csrc/emulator.cc /home/ubuntu/rocket-chip/src/main/resources/csrc/SimDTM.cc /home/ubuntu/rocket-chip/src/main/resources/csrc/SimJTAG.cc /home/ubuntu/rocket-chip/src/main/resources/csrc/remote_bitbang.cc -LDFLAGS " -L/home/ubuntu/riscv/lib -Wl,-rpath,/home/ubuntu/riscv/lib -L/home/ubuntu/rocket-chip/emulator -lfesvr -lpthread" \
-CFLAGS "-I/home/ubuntu/rocket-chip/emulator/generated-src -include /home/ubuntu/rocket-chip/emulator/generated-src/freechips.rocketchip.system.DefaultConfig/VTestHarness.h"
make VM_PARALLEL_BUILDS=1 -C /home/ubuntu/rocket-chip/emulator/generated-src/freechips.rocketchip.system.DefaultConfig -f VTestHarness.mk
make[1]: Entering directory '/home/ubuntu/rocket-chip/emulator/generated-src/freechips.rocketchip.system.DefaultConfig'
g++  -I.  -MMD -I/home/ubuntu/rocket-chip/emulator/verilator/install/share/verilator/include -I/home/ubuntu/rocket-chip/emulator/verilator/install/share/verilator/include/vltstd -DVM_COVERAGE=0 -DVM_SC=0 -DVM_TRACE=0 -faligned-new -fcf-protection=none -Wno-bool-operation -Wno-sign-compare -Wno-uninitialized -Wno-unused-but-set-variable -Wno-unused-parameter -Wno-unused-variable -Wno-shadow     -O1 -std=c++11 -I/home/ubuntu/riscv/include -DVERILATOR -DTEST_HARNESS=VTestHarness -include /home/ubuntu/rocket-chip/src/main/resources/csrc/verilator.h -include /home/ubuntu/rocket-chip/emulator/generated-src/freechips.rocketchip.system.DefaultConfig.plusArgs -I/home/ubuntu/rocket-chip/emulator/generated-src -include /home/ubuntu/rocket-chip/emulator/generated-src/freechips.rocketchip.system.DefaultConfig/VTestHarness.h  -DVL_THREADED -std=gnu++14  -c -o SimDTM.o /home/ubuntu/rocket-chip/src/main/resources/csrc/SimDTM.cc
In file included from /home/ubuntu/riscv/include/fesvr/memif.h:10,
                 from /home/ubuntu/riscv/include/fesvr/htif.h:6,
                 from /home/ubuntu/riscv/include/fesvr/dtm.h:4,
                 from /home/ubuntu/rocket-chip/src/main/resources/csrc/SimDTM.cc:3:
/home/ubuntu/riscv/include/fesvr/../riscv/cfg.h:99:8: error: ‘optional’ in namespace ‘std’ does not name a template type
   99 |   std::optional<reg_t>               start_pc;
      |        ^~~~~~~~
/home/ubuntu/riscv/include/fesvr/../riscv/cfg.h:99:3: note: ‘std::optional’ is only available from C++17 onwards
   99 |   std::optional<reg_t>               start_pc;
      |   ^~~
make[1]: *** [VTestHarness.mk:65: SimDTM.o] Error 1
make[1]: Leaving directory '/home/ubuntu/rocket-chip/emulator/generated-src/freechips.rocketchip.system.DefaultConfig'
make: *** [Makefrag-verilator:88: emulator-freechips.rocketchip.system-freechips.rocketchip.system.DefaultConfig] Error 2

I initially thought that it's because Ubuntu 22.04 ships with gcc-11 and g++-11. So, I tweaked my script to make it run for Ubuntu 23.10 (Mantic), the full script at rocket-chip.mantic.sh.

Worth noting that I had to build rocket-tools with gcc-11 and g++-11 as with the already installed 13 I had another issue.

CC=gcc-11 CXX=g++-11 ./build.sh

I still get the same error, so very likely it's the rocket-tools that was built by/for ‍♂️ gcc-11 and g++-11 and, therefore not compatible with rocket-chip.

Anyone spots any missing packages? What am I doing wrong?

0

There are 0 answers