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

pkgconfig support #919

Closed
veripoolbot opened this issue May 13, 2015 · 10 comments
Closed

pkgconfig support #919

veripoolbot opened this issue May 13, 2015 · 10 comments
Labels
area: configure/compiling Issue involves configuring or compilating Verilator itself resolution: fixed Closed; fixed

Comments

@veripoolbot
Copy link
Contributor


Author Name: Stefan Wallentowitz (@wallento)
Original Redmine Issue: 919 from https://www.veripool.org
Original Date: 2015-05-13


Hi Wilson,

attached please find my proposed patch for a verilator pkg-config file. I unfortunately found that the method with VERILATOR_ROOT does not work properly with the Debian package and I believe pkgconfig is more flexible. It is installed in /usr/local/share/pkgconfig by default and /usr/share/pkgconfig with /usr prefix, both are properly found with pkg-config by default.

Best,
Stefan

@veripoolbot
Copy link
Contributor Author


Original Redmine Comment
Author Name: Wilson Snyder (@wsnyder)
Original Date: 2015-05-13T14:08:14Z


Thanks for making a patch, seems reasonable.

Is it really correct that there are no "Requires" or "Libs"?

@veripoolbot
Copy link
Contributor Author


Original Redmine Comment
Author Name: Stefan Wallentowitz (@wallento)
Original Date: 2015-05-13T14:19:20Z


As there is no libverilator.so or similar I suppose there is no useful value for Libs. Instead the user compiles the files in $pkgdatadir/include with his program. As the Requires only accounts for other pkgconfig files I can only see systemc as a candidate here, but it is not mandatory, so I left it out.

I use it like this for the runtime files:

g++ -o verilated.o $(shell pkg-config --variable=includedir verilator)/verilated.cpp

And like this for my program:

g++ -o main.o $(shell pkg-config --cflags verilator) main.cpp

Linking does not require further pkgconfig information.

I hope I don't "misuse" Verilator :)

@veripoolbot
Copy link
Contributor Author


Original Redmine Comment
Author Name: Wilson Snyder (@wsnyder)
Original Date: 2015-05-13T14:26:59Z


I was thinking more along the lines of a dependance on the c libraries. Here's what debian uses, which are correct for this file?

Source: verilator
Section: electronics
Priority: optional
Maintainer: Debian Electronics Team <pkg-electronics-devel@lists.alioth.debian.org>
Uploaders: أحعد اعÙحعÙدع (Ahmed El-Mahmoudy) <aelmahmoudy@sabily.org>
DM-Upload-Allowed: yes
Build-Depends: debhelper (>= 7.0.50~), autotools-dev, flex, bison
Standards-Version: 3.9.0
Homepage: http://www.veripool.org/wiki/verilator
Vcs-Git: git://git.debian.org/git/pkg-electronics/verilator.git
Vcs-Browser: http://git.debian.org/?p=pkg-electronics/verilator.git

Package: verilator
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}
Suggests: gtkwave, systemc
Description: fast free Verilog simulator
 Verilator is the fastest free Verilog HDL simulator, and beats many commercial
 simulators. It compiles synthesizable Verilog (not test-bench code!), plus
 some PSL, SystemVerilog and Synthesis assertions into C++ or SystemC code.
 It is designed for large projects where fast simulation performance is of
 primary concern, and is especially well suited to generate executable models
 of CPUs for embedded software design teams.

@veripoolbot
Copy link
Contributor Author


Original Redmine Comment
Author Name: Stefan Wallentowitz (@wallento)
Original Date: 2015-05-13T14:43:35Z


There is no pkgconfig variable for such "low level" libraries; it needs to be assumed that as you built verilator you have them available or if it is installed via a package manager this has to track this (like in the Debian file). The Requires in pkgconfig is rarely used, on my Ubuntu only for fixesproto.pc ("Requires: xextproto >= 7.0.99.1"). Summarized, pkgconfig requirements are only for such cases where we for example depend on another library to be linked with (say libusb >= 1.0), but not for the basic C runtime etc.

Best,
Stefan

@veripoolbot
Copy link
Contributor Author


Original Redmine Comment
Author Name: Wilson Snyder (@wsnyder)
Original Date: 2015-05-14T01:22:13Z


Thanks again for the patch, pushed to git towards 3.873.

@veripoolbot
Copy link
Contributor Author


Original Redmine Comment
Author Name: Stefan Wallentowitz (@wallento)
Original Date: 2015-05-16T14:51:13Z


Hi again,

sorry, I missed one point: The auto-generated files include @svdpi.h@ and need the path for this.

This fixes this:

diff --git a/verilator.pc.in b/verilator.pc.in
index 75532e4..2b3ba70 100644
--- a/verilator.pc.in
+++ b/verilator.pc.in
@@ -10,4 +10,4 @@ URL: http://www.veripool.org/verilator
 Version: @PACKAGE_VERSION@
 Requires:
 Libs:
-Cflags: -I${includedir}
+Cflags: -I${includedir} -I${includedir}/vltstd

Sorry for missing this.

Best,
Stefan

@veripoolbot
Copy link
Contributor Author


Original Redmine Comment
Author Name: Wilson Snyder (@wsnyder)
Original Date: 2015-05-16T22:09:26Z


Fixed, thanks

@veripoolbot
Copy link
Contributor Author


Original Redmine Comment
Author Name: Wilson Snyder (@wsnyder)
Original Date: 2015-06-06T18:03:18Z


In 3.874.

@veripoolbot
Copy link
Contributor Author


Original Redmine Comment
Author Name: أحمد المحمودي
Original Date: 2015-06-07T14:08:30Z


Is the 'libdir' field needed ?

@veripoolbot
Copy link
Contributor Author


Original Redmine Comment
Author Name: Stefan Wallentowitz (@wallento)
Original Date: 2015-06-07T14:35:44Z


You are right, actually it is not used. I am not sure if it is required to provide the variable at least (so that prefix, libdir etc. can be checked). If you think it is not required to put it in a pkgconfig file, we can remove it.

Best,
Stefan

@veripoolbot veripoolbot added area: configure/compiling Issue involves configuring or compilating Verilator itself 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: configure/compiling Issue involves configuring or compilating Verilator itself resolution: fixed Closed; fixed
Projects
None yet
Development

No branches or pull requests

1 participant