Open nponeccop opened 13 years ago
I had the same problem (next time I'll look here first), but your suggestion would not solve the problem IMO, since ZeroMQ might be installed a different location (it is on my machine) and the point of pkgconfig is exactly to enable that.
I think it would be sufficient to include it in the README file that prior to building the PKG_CONFIG_PATH variable has point to where ZeroMQ is installed.
No! PKG_CONFIG_PATH
should point to where pkgconfig database is installed, not to where ZeroMQ is installed. The problem is that pkgconfig database is located at /usr/local/lib/pkgconfig/
on many systems (see other tickets mentioning pkgconfig), and pkgconfig itself assumes a different location for its database (/usr/lib/pkgconfig/
folder if I remember correctly).
I vote for setting PKG_CONFIG_PATH
within wscript
, not for setting library search paths and duplicating what pkgconfig
is for.
README is not a solution because the preferred way of installing the library is through NPM. What if a user installs a library and zmq
is installed as a dependency? Resolving issues by downloading the broken library and reading README is a great PITA. If pain can avoided, why not?
NPM uses node-waf to build binary node.js extensions such as zmq
, and node-waf seems to be powerful enough to set such search paths and enable a fully automated configuration and compilation.
You got it wrong. I was not setting the library search path via pkg-config, which would not work since that's done via ldconfig or LD_LIBRARY_PATH. pkg-config informs the configure procedure whether a library is installed and where the necessary header files are.
If you install zeromq in a non-default path (i.e. I installed it in /opt/local/zeromq) under ./lib/pkgconfig you find the corresponding pkgconfig database. If you read the man page it clearly states that pgk-config "will additionally look in the colon-separated ... list of directories specified by the PKG_CONFIG_PATH environment variable".
As for the README. What I suggested was to include a note to set the PKG_CONFIG_PATH before executing nmp. Should look something like this:
export PKG_CONFIG_PATH=/path/to/zeromq/prefix/lib/pkgconfig npm install zeromq
Where "/path/to/zeromq/prefix/" is the prefix that you used when you installed zeromq from source. That worked for me. My understanding is that npm downloads the sources and uses pkg-config (and subsequently PKG_CONFIG_PATH) to figure out where zeromq is installed. You still have to make sure that your system finds the zeromq library at runtime. There are at least two ways that I know of either using ldconfig or LD_LIBRARY_PATH.
Hard coding a specific path into the install script seems to defeat the whole purpose of pkg-config IMO since it's meant to be a generic mechanism to set such paths.
Related: it's impossible to npm install
this repo unless you already have system wide libzmq-dev installed (debian-ly speaking) or you've root privileges to install libzmq. While it's easy to override libzmq headers location by running PKG_CONFIG_PATH=/path/of/your/local/libzmq/build/src CXXFLAGS="-I/path/of/your/local/libzmq/build/include" node-waf configure build
, node-waf
seems to not honor passed LINKFLAGS=/path/of/your/local/libzmq/build/src/.libs
which results in not finding -lzmq
.
Please, consider adding maybe a special target which could download and use libzmq sources locally.
TIA, --Vladimir
Are you asking to add support for local libzmq installations (without root privileges)? If so, it's better to create a special ticket
Since
PKG_CONFIG_PATH="/usr/local/lib/pkgconfig"
is required on so many OSes (Ubuntu, MacOSX, Cygwin), is there any way to add this path to thewscript
?