Compile verilator to webassembly
it's not possible to compile Verilator easily to webassembly with emscripten compiler due to some codegen used in the project. During compilation following errors happens:
/usr/bin/flex -d -oV3Lexer_pregen.yy.cpp ../verilog.l /usr/bin/perl ../flexfix V3Lexer <V3Lexer_pregen.yy.cpp >V3Lexer.yy.cpp /home/mplebanski/emsdk/emscripten/1.38.24/em++ -I/usr/local/include -MMD -I. -I.. -I.. -I../../include -I../../include -DYYDEBUG -DVL_DEBUG -D_GLIBCXX_DEBUG -MP -Qunused-arguments -faligned-new -Wno-unused-parameter -Wno-undefined-bool-conversion -Wno-shadow -DDEFENV_SYSTEMC=\"\" -DDEFENV_SYSTEMC_ARCH=\"\" -DDEFENV_SYSTEMC_INCLUDE=\"\" -DDEFENV_SYSTEMC_LIBDIR=\"\" -DDEFENV_VERILATOR_ROOT=\"/usr/local/share/verilator\" -Wno-char-subscripts -Wno-null-conversion -Wno-parentheses-equality -Wno-unused -c ../V3ParseLex.cpp In file included from ../V3ParseLex.cpp:36: V3Lexer_pregen.yy.cpp:369:10: fatal error: 'FlexLexer.h' file not found #include <FlexLexer.h> ^~~~~~~~~~~~~ 1 error generated. shared:ERROR: compiler frontend failed to generate LLVM bitcode, halting ../Makefile_obj:288: recipe for target 'V3ParseLex.o' failed make: *** [V3ParseLex.o] Error 1 make: Leaving directory '/home/mplebanski/verilator/src/obj_dbg' Makefile:69: recipe for target '../bin/verilator_bin_dbg' failed make: *** [../bin/verilator_bin_dbg] Error 2 make: Leaving directory '/home/mplebanski/verilator/src' Makefile:190: recipe for target 'verilator_exe' failed make: *** [verilator_exe] Error 2
We would like to use Verilator in V8 engine as an example use case for golem.network (shared computing power). Any help appreciated.
#1 Updated by Wilson Snyder 7 months ago
- Status changed from New to NoFixNeeded
Looks like you don't have "flex" installed, that file comes with flex.
If you're trying to get a new compiler going chances are you will need to debug and fix a bunch of issues, if you end up needing any patches please submit them back.
#2 Updated by Tyrel Newton 6 months ago
sudo apt-get install git make autoconf g++ flex bisonBut you also need to
apt-get install libfl-dev(https://packages.ubuntu.com/bionic/amd64/libfl-dev/filelist). This is not stated in the README.pod file either.
#3 Updated by Wilson Snyder 6 months ago
But you also need to apt-get install libfl-dev (https://packages.ubuntu.com/bionic/amd64/libfl-dev/filelist).
Ubuntu is non-standard in this regard it seems.
Flex on Ubuntu has a recommends package dependency for this. When you installed flex apt should have prompted to also install this (or you have some flag not to, which caused the problem).
Anyhow, I'll update the docs.
Also available in: Atom