我正在尝试构建一个arm64版本的libcurl 7.50.3,使用Android NDK r13b,目标是Android API 19.我设法使armv7工作,但是我一直使用arm64得到错误。这是我的出口标志:构建android arm64的libcurl
NDK_ROOT="/opt/android-ndk-r13b"
export SYSROOT="${NDK_ROOT}/platforms/android-19/arch-arm"
export CPPFLAGS="-I${SYSROOT}/usr/include --sysroot=${SYSROOT}"
export CFLAGS="--sysroot=${SYSROOT}"
export CC=$(${NDK_ROOT}/ndk-which gcc)
export LD=$(${NDK_ROOT}/ndk-which ld)
export CPP=$(${NDK_ROOT}/ndk-which cpp)
export CXX=$(${NDK_ROOT}/ndk-which g++)
export AS=$(${NDK_ROOT}/ndk-which as)
export AR=$(${NDK_ROOT}/ndk-which ar)
export RANLIB=$(${NDK_ROOT}/ndk-which ranlib)
我的配置呼叫
LIBS="-ldl -lssl -lcrypto" ./configure \
--disable-ftp \
--disable-file \
--disable-ldap \
--disable-dict \
--disable-telnet \
--disable-gopher \
--disable-tftp \
--disable-manual \
--disable-shared \
--disable-imap \
--disable-pop3 \
--disable-rtsp \
--disable-smb \
--disable-smtp \
--enable-threaded-resolver \
--enable-ipv6 \
--with-ssl=${SSL_DIR} \
--host=aarch64-linux-android \
--target=aarch64-linux-android \
然后make。我已经尝试将主机和目标设置为arm-linux-androideabi,但我仍然收到相同的错误。 config.log说
configure:4488: ./conftest
./configure: line 4490: ./conftest: cannot execute binary file: Exec format error
configure:4492: $? = 126
configure:4499: error: in `/home/sossisos/build_curl_android/curl_7.50.3':
configure:4501: error: cannot run C compiled programs.
If you meant to cross compile, use `--host'.
See `config.log' for more details
我错过了什么吗?我是否误解了要使用的目标或主机?
2016-12-30
Sossisos
+0
当使用Autotools时,我相信你需要使用'--target'进行交叉编译。 '--host'是你正在建造的机器。如果主机=目标(您正在Aarch64机器上构建),则不要指定任何一个。 '--target = aarch64-linux-android'可能不是有效的目标,'--host = aarch64-linux-android'可能是错误的。据我所知,[无法让Autotools告诉你有效的三胞胎](https://lists.gnu.org/archive/html/autoconf/2015-02/msg00006.html)。另请参阅[使用Autoconf针对ARM进行交叉编译](http://stackoverflow.com/q/15234959)。 –
+3
这是不正确的。 --build是你正在运行的系统,--host是你希望编译的程序运行的系统,--target用于* build *交叉编译器。有关完整的解释,请参阅我的旧博客文章https://blog.flameeyes.eu/2009/01/the-canonical-target/。 –
+0
除了Diego所说的之外,还需要将'SYSROOT'更改为'android-21/arch-arm64',以便链接成功。 (在其他体系结构上支持API 19并不重要,因为在该版本中出现了ABI,所以没有任何arm64设备运行的API比API 21少)。 –