照这个官方说明是万万编译不过的:http://www.zeromq.org/build:android
苦逼的是,如果你想通过google搜索jzmq ...之类的帮助,google会提示你,可能会断网,你懂的。
好了,让我们天朝有为青年不至于无法编译安装jzmq而耽误大好年华,我把本人在编译过程中所有碰到的问题和解决方案一一列出,仅供大家参考:
操作系统:lion(10.7.3),mac book pro
1. 简单起见,我们以官方说明为主,所有需要执行什么wget, autoconf, automake等等命令,照其执行就是,如果有命令没有,第一反映是执行:sudo port install xxx;如:wget没有安装,就执行sudo port install wget; 再如 autoconf没有安装就执行sudo port install autoconf等等,不一而足。
2. 也有例外:gettext无法通过port安装,下载gnu gettext源代码,编译,。。。不过!错误信息如下:
stpncpy.c:34: error: expected declaration specifiers or ‘...’ before numeric constant
非常奇怪的错误,以GNU的水准,居然会有编译错误?不过搞定的办法很简单,修改gettext-tools/gnulib-lib/stpncpy.c第34行,将stpncpy改为stpcpy。
3. pkg-config的问题
pkg-config也无法通过port安装,只好下载源码编译通过。此处简单无话。
但到jzmq编译的时候,会出现一个奇怪的问题:
./configure: line 15263: syntax error near unexpected token `newline' ./configure: line 15263: ` PKG_CHECK_MODULES('
google不能用,还好我们有伟大的stackoverflow,搜关键字macos jzmq ,即可发现一个链接:
http://stackoverflow.com/questions/3522248/how-do-i-compile-jzmq-for-zeromq-on-osx
告诉你:
The _PKG_CHECK_MODULES_ macro is defined in the pkg.m4 file. This file must be installed in theappropriate 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.
./configure --host=arm-linux-androideabi --prefix=$OUTPUT_DIR --with-zeromq=$OUTPUT_DIR CPPFLAGS="-fPIC" --enable-self-contained --disable-version
报错误:cannot find java include files
_ACJNI_FOLLOWED="$_cur"
_JTOPDIR=`echo "$_ACJNI_FOLLOWED" | sed -e 's://*:/:g' -e 's:/[^/]*$::'`
case "$host_os" in
darwin*) _JTOPDIR=`echo "$_JTOPDIR" | sed -e 's:/[^/]*$::'`
_JINC="$_JTOPDIR/Headers";;
*) _JINC="$_JTOPDIR/include";;
esac
#_AS_ECHO_LOG([_JTOPDIR=$_JTOPDIR])
#_AS_ECHO_LOG([_JINC=$_JINC])
# On Mac OS X 10.6.4, jni.h is a symlink:
# /System/Library/Frameworks/JavaVM.framework/Versions/Current/Headers/jni.h
# -> http://www.cnblogs.com/CurrentJDK/Headers/jni.h.
if test -f "$_JINC/jni.h" || test -L "$_JINC/jni.h"; then
JNI_INCLUDE_DIRS="$JNI_INCLUDE_DIRS $_JINC"
if test -f "$_JINC/jni.h" || test -L "$_JINC/jni.h"; then
JNI_INCLUDE_DIRS="$JNI_INCLUDE_DIRS $_JINC"
else
_JTOPDIR=`echo "$_JTOPDIR" | sed -e 's:/[^/]*$::'`
if test -f "$_JTOPDIR/include/jni.h"; then
JNI_INCLUDE_DIRS="$JNI_INCLUDE_DIRS $_JTOPDIR/include"
else
as_fn_error $? "cannot find java include files" "$LINENO" 5
fi
fi
至此真相大明,其引用$_cur得到javac的位置,但我的机器HOME目录也许跟别的机器不一样,导致其分析出错,在此简单设置JAVA_HOME=/Library/Java/Home; export JAVA_HOME,然后修改configure文件,在case语句之前加一行:
_JTOPDIR=`echo "$_ACJNI_FOLLOWED" | sed -e 's://*:/:g' -e 's:/[^/]*$::'`
_JTOPDIR=$JAVA_HOME
case "$host_os" in
darwin*) _JTOPDIR=`echo "$_JTOPDIR" | sed -e 's:/[^/]*$::'`
...
即可搞定。