gpt4 book ai didi

iphone - 将 Apache Portable Runtime 交叉编译到 iPhone

转载 作者:行者123 更新时间:2023-12-03 18:35:45 27 4
gpt4 key购买 nike

这是关于 iPhone 交叉编译的上一个问题的后续:
Cross-compile Autotools-based Libraries for Official iPhone SDK

基本上,我正在尝试为 iPhone 编译 Apache Portable Runtime (APR) 版本 1.3.8(最新)。我目前在配置步骤中遇到以下错误:

checking for working PROCESS_SHARED locks... configure: error: in `/Users/michaelsafyan/Downloads/apr-1.3.8':configure: error: cannot run test program while cross compilingSee `config.log' for more details.

我通过“iphone3.1-configure --disable-dso --enable-threads”调用“configure”脚本,其中“iphone3.1-configure”是我编写的以下脚本调用“配置”脚本:

#! /bin/bash## Program  : iphone3.1-configure# Authors  : Michael Aaron Safyan (michaelsafyan@gmail.com)# Synopsis :#            This program runs the "configure" script generated by the#            GNU Autotools in order to cross-compile thirdparty libraries#            for the iPhone 3.1 SDK. Run this script while in a directory#            containing an autotools "configure" script. Once you run this,#            you can use "make" and "sudo make install" to build the library.#            An install prefix of "/opt/iphone-3.1/" is used.#unset CPATHunset C_INCLUDE_PATHunset CPLUS_INCLUDE_PATHunset OBJC_INCLUDE_PATHunset LIBSunset DYLD_FALLBACK_LIBRARY_PATHunset DYLD_FALLBACK_FRAMEWORK_PATHexport BUILD_DARWIN_VER=`uname -r`export SDKVER="3.1"export DEVROOT="/Developer/Platforms/iPhoneOS.platform/Developer"export SDKROOT="$DEVROOT/SDKs/iPhoneOS$SDKVER.sdk"export PKG_CONFIG_PATH=/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS$SDKVER.sdk/usr/lib/pkgconfig:/Developer/Platforms/iPhoneOS.platform/Developer/usr/lib/pkgconfig:/opt/iphone-$SDKVER/lib/pkgconfig:/usr/local/iphone-$SDKVER/lib/pkgconfigexport PREFIX="/opt/iphone-$SDKVER"export AS="$DEVROOT/usr/bin/as"export ASCPP="$DEVROOT/usr/bin/as"export AR="$DEVROOT/usr/bin/ar"export RANLIB="$DEVROOT/usr/bin/ranlib"export CPPFLAGS="-pipe -no-cpp-precomp -I$SDKROOT/usr/lib/gcc/arm-apple-darwin9/4.2.1/include/ -I$SDKROOT/usr/include -I$DEVROOT/usr/include -I/opt/iphone-$SDKVER/include -I/usr/local/iphone-$SDKVER/include"export CFLAGS="-std=c99 -arch armv6 -pipe -no-cpp-precomp --sysroot='$SDKROOT' -isystem $SDKROOT/usr/lib/gcc/arm-apple-darwin9/4.2.1/include/ -isystem $SDKROOT/usr/include -isystem $DEVROOT/usr/include -isystem /opt/iphone-$SDKVER/include -isystem /usr/local/iphone-$SDKVER/include"export CXXFLAGS="-std=c99 -arch armv6 -pipe -no-cpp-precomp --sysroot='$SDKROOT' -isystem $SDKROOT/usr/lib/gcc/arm-apple-darwin9/4.2.1/include/ -isystem $SDKROOT/usr/include -isystem $DEVROOT/usr/include -isystem /opt/iphone-$SDKVER/include -isystem /usr/local/iphone-$SDKVER/include"export LDFLAGS="-arch armv6 --sysroot='$SDKROOT' -L$SDKROOT/usr/lib -L$DEVROOT/usr/lib -L/opt/iphone-$SDKVER/lib -L/usr/local/iphone-$SDKVER/lib"export CPP="$DEVROOT/usr/bin/cpp"export CXXCPP="$DEVROOT/usr/bin/cpp"export CC="$DEVROOT/usr/bin/gcc-4.2"export CXX="$DEVROOT/usr/bin/g++-4.2"export LD="$DEVROOT/usr/bin/ld"export STRIP="$DEVROOT/usr/bin/strip"if [ ! \( -d "$DEVROOT" \) ] ; then   echo "The iPhone SDK could not be found. Folder \"$DEVROOT\" does not exist."   exit 1fiif [ ! \( -d "$SDKROOT" \) ] ; then   echo "The iPhone SDK could not be found. Folder \"$SDKROOT\" does not exist."   exit 1fi./configure --prefix="$PREFIX" --build="i386-apple-darwin$BUILD_DARWIN_VER" --host="arm-apple-darwin9" --enable-static --disable-shared ac_cv_file__dev_zero=no ac_cv_func_setpgrp_void=yes $@

configure 给我的错误并不是我第一次收到“交叉编译时无法运行测试程序”的消息。事实上,“iphone3.1-configure”脚本中的“ac_cv_file__dev_zero=no”和“ac_cv_func_setpgrp_void=yes”元素会导致两个类似的失败测试被绕过。我遇到的问题是我不知道如何绕过此检查 - 也就是说,我不知道要设置哪些变量来绕过此测试以及尝试运行为目标构建的可执行文件的任何其他测试平台。我之所以能够绕过之前的两个类似测试,只是因为我能够在 Google 上找到解决方法...有人知道要设置哪些变量或绕过此检查的其他方法吗?

如果有人知道一种方法来抑制交叉编译时无法执行的所有测试,或者如果您只是知道如何抑制此特定检查,我将非常感激。非常感谢。

最佳答案

需要设置以下变量:

  • ac_cv_file__dev_zero="是"
  • ac_cv_func_setpgrp_void="是"
  • apr_cv_process_shared_works="是"
  • apr_cv_mutex_robust_shared="否"
  • apr_cv_tcp_nodelay_with_cork="是"
  • ac_cv_sizeof_struct_iovec="8"
  • apr_cv_mutex_recursive="是"

使用以下更新的“iphone3.1-configure”脚本来配置程序:

#! /bin/bash## Program  : iphone3.1-configure# Authors  : Michael Aaron Safyan (michaelsafyan@gmail.com)# Synopsis :#            This program runs the "configure" script generated by the#            GNU Autotools in order to cross-compile thirdparty libraries#            for the iPhone 3.1 SDK. Run this script while in a directory#            containing an autotools "configure" script. Once you run this,#            you can use "make" and "sudo make install" to build the library.#            An install prefix of "/opt/iphone-3.1/" is used.#unset CPATHunset C_INCLUDE_PATHunset CPLUS_INCLUDE_PATHunset OBJC_INCLUDE_PATHunset LIBSunset DYLD_FALLBACK_LIBRARY_PATHunset DYLD_FALLBACK_FRAMEWORK_PATHexport BUILD_DARWIN_VER=`uname -r`export SDKVER="3.1"export DEVROOT="/Developer/Platforms/iPhoneOS.platform/Developer"export SDKROOT="$DEVROOT/SDKs/iPhoneOS$SDKVER.sdk"export PKG_CONFIG_PATH=/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS$SDKVER.sdk/usr/lib/pkgconfig:/Developer/Platforms/iPhoneOS.platform/Developer/usr/lib/pkgconfig:/opt/iphone-$SDKVER/lib/pkgconfig:/usr/local/iphone-$SDKVER/lib/pkgconfigexport PREFIX="/opt/iphone-$SDKVER"export AS="$DEVROOT/usr/bin/as"export ASCPP="$DEVROOT/usr/bin/as"export AR="$DEVROOT/usr/bin/ar"export RANLIB="$DEVROOT/usr/bin/ranlib"export CPPFLAGS="-pipe -no-cpp-precomp -I$SDKROOT/usr/lib/gcc/arm-apple-darwin9/4.2.1/include/ -I$SDKROOT/usr/include -I$DEVROOT/usr/include -I/opt/iphone-$SDKVER/include -I/usr/local/iphone-$SDKVER/include"export CFLAGS="-std=c99 -arch armv6 -pipe -no-cpp-precomp --sysroot='$SDKROOT' -isystem $SDKROOT/usr/lib/gcc/arm-apple-darwin9/4.2.1/include/ -isystem $SDKROOT/usr/include -isystem $DEVROOT/usr/include -isystem /opt/iphone-$SDKVER/include -isystem /usr/local/iphone-$SDKVER/include"export CXXFLAGS="-std=c99 -arch armv6 -pipe -no-cpp-precomp --sysroot='$SDKROOT' -isystem $SDKROOT/usr/lib/gcc/arm-apple-darwin9/4.2.1/include/ -isystem $SDKROOT/usr/include -isystem $DEVROOT/usr/include -isystem /opt/iphone-$SDKVER/include -isystem /usr/local/iphone-$SDKVER/include"export LDFLAGS="-arch armv6 --sysroot='$SDKROOT' -L$SDKROOT/usr/lib -L$DEVROOT/usr/lib -L/opt/iphone-$SDKVER/lib -L/usr/local/iphone-$SDKVER/lib"export CPP="$DEVROOT/usr/bin/cpp"export CXXCPP="$DEVROOT/usr/bin/cpp"export CC="$DEVROOT/usr/bin/gcc-4.2"export CXX="$DEVROOT/usr/bin/g++-4.2"export LD="$DEVROOT/usr/bin/ld"export STRIP="$DEVROOT/usr/bin/strip"if [ ! \( -d "$DEVROOT" \) ] ; then   echo "The iPhone SDK could not be found. Folder \"$DEVROOT\" does not exist."   exit 1fiif [ ! \( -d "$SDKROOT" \) ] ; then   echo "The iPhone SDK could not be found. Folder \"$SDKROOT\" does not exist."   exit 1fi./configure \    --prefix="$PREFIX" \    --build="i386-apple-darwin$BUILD_DARWIN_VER" \    --host="arm-apple-darwin9" \    --enable-static \    --disable-shared \    ac_cv_file__dev_zero="yes" \    ac_cv_func_setpgrp_void="yes" \    apr_cv_process_shared_works="yes" \    apr_cv_mutex_robust_shared="no" \    apr_cv_tcp_nodelay_with_cork="yes" \    ac_cv_sizeof_struct_iovec="8" \    apr_cv_mutex_recursive="yes" $@

使用“iphone3.1-configure --disable-dso --enable-threads && make”,然后“sudo make install”。

关于iphone - 将 Apache Portable Runtime 交叉编译到 iPhone,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1604470/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com