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

Incorrect paths when compiling from Git #1318

Closed
veripoolbot opened this issue Jun 8, 2018 · 3 comments
Closed

Incorrect paths when compiling from Git #1318

veripoolbot opened this issue Jun 8, 2018 · 3 comments
Labels
area: documentation Issue involves documentation resolution: fixed Closed; fixed

Comments

@veripoolbot
Copy link
Contributor


Author Name: Samuel Falvo (@sfalvo)
Original Redmine Issue: 1318 from https://www.veripool.org


I compiled by distribution of Verilator from git sources, per the instructions published on the website. It compiled version 3.922.

However, when I tried to execute the instructions in the tutorial for Verilog, modified for where I've placed my C++ and Verilog files accordingly, I get the following results:

$ cd obj_dir
$ make -j -f Vdmac.mk Vdmac
Vdmac.mk:53: /usr/local/bin/include/verilated.mk: No such file or directory

After some research in the issues, I found this issue which summarizes similar behavior I'm seeing: https://www.veripool.org/issues/1220-Verilator-Example-Makefile-seems-to-have-incorrect-paths . The resolution of this issue indicates it's fixed in 3.914.

I tried rebuilding version 3.914 by these steps:

1. cd $CLONE_DIR
1. make clean
1. unset VERILATOR_ROOT
1. git checkout v3.914
1. autoconf
1. ./configure
1. make
1. make install

However, the problem persists; this suggests I have either completely missed something obvious in the installation instructions, OR, the instructions are not truly general across all operating systems.

To test this theory, I decided to rebuild Verilator like so:

1. cd $CLONE_DIR
1. make clean
1. unset VERILATOR_ROOT
1. git checkout stable
1. autoconf
1. ./configure --prefix=/opt/verilator
1. make
1. make install

After resetting my path and VERILATOR_ROOT variables, I rebuilt the obj_dir subdirectory and tried to re-make the project, only to receive this as the error:

$ cd ..
$ rm -rf obj_dir
$ export VERILATOR_ROOT=/opt/verilator
$ export PATH=$PATH:$VERILATOR_ROOT/bin
$ verilator -Wall --cc ../../rtl/verilog/dmac.v --exe dmac.cpp
$ cd obj_dir
$ make -j -f Vdmac.mk Vdmac
Vdmac.mk:53: /opt/verilator/include/verilated.mk: No such file or directory
make: *** No rule to make target '/opt/verilator/include/verilated.mk'.  Stop.

At this point, I give up. I just can't win. :(

What am I missing?

Thanks for any help you can offer.

@veripoolbot
Copy link
Contributor Author


Original Redmine Comment
Author Name: Samuel Falvo (@sfalvo)
Original Date: 2018-06-08T02:40:31Z


So, I found something that would work for me, but the steps I took are markedly quite different from that documented on your installation page.

From scratch, these are the steps I took, in their entirety:

First, make sure I'm starting from a clean slate.

sudo bash   # (escalate to root user)
cd   # switch to root's home directory, which is where I cloned it originally.
cd verilator
make uninstall
cd ..
rm -rf verilator
unset VERILATOR_ROOT
git clone http://git.veripool.org/git/verilator
git checkout stable
autoconf
./configure --prefix=/opt/verilator
make
make test && make install
exit  # back to normal privilege account.

Next, make sure it all works in a single directory:

mkdir project
cd project
cat <<EOF >dmac.v
module dmac;
         initial begin $display("Hello World"); $finish; end
endmodule
EOF
cat <<EOF >dmac.cpp
#include "Vour.h"
#include "verilated.h"
int main(int argc, char **argv, char **env) {
         Verilated::commandArgs(argc, argv);
         Vdmac *top = new Vdmac;
         while (!Verilated::gotFinish()) { top->eval(); }
         delete top;
         exit(0);
}
EOF
unset VERILATOR_ROOT    #<-- this is what made everything work, I believe
verilator -Wall --cc dmac.v --exe dmac.cpp
make -j -C obj_dir -f Vdmac.mk Vdmac
obj_dir/Vdmac

At this point, everything seems like it should work OK. Next step is to lay the project files out into their intended destinations.

mkdir -p bench/cpp rtl/verilog
mv dmac.v rtl/verilog
mv dmac.cpp bench/cpp
rm -rf obj_dir
verilator -Wall --cc rtl/verilog/dmac.v --exe bench/cpp/dmac.cpp
make -j -C obj_dir -f Vdmac.mk Vdmac
obj_dir/Vdmac

Success!!

So the problem the whole time seems to be the VERILATOR_ROOT environment variable. After you run ```make install


I hope this helps others who run into the same problems I have.

@veripoolbot
Copy link
Contributor Author


Original Redmine Comment
Author Name: Wilson Snyder (@wsnyder)
Original Date: 2018-06-08T12:11:16Z


Sorry this was painful. I added a new final section to https://www.veripool.org/projects/verilator/wiki/Installing

if this doesn't cover it or you have other suggestions please let me know and I'll update it further.

@veripoolbot
Copy link
Contributor Author


Original Redmine Comment
Author Name: Wilson Snyder (@wsnyder)
Original Date: 2018-08-25T14:40:21Z


Documentation updated earlier, if you have additional suggestions please feel free to suggest more comments.

@veripoolbot veripoolbot added area: documentation Issue involves documentation resolution: fixed Closed; fixed labels Dec 22, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: documentation Issue involves documentation resolution: fixed Closed; fixed
Projects
None yet
Development

No branches or pull requests

1 participant