chipsalliance / tools-cocotb-verilator-build

13 stars 3 forks source link

Verilator VPI compilation error encountered while running examples #3

Open riple opened 5 years ago

riple commented 5 years ago

I followed the README to install all the dependencies and tools on Ubuntu 1604 and succeeded. However, when running the Examples part, I encountered the following error:

g++ -I. -MMD -I/home/bibo/work/riscv/tools-cocotb-verilator-build/env/share/verilator/include -I/home/bibo/work/riscv/tools-cocotb-verilator-build/env/share/verilator/include/vltstd -DVL_PRINTF=printf -DVM_COVERAGE=0 -DVM_SC=0 -DVM_TRACE=0 -Wno-sign-compare -Wno-uninitialized -Wno-unused-but-set-variable -Wno-unused-parameter -Wno-unused-variable -Wno-shadow -c -o verilator.o ../sim_build/verilator.cpp g++ -I. -MMD -I/home/bibo/work/riscv/tools-cocotb-verilator-build/env/share/verilator/include -I/home/bibo/work/riscv/tools-cocotb-verilator-build/env/share/verilator/include/vltstd -DVL_PRINTF=printf -DVM_COVERAGE=0 -DVM_SC=0 -DVM_TRACE=0 -Wno-sign-compare -Wno-uninitialized -Wno-unused-but-set-variable -Wno-unused-parameter -Wno-unused-variable -Wno-shadow -c -o verilated_vpi.o /home/bibo/work/riscv/tools-cocotb-verilator-build/env/share/verilator/include/verilated_vpi.cpp /home/bibo/work/riscv/tools-cocotb-verilator-build/env/share/verilator/include/verilated_vpi.cpp: In function ‘std::__cxx11::string topModuleName()’: /home/bibo/work/riscv/tools-cocotb-verilator-build/env/share/verilator/include/verilated_vpi.cpp:1040:17: error: ISO C++ forbids declaration of ‘map’ with no type [-fpermissive] const auto map = Verilated::scopeNameMap(); // obtain scopes map ^ /home/bibo/work/riscv/tools-cocotb-verilator-build/env/share/verilator/include/verilated_vpi.cpp:1040:47: error: cannot convert ‘const VerilatedScopeNameMap’ to ‘const int’ in initialization const auto map = Verilated::scopeNameMap(); // obtain scopes map ^ /home/bibo/work/riscv/tools-cocotb-verilator-build/env/share/verilator/include/verilated_vpi.cpp:1041:10: error: ‘itr’ does not name a type auto itr = map->begin(); ++itr; // jump to second element (1st prefix.TOP, 2nd prefix.dut) ^ /home/bibo/work/riscv/tools-cocotb-verilator-build/env/share/verilator/include/verilated_vpi.cpp:1041:32: error: ‘itr’ was not declared in this scope auto itr = map->begin(); ++itr; // jump to second element (1st prefix.TOP, 2nd prefix.dut) ^ /home/bibo/work/riscv/tools-cocotb-verilator-build/env/share/verilator/include/verilated_vpi.cpp: In function ‘std::__cxx11::string topModulePrefix()’: /home/bibo/work/riscv/tools-cocotb-verilator-build/env/share/verilator/include/verilated_vpi.cpp:1050:17: error: ISO C++ forbids declaration of ‘map’ with no type [-fpermissive] const auto map = Verilated::scopeNameMap(); // obtain scopes map ^ /home/bibo/work/riscv/tools-cocotb-verilator-build/env/share/verilator/include/verilated_vpi.cpp:1050:47: error: cannot convert ‘const VerilatedScopeNameMap’ to ‘const int’ in initialization const auto map = Verilated::scopeNameMap(); // obtain scopes map ^ /home/bibo/work/riscv/tools-cocotb-verilator-build/env/share/verilator/include/verilated_vpi.cpp:1051:10: error: ‘itr’ does not name a type auto itr = map->begin(); // 1st element is good enough (e.g. prefix.TOP) ^ /home/bibo/work/riscv/tools-cocotb-verilator-build/env/share/verilator/include/verilated_vpi.cpp:1052:38: error: ‘itr’ was not declared in this scope std::string name = std::string((*itr).first); // get its name (e.g. prefix.TOP) ^ /home/bibo/work/riscv/tools-cocotb-verilator-build/env/share/verilator/include/verilated_vpi.cpp:1054:10: error: ‘prefix’ does not name a type auto prefix = name.substr(0, dot); ^ /home/bibo/work/riscv/tools-cocotb-verilator-build/env/share/verilator/include/verilated_vpi.cpp:1055:12: error: ‘prefix’ was not declared in this scope return prefix; ^ /home/bibo/work/riscv/tools-cocotb-verilator-build/env/share/verilator/include/verilated.mk:178: recipe for target 'verilated_vpi.o' failed make[3]: [verilated_vpi.o] Error 1 make[3]: Leaving directory '/home/bibo/work/riscv/tools-cocotb-verilator-build/cocotb/examples/adder/tests/sim_build' /home/bibo/work/riscv/tools-cocotb-verilator-build/cocotb/cocotb/share/makefiles/simulators/Makefile.verilator:83: recipe for target 'sim_build/Vadder' failed make[2]: [sim_build/Vadder] Error 2 make[2]: Leaving directory '/home/bibo/work/riscv/tools-cocotb-verilator-build/cocotb/examples/adder/tests' /home/bibo/work/riscv/tools-cocotb-verilator-build/cocotb/cocotb/share/makefiles/Makefile.sim:84: recipe for target 'sim' failed make[1]: [sim] Error 2 make[1]: Leaving directory '/home/bibo/work/riscv/tools-cocotb-verilator-build/cocotb/examples/adder/tests' Makefile:71: recipe for target 'cocotb/adder/run' failed make: [cocotb/adder/run] Error 2

riple commented 5 years ago

I tried with the original source, and the example runs successfully.

https://github.com/antmicro/cocotb-verilator-build

cocotb @ 900d3d1    bump submodules     20 days ago
img     add missing image   29 days ago
verilator @ 7c47f66     bump submodules     20 days ago
.gitignore  Add submodules and Makefile     last month
.gitmodules     Add submodules and Makefile     last month
Makefile    makefile: Add target for Verilator tests    20 days ago
README.md   Added gtkwave to install dependencies   28 days ago
ZvonimirBandic commented 5 years ago

Karol - can you look into how this happened? thanks!

kgugala commented 5 years ago

@riple can you provide you GCC version?

riple commented 5 years ago

On my Mac:

Configured with: --prefix=/Library/Developer/CommandLineTools/usr --with-gxx-include-dir=/usr/include/c++/4.2.1 Apple LLVM version 10.0.0 (clang-1000.10.44.4) Target: x86_64-apple-darwin17.7.0 Thread model: posix InstalledDir: /Library/Developer/CommandLineTools/usr/bin