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:01

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

查看更多
The star\"
3楼-- · 2019-03-09 10:09

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.

查看更多
劳资没心,怎么记你
4楼-- · 2019-03-09 10:10

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.

查看更多
ら.Afraid
5楼-- · 2019-03-09 10:10

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.

查看更多
冷血范
6楼-- · 2019-03-09 10:11

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 zeromq@3.2
    
  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

查看更多
够拽才男人
7楼-- · 2019-03-09 10:16

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.

查看更多
登录 后发表回答