安卓编译ZeroMq

1、需要安装的工具 https://blog.csdn.net/qq_30549833/article/details/72955881,主要是安装libtool ,autoconf,automake,按步骤来不会出现什么错误。

2、编译时完全按官网进行操作  http://zeromq.org/build:android 一步一步来,不要急,步骤比较简单。

3、编译

cd libzmq/
./autogen.sh
./configure --enable-static --disable-shared --host=arm-linux-androideabi --prefix=$OUTPUT_DIR LDFLAGS="-L$OUTPUT_DIR/lib" CPPFLAGS="-fPIC -I$OUTPUT_DIR/include" LIBS="-lgcc"
make
make install

或者 cd libzmq/builds/android 

vi build.sh

 #!/usr/bin/env bash
  2 
  3 # Use directory of current script as the build directory and working directory
  4 cd "$( dirname "${BASH_SOURCE[0]}" )"
  5 ANDROID_BUILD_DIR="$(pwd)"
  6 
  7 # Get access to android_build functions and variables
  8 source ${ANDROID_BUILD_DIR}/android_build_helper.sh
  9 
 10 # Choose a C++ standard library implementation from the ndk
 11 ANDROID_BUILD_CXXSTL="gnustl_shared_49"
 12 ANDROID_BUILD_CXXSTL="gnustl_shared_49"
 13 ANDROID_NDK_ROOT="/home/fxh/android-ndk-r15c"
 14 TOOLCHAIN_PATH="/home/fxh/android-ndk-r15c/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin"
 15 TOOLCHAIN_NAME="arm-linux-androideabi-4.9"
 16 TOOLCHAIN_HOST="arm-linux-androideabi" 
 17 TOOLCHAIN_ARCH="arm"

根据以上内容进行修改,修改完后执行./build.sh 

如果嫌麻烦可按照README.md上的步骤来操作完成。

4、checking host system type... Invalid configuration `arm-linux-androideabi': system `androideabi' not recognized
    configure: error: /bin/bash ./config.sub arm-linux-androideabi failed

    这是因为config.sub和config.guess还没有加入arm-linux-androideabi的支持,可以到下面这个网址下载这两个文件分别覆盖两个包下面的对应的文件:http://git.savannah.gnu.org/gitweb/?p=config.git;a=tree

我当时自己在编译时,被这个问题折磨了好几天,虽然知道是两个文件有问题,但是那两个文件有好几处都有,改来改去都还是报这个错误,后面我搜索出所有有这两个文件的地方,一一都替换成最新的,果然编译成功。当你们在编译时遇到类似问题,可参照次方法进行解决。

根据经验,一般automake、libtool、autoconf这几个工具链下面的config.sub和config.guess需要替换成最新的。

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值