2009-10-22 53 views
8

這是一個後續對交叉編譯爲iPhone前面的問題:
Cross-compile Autotools-based Libraries for Official iPhone SDK交叉編譯Apache便攜式運行於iPhone

基本上,我試圖編譯Apache可移植運行庫(APR)版本1.3.8(最新)爲iPhone。我目前遇到了以下錯誤的配置步驟過程:

 
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. 

我通過「iphone3.1-配置--disable-DSO --enable-線程」調用「configure」腳本,其中「iPhone3的.1配置」是,我已經熟了調用下面的腳本‘configure’腳本:

 
#! /bin/bash 

# 
# Program : iphone3.1-configure 
# Authors : Michael Aaron Safyan ([email protected]) 
# 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 [email protected] 

該配置是給我的錯誤不是我第一次收到的消息沿「交叉編譯時不能運行測試程序」的行。實際上,「iphone3.1-configure」腳本中的「ac_cv_file__dev_zero = no」和「ac_cv_func_setpgrp_void = yes」元素會導致繞過兩個類似的失敗測試。我遇到的問題是我不知道如何繞過此檢查 - 也就是說,我不知道要設置什麼變量來繞過此測試以及任何其他嘗試運行爲目標運行的可執行文件的測試平臺。我能夠繞過前兩個類似的測試,只是因爲我能夠在Google上找到解決方法......有人知道要設置什麼變量或以其他方式繞過此檢查嗎?

如果有人知道一種方法來抑制在交叉編譯時無法執行的所有測試,或者如果您只知道如何抑制此特定的檢查,我將非常感激。非常感謝你。

回答

9

下面的變量需要進行設置:

  • 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進行配置」 腳本配置程序:

 
#! /bin/bash 

# 
# Program : iphone3.1-configure 
# Authors : Michael Aaron Safyan ([email protected]) 
# 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" [email protected] 

使用「iphone3.1-配置--disable-DSO - -enable-threads & & make「,然後」sudo make install「。

+0

嗨,'交叉編譯爲iPhone的Apache便攜式Runtaime的鏈接'。被打破。 – Seunghoon 2011-06-27 02:13:37

+0

是的,我刪除了那個。 – 2011-06-27 02:57:51

+0

感謝您添加此答案。這讓我的生活更輕鬆,同時爲QNX平臺交叉構建APR。看起來像五年後,仍然需要相同的配置參數。 – MayaPosch 2014-11-07 10:33:48