Forums » Installation »
Installation of Verilator on MacOS 10.4
Added by Robert Guenzel almost 3 years ago
Hi interested reader,
I just recently installed verilator 3.712 on MacOS 10.4 (gcc 4.0). It was kind of tricky, and there was hardly any information available on the web how to resolve the problems I stumbled upon.
Maybe the problems I encountered are just due to my own stupidity, but still I decided to post my experience here to help other MacOS 10.4 users to install verilator.
First you have to install a more recent bison version than what is part of MacOS. Using the most recent bison release 2.4 failed, because there was a problem with an unexpected behavior of some "m4 push" or something like that. Maybe bison depends on other libs which I did not have the correct version of. (I apologize for being imprecise here, but I tried so many things, I cannot remember the correct error message...) Using bison 1.875 (the minimum required version) failed, because of a bug in bison 1.875 (the one with the "__attribute__((unsused))" error). Finally, after trying some other versions, I found out that bison 2.0 works well.
Then I tried to install Verilog-Perl 3.212. To get this to work, you have to patch the Makefiles in the "Parser" and "Preproc" directories, after having called "perl Makefile.PL". There you have to change the DLEXT variable from DLEXT = bundle to DLEXT = dylib and you have to change the LDDLFLAGS to LDDLFLAGS = -dynamiclib -lstdc++ -L/System/Library/Perl/5.8.6/darwin-thread-multi-2level/CORE -lperl -lgcc_eh -L/usr/local/lib
(Note that your path to libperl.dylib might be different. Double check on that to be on the safe side)
Then it was time to install SystemPerl 1.330. After calling "perl Makefile.PL" you need to patch Parser/scgrammer.c. You gotta remove (comment out) line 1443. This line is a duplicate of the line 160 of Parser/scgrammer.h (obfuscated by some Macros, but it is), but without the required 'extern' keyword (line 160 has it). That leads to multiple defined symbols when linking. When you comment line 1443 out, this problem is solved.
Then you have to patch line 860 in Parser/sclex.c There is the declaration of a function 'input' that is then defined at line 1951. However in line 1951 it is defined static while in line 860 it is not declared that way. Adding the 'static' keyword in front of line 860 fixes that compile problem.
Afterwards you need to patch Parser/Makefile in the same way as described for Verilog-Perl above.
Then installing verilator 3.712 worked without any problems.
Note that I did "make test" for all the things mentioned above and they all went through without complaints.
Finally, I verilated some of my verilog projects sucessfully, so I just claim my patches did not mess verilator up... ;-)
I hope someone will find this post helpful.
If I find time (and the money for MacOS 10.5) I will try the same installation on MacOS 10.5.
If you have any problems with installing the stuff on MacOS, I can offer some help, if you send me the errors via mail.
best regards Robert
Replies (4)
RE: Installation of Verilator on MacOS 10.4 - Added by Wilson Snyder almost 3 years ago
Nicely done, thanks for documenting for others!
Sorry flex is so unstable. If you have time and want to experiment, you could try editing the Makefile.PL and "flexfix" programs to make these edits automatically, the patches could then be put into the releases.
RE: Installation of Verilator on MacOS 10.4 - Added by Robert Guenzel almost 3 years ago
I must confess that I'm neither a Perl nor a flex export. In a braggy mood I would call myself a C/C++ expert, hence I was able to fix the problems after Perl and flex had done their jobs. But I am afraid I will be unable to provide fixes for the Perl and flex parts.
Having said that, looking into the flexfix sources it looks pretty much sed-ish, maybe I can add something there without knowing too much about Perl. I would appreciate it if you could point me to a MakeMaker documentation, because I believe this is where I would have to hook in, if I want the Makefiles to work without manual modifications.
best regards
Robert
RE: Installation of Verilator on MacOS 10.4 - Added by Wilson Snyder almost 3 years ago
For the Makefile.PL docs use man ExtUtils::MakeMaker
I suspect that's a bit of a firehose compared to what you need. See what my Makefile.PL does with archname =~ cygwin as an example and you'll probably be half way there.
RE: Installation of Verilator on MacOS 10.4 - Added by Robert Guenzel almost 3 years ago
Hi,
CORRECTION:
Instead of
Robert Guenzel wrote:
Then you have to patch line 860 in Parser/sclex_prefix.c
you need to patch
Parser/sclex.c
best regards Robert
[Editor: Fixed this in the original message.]
(1-4/4)
![[logo]](/img/veripool_small.png)