2010-08-19 83 views
10

試圖按照從路線:http://github.com/zeromq/jzmq如何在OSX上爲ZeroMQ編譯jzmq?

我使用自制安裝pkg配置,然後我運行下面的命令: ./autogen.sh 的./configure

的配置過程出現:

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

如果你想編譯jzmq風暴,得到該庫中的代碼:https://github.com/asmaier/jzmq。它是https://github.com/nathanmarz/jzmq中的一個分支,包含兩個修復程序,使代碼能夠在Java 1.7.0_25的Mac OS X 10.8.3上編譯。 – asmaier 2013-10-16 15:16:45

回答

0

我做了一個關於jzmq building for MacOS的簡單列表。

  1. 安裝釀造

    https://brew.sh

  2. brew install autoconf 
    
    brew install automake 
    
    brew install lib tool 
    
    brew install pkg-config 
    
    brew install [email protected] 
    
  3. 下載jzmq源

    https://github.com/zeromq/jzmq源碼下載,安裝工具jzmq建築到〜/地方/ jzmq

  4. 符號鏈接添加到/ usr /本地/包括

    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. 添加符號臨客到/ 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. 構建jzmq-JNI

    cd ~/somewhere/jzmq 
    
    cd jzmq-jni 
    
    
    ./autogen.sh 
    
    ./configure 
    
    make 
    
    make install 
    
  7. 將選項添加到VM選項

VM選項-Djava.library.path=/usr/local/lib

2

從zeromq mailing list

裴在UNIX樣式OS(Linux,OS X) 上從開發 trunk的lding 0MQ需要安裝pkg-config (http://pkg-config.freedesktop.org/wiki/) 。 0MQ的常規源版本 不需要pkg-config。 在Mac OS X中,pkg配置不與系統來 ,所以當你嘗試做 的./configure你會看到這樣的錯誤:

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

要解決這個問題,你需要安裝 的最新的pkg配置:

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 

然後,你將需要把 /usr/local/pkg-config-0.25/bin您 $ PATH。包含 "--datarootdir=/usr/share"選項, 這將是重要的,它將安裝pkg.m4文件在 /usr/share/aclocal,其中aclocal將 能夠找到它。

然後你就可以建立0MQ:

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

編輯,以反映最新的pkg配置版本(0.25)。

1

我來到這裏的同一個問題,我不覺得這是回答。我還通過Homebrew安裝了ZeroMQ和pkg-config。 /usr/local/share/aclocal/pkg.m4存在並來自pkg-config 0.25。似乎Homebrew已經滿足了上述要求,但仍然失敗。

+0

如果您希望它只是開箱即用,請勿使用自制軟件安裝。通過自己下載和編譯來安裝它。 – Joshua 2010-11-11 02:15:11

+0

我使用像MacPorts或Homebrew這樣的工具,所以我不必用手工編譯東西。但是,在這種情況下,我想知道ZeroMQ的pkg-config文件是否正確。通過手工編輯(ugh!)jzmq的Makefile,我能夠正確地安裝它。 – user503667 2010-11-22 03:56:06

+0

實際上symlinking'pkg.m4'應該就夠了。 – yawn 2010-12-08 12:01:45

1

試圖在Mac OS X上編譯jzmq,證明是有點頭疼。我遵循上面的說明。我仍然得到以下錯誤

語法錯誤附近意外的標記 `PKG_CHECK_MODULES

以上說明告訴你的pkgk.m4文件複製到在/ usr /共享/ aclocal會,但你的目錄可能會有所不同。基本上你需要的是automake搜索宏定義的目錄。

_PKG_CHECK_MODULES_宏在pkg.m4文件中定義。此文件必須安裝在appropriate directory中,該文件由automake搜索。不知何故automake在我的OS X上安裝了兩次,一次在/usr,另一次在/Developer/usr。確保你知道它使用哪一個。只需做哪個汽車製造商。如果您的密碼是/Developer/usr,請將pkg.m4文件複製到/Developer/usr/share/aclocal

18

更好的解決方案是:

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

這將允許aclocal會的版本附帶的OSX找到通過自制軟件的軟件包安裝任何宏。

+0

這對我有效。也許它應該被提升爲答案? – Brian 2012-04-22 03:09:43

+2

爲我工作:)謝謝@Beekhof! – 2012-09-20 03:17:46

+0

執行此操作後運行./autogen.sh,而不僅僅是./configure。之後,它爲我工作! – 2013-04-01 23:16:27

4

利用自制的,關鍵是警告消息:

~/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 

如果你看一下/usr/local/Cellar/pkg-config/0.25/share/aclocal/,您將看到:

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

您需要添加/usr/local/Cellar/pkg-config/0.25/share/aclocal/到/ usr /共享/ aclocal會/ dirlist,像這樣:

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

然後重新運行autogen和其他步驟。

1

對我來說,問題是我沒有安裝pkg-config。

+0

我也是這樣,'brew install pkg-config'修復了它 – 2013-11-27 22:45:03

0

在Osx Mountain Lion上,我沒有PhilCalçado所說的dirlist文件,但是從/usr/local/Cellar/pkg-config/[version]/share/aclocal/pkg.m4/usr/share/aclocal的一個簡單符號鏈接使得這個技巧成爲現實,現在jzmq也可以正常工作。