我正在尝试使用 android NDK r13b,针对 Android API 19 构建 libcurl 7.50.3 的arm64 版本。我已经设法让armv7 正常工作,但在arm64 上我不断收到错误。这些是我的导出标志:
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 \
然后制作。我也尝试将主机和目标设置为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
我错过了什么吗?我是否误解了要使用的目标或主机?
最佳答案
确保使用 --host
(设置为 arm64/android)和 --build
(设置为您的系统,可能是 x86_64-pc-linux-gnu)。后者应该被自动检测到,但情况并非总是如此。这样脚本就会知道您正在交叉编译,并且它不会尝试执行它构建的程序。
关于curl - 为 android arm64 构建 libcurl,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41399486/