curl - 为 android arm64 构建 libcurl

标签 curl android-ndk cross-compiling autotools

我正在尝试使用 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/

相关文章:

php - 如何将 POSTMAN 中的数据转换为 PHP Curl 请求?

Android NDK - 它支持直接的 ARM 代码还是只支持 Thumb

c++ - 为 FBReader 编译 NDK 库时出错

linux - 为 arm 编译 oprofile 时出错

embedded - 为嵌入式系统编译Pascal代码(AT89C51RC2)

mono - 无法为 ARM 交叉编译 Mono

python - 如何在 python 中设置代理值和运行 linux 命令

ios - 将 curl 命令转换为 iOS

php - 使用 cURL 获取错误代码 28

android - 纹理不会出现使用 native 代码在 android 上使用 opengl es 加载它