将Apache便携式运行时交叉编译到iPhone [英] Cross-compile Apache Portable Runtime to the iPhone

查看:161
本文介绍了将Apache便携式运行时交叉编译到iPhone的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是关于交叉编译iPhone的前一个问题的后续:

Cross官方iPhone SDK编译自动工具库 基本上,我试图编译Apache Portable Runtime(APR)1.3版。 8(最新)的iPhone。在配置步骤中,我正在运行以下错误:

 
检查正在运行的PROCESS_SHARED锁定... configure:error:in`/ / Users / michaelsafyan / Downloads / apr-1.3.8':
configure:error:交叉编译时无法运行测试程序
查看`config.log'以获取更多详细信息。

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

 
#! / bin / bash


#程序:iphone3.1-configure
#作者:Michael Aaron Safyan(michaelsafyan@gmail.com)
#简介:
#此程序运行由
#GNU Autotools生成的configure脚本,以便为iPhone 3.1 SDK交叉编译第三方库
#。在包含autotoolsconfigure脚本的目录
#中运行该脚本。一旦你运行这个,
#你可以使用make和sudo make install来构建库。
#使用/opt/iphone-3.1/的安装前缀。


未设置CPATH
未设置C_INCLUDE_PATH
未设置CPLUS_INCLUDE_PATH
未设置OBJC_INCLUDE_PATH
未设置LIBS
未设置DYLD_FALLBACK_LIBRARY_PATH
未设置DYLD_FALLBACK_FRAMEWORK_PATH
$ b $ export BUILD_DARWIN_VER =`uname -r`
export SDKVER =3.1
export DEVROOT =/ Developer / Platforms / iPhoneOS.platform / Developer
导出SDKROOT =$ DEVROOT / SDKs / iPhoneOS $ SDKVER.sdk
导出PKG_CONFIG_PATH = / Developer / Platforms / iPhoneOS.platform / Developer / SDKs / iPhoneOS $ SDKVER.sdk / usr / lib / pkgconfig:/ Developer /平台/ iPhoneOS.platform / Developer / usr / lib / pkgconfig:/ opt / iphone- $ SDKVER / lib / pkgconfig:/ usr / local / iphone- $ SDKVER / lib / pkgconfig
export 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 $ DEVROO T / 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
导出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
导出LD =$ DEVROOT / usr / bin / ld
export STRIP =$ DEVROOT / usr / bin / strip

if [! \(-d$ DEVROOT\)];然后
echoiPhone SDK找不到,Folder \$ DEVROOT \不存在。
出口1
fi

if [! \(-d$ SDKROOT\)];那么
echoiPhone SDK找不到,Folder \$ SDKROOT \不存在。
exit 1
fi

./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 $ @

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



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

解决方案

以下变量需要设置:


  • 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 =是

  • ac_cv_sizeof_struct_iovec =8 b $ b
  • apr_cv_mutex_recursive =yes
    使用以下更新的iphone3.1-configure脚本来配置程序:

     
    #! / bin / bash


    #程序:iphone3.1-configure
    #作者:Michael Aaron Safyan(michaelsafyan@gmail.com)
    #简介:
    #此程序运行由
    #GNU Autotools生成的configure脚本,以便为iPhone 3.1 SDK交叉编译第三方库
    #。在包含autotoolsconfigure脚本的目录
    #中运行该脚本。一旦你运行这个,
    #你可以使用make和sudo make install来构建库。
    #使用/opt/iphone-3.1/的安装前缀。


    未设置CPATH
    未设置C_INCLUDE_PATH
    未设置CPLUS_INCLUDE_PATH
    未设置OBJC_INCLUDE_PATH
    未设置LIBS
    未设置DYLD_FALLBACK_LIBRARY_PATH
    未设置DYLD_FALLBACK_FRAMEWORK_PATH
    $ b $ export BUILD_DARWIN_VER =`uname -r`
    export SDKVER =3.1
    export DEVROOT =/ Developer / Platforms / iPhoneOS.platform / Developer
    导出SDKROOT =$ DEVROOT / SDKs / iPhoneOS $ SDKVER.sdk
    导出PKG_CONFIG_PATH = / Developer / Platforms / iPhoneOS.platform / Developer / SDKs / iPhoneOS $ SDKVER.sdk / usr / lib / pkgconfig:/ Developer /平台/ iPhoneOS.platform / Developer / usr / lib / pkgconfig:/ opt / iphone- $ SDKVER / lib / pkgconfig:/ usr / local / iphone- $ SDKVER / lib / pkgconfig
    export 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 $ DEVROO T / 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
    导出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
    导出LD =$ DEVROOT / usr / bin / ld
    export STRIP =$ DEVROOT / usr / bin / strip

    if [! \(-d$ DEVROOT\)];然后
    echoiPhone SDK找不到,Folder \$ DEVROOT \不存在。
    出口1
    fi

    if [! \(-d$ SDKROOT\)];那么
    echoiPhone SDK找不到,Folder \$ SDKROOT \不存在。
    exit 1
    fi

    ./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。


    This is a followup to a previous question on cross-compiling for the iPhone:
    Cross-compile Autotools-based Libraries for Official iPhone SDK

    Basically, I am trying to compile the Apache Portable Runtime (APR) version 1.3.8 (latest) for the iPhone. I am currently running into the following error during the configuration step:

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

    I am invoking the "configure" script via "iphone3.1-configure --disable-dso --enable-threads", where "iphone3.1-configure" is the following script that I've cooked-up to invoke the "configure" script:

    #! /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 CPATH
    unset C_INCLUDE_PATH
    unset CPLUS_INCLUDE_PATH
    unset OBJC_INCLUDE_PATH
    unset LIBS
    unset DYLD_FALLBACK_LIBRARY_PATH
    unset DYLD_FALLBACK_FRAMEWORK_PATH
    
    export 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/pkgconfig
    export 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 1
    fi
    
    if [ ! \( -d "$SDKROOT" \) ] ; then
       echo "The iPhone SDK could not be found. Folder \"$SDKROOT\" does not exist."
       exit 1
    fi
    
    ./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 $@
    

    The error that configure is giving me is not the first time I have received a message along the lines of "cannot run test program while cross compiling". In fact, the "ac_cv_file__dev_zero=no" and "ac_cv_func_setpgrp_void=yes" elements in the "iphone3.1-configure" script cause two similarly failing tests to be bypassed. The problem I am having is that I do not know how to bypass this check -- that is, I don't know what variable(s) to set to bypass this test and any additional tests that try to run executables built for the target platform. I was able to bypass the earlier two similar tests simply because I was able to locate the workaround on Google... does anyone know what variables to set or another way to bypass this check?

    If anyone knows a way to suppress all tests that cannot be executed when cross-compiling, or if you just know how to suppress this specific check, I would be greatly appreciative. Thank you very much.

    解决方案

    The following variables need to be set:

    • 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"

    Use the following updated "iphone3.1-configure" script to configure the program:

    #! /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 CPATH
    unset C_INCLUDE_PATH
    unset CPLUS_INCLUDE_PATH
    unset OBJC_INCLUDE_PATH
    unset LIBS
    unset DYLD_FALLBACK_LIBRARY_PATH
    unset DYLD_FALLBACK_FRAMEWORK_PATH
    
    export 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/pkgconfig
    export 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 1
    fi
    
    if [ ! \( -d "$SDKROOT" \) ] ; then
       echo "The iPhone SDK could not be found. Folder \"$SDKROOT\" does not exist."
       exit 1
    fi
    
    ./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" $@
    
    

    Use "iphone3.1-configure --disable-dso --enable-threads && make", then "sudo make install".

    这篇关于将Apache便携式运行时交叉编译到iPhone的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

  • 查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆