How do I compile jzmq for ZeroMQ on OSX?

2019-03-09 09:23发布

Trying to follow the directions from: http://github.com/zeromq/jzmq

I installed pkg-config using Homebrew and then I run the following commands: ./autogen.sh ./configure

The configure fails with:

checking how to hardcode library paths into programs... immediate
./configure: line 15263: syntax error near unexpected token `newline'
./configure: line 15263: `    PKG_CHECK_MODULES('

8条回答
闹够了就滚
2楼-- · 2019-03-09 10:23

From the zeromq mailing list:

Building 0MQ from the development trunk on a UNIX style OS (Linux, OS X) requires that pkg-config (http://pkg-config.freedesktop.org/wiki/) be installed. A regular source build of 0MQ does not require pkg-config. On Mac OS X, pkg-config does not come with the system, so when you try to do ./configure you may see errors like:

./configure: line 23913: syntax error near unexpected token `GLIB,'
./configure: line 23913: `PKG_CHECK_MODULES(GLIB, glib-2.0 gthread-2.0)'

To resolve this, you need to install the latest pkg-config:

tar xzf pkg-config-0.25.tar.gz 
cd pkg-config-0.25 
./configure --prefix=/usr/local/pkg-config-0.25 --datarootdir=/usr/share 
make 
sudo make install

Then you will need to put /usr/local/pkg-config-0.25/bin on your $PATH. It is important to include the "--datarootdir=/usr/share" option, which will install the pkg.m4 file in /usr/share/aclocal, where aclocal will be able to find it.

Then you can build 0MQ:

cd zeromq2 
./autogen.sh  # must do this again after installing pkg-config
./configure   # add other options here 
make 
sudo make install

Edited to reflect latest pkg-config version (0.25).

查看更多
叼着烟拽天下
3楼-- · 2019-03-09 10:23

Trying to compile jzmq on Mac OS X, proved to be a bit of a headache. I followed the instructions above. I was still getting following error

syntax error near unexpected token `PKG_CHECK_MODULES

The instructions above tell you to copy the pkgk.m4 file into /usr/share/aclocal, but your directory might be different. Basically you need the dir that automake searches for macro definitions.

The _PKG_CHECK_MODULES_ macro is defined in the pkg.m4 file. This file must be installed in the appropriate directory, which is searched by automake. Somehow automake is installed twice on my OS X, one in /usr and another in /Developer/usr. Make sure you know which one it's using. Just do which automake. If yours in is /Developer/usr, then copy the pkg.m4 file to /Developer/usr/share/aclocal.

查看更多
登录 后发表回答