Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compile verilator to webassembly #1402

Closed
veripoolbot opened this issue Feb 20, 2019 · 3 comments
Closed

Compile verilator to webassembly #1402

veripoolbot opened this issue Feb 20, 2019 · 3 comments

Comments

@veripoolbot
Copy link

@veripoolbot veripoolbot commented Feb 20, 2019


Author Name: Michal Plebanski
Original Redmine Issue: 1402 from https://www.veripool.org


Hi,

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[2]: *** [V3ParseLex.o] Error 1
make[2]: Leaving directory '/home/mplebanski/verilator/src/obj_dbg'
Makefile:69: recipe for target '../bin/verilator_bin_dbg' failed
make[1]: *** [../bin/verilator_bin_dbg] Error 2
make[1]: Leaving directory '/home/mplebanski/verilator/src'
Makefile:190: recipe for target 'verilator_exe' failed
make: *** [verilator_exe] Error 2
</code>

We would like to use Verilator in V8 engine as an example use case for golem.network (shared computing power). Any help appreciated.

@veripoolbot

This comment has been minimized.

Copy link
Author

@veripoolbot veripoolbot commented Feb 26, 2019


Original Redmine Comment
Author Name: Wilson Snyder (@wsnyder)
Original Date: 2019-02-26T16:24:59Z


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.

@veripoolbot

This comment has been minimized.

Copy link
Author

@veripoolbot veripoolbot commented Mar 21, 2019


Original Redmine Comment
Author Name: Tyrel Newton
Original Date: 2019-03-21T07:13:54Z


Under Ubuntu 18.04LTS (bionic), the likely issue is that [[Installing]] implies the dependencies are:

sudo apt-get install git make autoconf g++ flex bison

But 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.

@veripoolbot

This comment has been minimized.

Copy link
Author

@veripoolbot veripoolbot commented Mar 21, 2019


Original Redmine Comment
Author Name: Wilson Snyder (@wsnyder)
Original Date: 2019-03-21T11:20:32Z


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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
1 participant
You can’t perform that action at this time.