How do I compile jzmq for ZeroMQ on OSX?
Asked Answered
Y

8

11

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('
Yazzie answered 19/8, 2010 at 13:28 Comment(1)
In case you want to compile jzmq for storm, get the code from this repository: github.com/asmaier/jzmq . It is a fork from github.com/nathanmarz/jzmq and contains two fixes to make the code compile on Mac OS X 10.8.3 with Java 1.7.0_25 .Endocarp
N
2

I made a simple list about jzmq building for MacOS.

  1. Install brew

    https://brew.sh

  2. Install tools for jzmq building

    brew install autoconf
    
    brew install automake
    
    brew install libtool
    
    brew install pkg-config
    
    brew install [email protected]
    
  3. Download jzmq source

    https://github.com/zeromq/jzmq source download to ~/somewhere/jzmq

  4. Add symbolic link to /usr/local/include

    cd /usr/local/include
    
    ln -s /usr/local/Cellar/zeromq\@3.2/3.2.5/include/zmq.h
    
    ln -s /usr/local/Cellar/zeromq\@3.2/3.2.5/include/zmq_utils.h 
    
  5. Add symbolic linke to /usr/local/lib

    cd /usr/local/lib
    
    ln -s /usr/local/Cellar/zeromq\@3.2/3.2.5/lib/libzmq.3.dylib
    
    ln -s /usr/local/Cellar/zeromq\@3.2/3.2.5/lib/libzmq.a
    
    ln -s /usr/local/Cellar/zeromq\@3.2/3.2.5/lib/libmq.dylib
    
    ln -s /usr/local/Cellar/zeromq\@3.2/3.2.5/lib/pkgconfig/
    
  6. Build jzmq-jni

    cd ~/somewhere/jzmq
    
    cd jzmq-jni
    
    
    ./autogen.sh
    
    ./configure
    
    make
    
    make install
    
  7. Add option to VM options

VM options -Djava.library.path=/usr/local/lib

Nancee answered 15/1, 2018 at 8:15 Comment(0)
D
18

A better solution is:

eval `brew --config | grep HOMEBREW_PREFIX | sed 's/: /=/'`
sudo bash -c 'echo '$HOMEBREW_PREFIX/share/aclocal' >> `aclocal --print-ac-dir`/dirlist'

This will allow the version of aclocal that ships with OSX to find any macros installed by homebrew packages.

Dichotomous answered 4/7, 2011 at 1:49 Comment(2)
This worked for me. Maybe it should be promoted to be the answer?Vermont
Make to run ./autogen.sh after you do this, not just ./configure. After that it worked for me!Kingdom
M
4

With homebrew, the key is the warning message:

~/code/foss/java/jzmq$ brew install pkg-config                                                                                    
==> Downloading http://pkg-config.freedesktop.org/releases/pkg-config-0.25.tar.gz
==> ./configure --disable-debug --prefix=/usr/local/Cellar/pkg-config/0.25 --with-pc-path=/usr/local/lib/pkgconfig:/usr/lib/pkgconfig:/usr/X11/lib/pkgconfig
==> make install
Warning: m4 macros were installed to "share/aclocal".
Homebrew does not append "/usr/local/share/aclocal"
to "/usr/share/aclocal/dirlist". If an autoconf script you use
requires these m4 macros, you'll need to add this path manually.
==> Summary
/usr/local/Cellar/pkg-config/0.25: 8 files, 232K, built in 19 seconds

If you look at /usr/local/Cellar/pkg-config/0.25/share/aclocal/, you will see:

$ ls /usr/local/Cellar/pkg-config/0.25/share/aclocal/                                                            
pkg.m4

You need to append /usr/local/Cellar/pkg-config/0.25/share/aclocal/ to /usr/share/aclocal/dirlist,like this:

$ cat   /usr/share/aclocal/dirlist                                                                           
/usr/local/share/aclocal
/usr/local/Cellar/pkg-config/0.25/share/aclocal/

And then re-run autogen and the other steps.

Macey answered 24/10, 2011 at 12:2 Comment(0)
G
2

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).

Guadalajara answered 23/8, 2010 at 9:27 Comment(0)
N
2

I made a simple list about jzmq building for MacOS.

  1. Install brew

    https://brew.sh

  2. Install tools for jzmq building

    brew install autoconf
    
    brew install automake
    
    brew install libtool
    
    brew install pkg-config
    
    brew install [email protected]
    
  3. Download jzmq source

    https://github.com/zeromq/jzmq source download to ~/somewhere/jzmq

  4. Add symbolic link to /usr/local/include

    cd /usr/local/include
    
    ln -s /usr/local/Cellar/zeromq\@3.2/3.2.5/include/zmq.h
    
    ln -s /usr/local/Cellar/zeromq\@3.2/3.2.5/include/zmq_utils.h 
    
  5. Add symbolic linke to /usr/local/lib

    cd /usr/local/lib
    
    ln -s /usr/local/Cellar/zeromq\@3.2/3.2.5/lib/libzmq.3.dylib
    
    ln -s /usr/local/Cellar/zeromq\@3.2/3.2.5/lib/libzmq.a
    
    ln -s /usr/local/Cellar/zeromq\@3.2/3.2.5/lib/libmq.dylib
    
    ln -s /usr/local/Cellar/zeromq\@3.2/3.2.5/lib/pkgconfig/
    
  6. Build jzmq-jni

    cd ~/somewhere/jzmq
    
    cd jzmq-jni
    
    
    ./autogen.sh
    
    ./configure
    
    make
    
    make install
    
  7. Add option to VM options

VM options -Djava.library.path=/usr/local/lib

Nancee answered 15/1, 2018 at 8:15 Comment(0)
C
1

I came here with the same question, and I don't feel this is answered. I also installed ZeroMQ and pkg-config via Homebrew. /usr/local/share/aclocal/pkg.m4 exists and comes from pkg-config 0.25. It seems that Homebrew has satisfied the requirements listed but it still fails.

Commutation answered 10/11, 2010 at 19:34 Comment(3)
If you want it to just work out of the box, don't install using homebrew. Install it by downloading and compiling it yourself.Yazzie
I use tools like MacPorts or Homebrew so I don't have to monkey around with hand-compiling stuff. But, in this case, I wonder if the pkg-config file for ZeroMQ is correct. By hand-editing (ugh!) the Makefile for jzmq I was able to get it to install correctly.Commutation
Actually symlinking the pkg.m4 should be enough.Halpin
M
1

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.

Montero answered 10/4, 2011 at 1:11 Comment(0)
T
1

For me, the problem was that I didn't have pkg-config installed.

Tulipwood answered 22/1, 2013 at 6:33 Comment(1)
Me too, doing brew install pkg-config fixed itKedge
B
0

On Osx Mountain Lion I don't have the dirlist file as Phil Calçado said, but a simple symlink from /usr/local/Cellar/pkg-config/[version]/share/aclocal/pkg.m4 to /usr/share/aclocal made the trick and now jzmq build fine.

Banter answered 22/1, 2013 at 15:27 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.