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

Verilator is unfriendly to cross compiling verilated output. Simple fix. #1221

Closed
veripoolbot opened this issue Sep 26, 2017 · 4 comments
Closed
Labels
resolution: abandoned Closed; not enough information or otherwise never finished

Comments

@veripoolbot
Copy link
Contributor


Author Name: Rob Stoddard
Original Redmine Issue: 1221 from https://www.veripool.org


In verilated.mk the following change should be made...

From:


PERL = /usr/bin/perl
CXX = g++
LINK = g++
AR     = ar
RANLIB = ranlib


</code>

To:


PERL = /usr/bin/perl
CXX = $(CROSS_COMPILE)g++
LINK = $(CROSS_COMPILE)g++
AR     = $(CROSS_COMPILE)ar
RANLIB = $(CROSS_COMPILE)ranlib


</code>
@veripoolbot
Copy link
Contributor Author


Original Redmine Comment
Author Name: Wilson Snyder (@wsnyder)
Original Date: 2017-09-28T11:37:26Z


Those are setup by configure (for the most part), so your patch would only work in very limited cases.

For now, why wouldn't you just override those variables when you call make?

To fix this, the patch should use the proper configure host and target settings to specify a cross compiler. That setups two settings, one for the host (Verilator) compiler, and one for the target (Verilated) compiler etc. Then configure needs to run on each compiler separately to determine the appropriate flags, as assuming both are the same (flags/version) isn't correct for cross compilation. Alsosome make variables that are now common need host/target splits. It certainly would be appreciated if you'd like to make a patch to do this.

@veripoolbot
Copy link
Contributor Author


Original Redmine Comment
Author Name: Rob Stoddard
Original Date: 2017-09-28T17:30:10Z


I'm thinking you're thinking about ./configure for building Verilator itself, however, I'm talking about the verilated outcome from a design.

What I'm used to is doing a cross compile with the variable CROSS_COMPILE set, but in other cases it's not set... so if CROSS_COMPILE is not set, CXX becomes g++ which is the intended outcome for a non-cross build. In my case, there is a chance that CROSS_COMPILE is set to x86_64-w64-mingw32- which would make CXX become x86_64-w64-mingw32-g++ which would work for building Windows software on a Linux machine.

In no case do I want to fix Verilator to generating code for a specific platform.

@veripoolbot
Copy link
Contributor Author


Original Redmine Comment
Author Name: Wilson Snyder (@wsnyder)
Original Date: 2017-09-28T22:23:55Z


Configure sets up both the compile options for the host, and for the target and assumes at present both are the same. You'll see the problem if you set your cross compiler to something really different (e.g. non GCC) as it will get passed the host's flags incorrectly (as again Verilator thinks host and target are the same).

@veripoolbot
Copy link
Contributor Author


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


Seems like this got stalled so closing due to age, if you end up with a general patch for cross compiling please reopen.

@veripoolbot veripoolbot added the resolution: abandoned Closed; not enough information or otherwise never finished label Dec 22, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
resolution: abandoned Closed; not enough information or otherwise never finished
Projects
None yet
Development

No branches or pull requests

1 participant