5

バックグラウンド

私はiPhoneを含むいくつかの異なる電話を対象としたプログラムを書いています。プログラムは、いくつかのサードパーティライブラリに依存しています。iPhoneとiPhoneシミュレーター用にこれらのサードパーティライブラリをクロスコンパイルするのに問題があります。ライブラリには、Apache Portable RuntimeとGNUTLS、およびそれらの依存関係が含まれています。ビルドされたライブラリのプレフィックスを「/opt/iphone-3.1」、「/ opt / iphone-3.0」、「/ opt / iphone-2.2.1」、「/ opt/iphone-simulator-3.1」にします。 「」、「/ opt/iphone-simulator-3.0」。

クロスコンパイルプロセスを簡単に再現できるようにするために、ターゲットプラットフォームごとに「configure」スクリプトを呼び出すスクリプトを作成しています(「iphone3.1-configure」、「iphone3.0-configure」、「iphone2.2.1」)。 -configure "、" iphonesim3.1-configure "、および" iphonesim3.0-configure ")。これは私が問題を抱えているところです。

公式のXcode3.2+ iPhoneSDK3.1を搭載したMacOSX 10.6SnowLeopardコンピューターを使用しています。

状態

私は現在、次の「iphone3.1-configure」スクリプトを持っています。

#!/ bin / bash

#
#プログラム:iphone3.1-設定
#著者:マイケル・アーロン・サフィアン
#あらすじ:
#このプログラムは、によって生成された「構成」スクリプトを実行します
#サードパーティのライブラリをクロスコンパイルするためのGNU Autotools
#iPhone3.1SDKの場合。ディレクトリ内でこのスクリプトを実行する
#autotoolsの「configure」スクリプトが含まれています。実行すると、これ
#「make」と「sudomakeinstall」を使用してライブラリをビルドできます。
#「/ opt /iphone-3.1/」のインストールプレフィックスが使用されます。
#

CPATHの設定を解除
C_INCLUDE_PATHの設定を解除します
CPLUS_INCLUDE_PATHの設定を解除します
OBJC_INCLUDE_PATHの設定を解除します
未設定のLIBS
DYLD_FALLBACK_LIBRARY_PATHの設定を解除します
DYLD_FALLBACK_FRAMEWORK_PATHの設定を解除します

エクスポートBUILD_DARWIN_VER=`uname -r`
SDKVER="3.1"をエクスポートします
export DEVROOT = "/ Developer / Platforms / iPhoneOS.platform / Developer"
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
PREFIX = "/ opt / iphone-$SDKVER"をエクスポートします
AS = "$ DEVROOT / usr / bin/as"をエクスポートします
ASCPP = "$ DEVROOT / usr / bin/as"をエクスポートします
エクスポートAR="$ DEVROOT / usr / bin / ar"
RANLIB = "$ DEVROOT / usr / bin/ranlib"をエクスポートします
export CPPFLAGS = "-std = c99 -arch armv6 -pipe -no-cpp-precomp --sysroot ='$ SDKROOT' -isystem $ SDKROOT / usr / include -isystem $ DEVROOT / usr / include -isystem / opt / iphone- $ SDKVER / include -isystem / usr / local / iphone- $ SDKVER / include "
export CFLAGS = "-std = c99 -arch armv6 -pipe -no-cpp-precomp --sysroot ='$ SDKROOT' -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 / 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-4.2"をエクスポートします
エクスポートCC="$ DEVROOT / usr / bin / gcc-4.2"
CXX = "$ DEVROOT / usr / bin /g++-4.2"をエクスポートします
エクスポートLD="$ DEVROOT / usr / bin / ld"

もしも [ !\(-d "$ DEVROOT" \)]; それから
   echo"iPhoneSDKが見つかりませんでした。フォルダ\"$DEVROOT\"が存在しません。"
   出口1
fi

もしも [ !\(-d "$ SDKROOT" \)]; それから
   echo"iPhoneSDKが見つかりませんでした。フォルダ\"$SDKROOT\"は存在しません。"
   出口1
fi

./configure --prefix = "$ PREFIX" --build = "i386-apple-darwin $ BUILD_DARWIN_VER" --host = "arm-apple-darwin9" --enable-static --disable-shared $ @

「apr-1.3.8」フォルダで「iphone3.1-configure--disable-dso」を実行していて、次のようになっています。

ビルドシステムタイプを確認しています...i386-apple-darwin10.0.0
ホストシステムタイプをチェックしています...arm-apple-darwin9
ターゲットシステムタイプをチェックしています...arm-apple-darwin9
APRライブラリの構成
プラットフォーム:arm-apple-darwin9
動作していることを確認していますmkdir-p...はい
APRバージョン:1.3.8
選択したレイアウトを確認しています...4月
arm-apple-darwin9-gccをチェックしています.../Developer / Platforms / iPhoneOS.platform / Developer / usr / bin / gcc-4.2
Cコンパイラのデフォルトの出力ファイル名をチェックしています...a.out
Cコンパイラが機能するかどうかを確認しています...はい
クロスコンパイルしているかどうかを確認しています...はい
実行可能ファイルのサフィックスをチェックしています...
オブジェクトファイルのサフィックスをチェックしています...o
GNUCコンパイラを使用しているかどうかを確認しています...はい
/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc-4.2が-gを受け入れるかどうかを確認しています...はい
/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc-4.2オプションをチェックしてISOC89を受け入れます...サポートされていません
arm-apple-darwin9のAPRヒントファイルルールを適用する
  CPPFLAGSに「-DDARWIN」を追加
  CPPFLAGSに「-DSIGPROCMASK_SETS_THREAD_MASK」を追加
  apr_posixsem_is_globalを「yes」に設定する
  ac_cv_func_kqueueを「no」に設定する
  ac_cv_func_pollを「no」に設定する
(デフォルトはUNIXになります)
makeが$(MAKE)を設定するかどうかを確認しています...はい
Cプリプロセッサの実行方法を確認しています.../Developer / Platforms / iPhoneOS.platform / Developer / usr / bin / cpp-4.2
構成:エラー: `/Users/michaelsafyan/Downloads/apr-1.3.8':
configure:エラー:Cプリプロセッサ「/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/cpp-4.2」が健全性チェックに失敗する
詳細については、`config.log'を参照してください。

「config.log」の関連部分は次のとおりです。

configure:7710:Cプリプロセッサの実行方法を確認する
configure:7828:結果:/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/cpp-4.2
configure:7857:/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/cpp-4.2 -std = c99 -arch armv6 -pipe -no-cpp-precomp --sysroot ='/ Developer / Platforms / iPhoneOS.platform /Developer/SDKs/iPhoneOS3.1.sdk'-isystem /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.1.sdk/usr/include -isystem /Developer/Platforms/iPhoneOS.platform/Developer/usr/ include -isystem /opt/iphone-3.1/include -isystem /usr/local/iphone-3.1/include -DDARWIN -DSIGPROCMASK_SETS_THREAD_MASK conftest.c
cpp-4.2:'cc1'を実行しようとしてエラーが発生しました:execvp:そのようなファイルまたはディレクトリはありません
configure:7864:$?= 1
configure:失敗したプログラムは:
| /*confdefs.h。* /
| #define PACKAGE_NAME ""
| #define PACKAGE_TARNAME ""
| #define PACKAGE_VERSION ""
| #define PACKAGE_STRING ""
| #define PACKAGE_BUGREPORT ""
| /*confdefs.hを終了します。* /
| #ifdef __STDC__
| # 含む
| #そうしないと
| # 含む
| #endif
| 構文エラー
configure:7857:/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/cpp-4.2 -std = c99 -arch armv6 -pipe -no-cpp-precomp --sysroot ='/ Developer / Platforms / iPhoneOS.platform /Developer/SDKs/iPhoneOS3.1.sdk'-isystem /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.1.sdk/usr/include -isystem /Developer/Platforms/iPhoneOS.platform/Developer/usr/ include -isystem /opt/iphone-3.1/include -isystem /usr/local/iphone-3.1/include -DDARWIN -DSIGPROCMASK_SETS_THREAD_MASK conftest.c
cpp-4.2:'cc1'を実行しようとしてエラーが発生しました:execvp:そのようなファイルまたはディレクトリはありません
configure:7864:$?= 1
configure:失敗したプログラムは:
| /*confdefs.h。* /
| #define PACKAGE_NAME ""
| #define PACKAGE_TARNAME ""
| #define PACKAGE_VERSION ""
| #define PACKAGE_STRING ""
| #define PACKAGE_BUGREPORT ""
| /*confdefs.hを終了します。* /
| #ifdef __STDC__
| # 含む
| #そうしないと
| # 含む
| #endif
| 構文エラー
configure:7926:エラー: `/ Users / michaelsafyan / Downloads / apr-1.3.8'内:
configure:7929:エラー:Cプリプロセッサ「/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/cpp-4.2」が健全性チェックに失敗します
詳細については、`config.log'を参照してください。

質問

「iphone3.1-configure」スクリプトを修正するにはどうすればよいですか?ありがとう。

4

2 に答える 2

3

Ok。これはまだ構築されていませんが、さらに進んでいます...

  1. Cプリプロセッサはアーキテクチャを採用できません。
  2. Cプリプロセッサは--sysrootまたは-isystemを受け入れません(「-I」を使用するだけです)。
  3. 「cpp-4.2」の代わりに「cpp」を使用します(4.2バージョンには欠陥があり、プリプロセッサであるため、使用するバージョンは関係ありません。したがって、機能するバージョンを使用することをお勧めします)。

iphone3.1-configureスクリプトの更新バージョンは次のとおりです。

#!/ bin / bash

#
#プログラム:iphone3.1-設定
#著者:Michael Aaron Safyan(michaelsafyan@gmail.com)
#あらすじ:
#このプログラムは、によって生成された「構成」スクリプトを実行します
#サードパーティのライブラリをクロスコンパイルするためのGNU Autotools
#iPhone3.1SDKの場合。ディレクトリ内でこのスクリプトを実行する
#autotoolsの「configure」スクリプトが含まれています。これを実行すると、
#「make」と「sudomakeinstall」を使用してライブラリをビルドできます。
#「/ opt /iphone-3.1/」のインストールプレフィックスが使用されます。
#

CPATHの設定を解除
C_INCLUDE_PATHの設定を解除します
CPLUS_INCLUDE_PATHの設定を解除します
OBJC_INCLUDE_PATHの設定を解除します
未設定のLIBS
DYLD_FALLBACK_LIBRARY_PATHの設定を解除します
DYLD_FALLBACK_FRAMEWORK_PATHの設定を解除します

エクスポートBUILD_DARWIN_VER=`uname -r`
SDKVER="3.1"をエクスポートします
export DEVROOT = "/ Developer / Platforms / iPhoneOS.platform / Developer"
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
PREFIX = "/ opt / iphone-$SDKVER"をエクスポートします
AS = "$ DEVROOT / usr / bin/as"をエクスポートします
ASCPP = "$ DEVROOT / usr / bin/as"をエクスポートします
エクスポートAR="$ DEVROOT / usr / bin / ar"
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 "
CPP = "$ DEVROOT / usr / bin/cpp"をエクスポートします
CXXCPP = "$ DEVROOT / usr / bin/cpp"をエクスポートします
エクスポートCC="$ DEVROOT / usr / bin / gcc-4.2"
CXX = "$ DEVROOT / usr / bin /g++-4.2"をエクスポートします
エクスポートLD="$ DEVROOT / usr / bin / ld"
STRIP = "$ DEVROOT / usr / bin/strip"をエクスポートします

もしも [ !\(-d "$ DEVROOT" \)]; それから
   echo"iPhoneSDKが見つかりませんでした。フォルダ\"$DEVROOT\"が存在しません。"
   出口1
fi

もしも [ !\(-d "$ SDKROOT" \)]; それから
   echo"iPhoneSDKが見つかりませんでした。フォルダ\"$SDKROOT\"は存在しません。"
   出口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 =はい$@

また、「-disable-dso」だけでなく、「-enable-threads--disable-dso」を使用して呼び出しています。これはまだ機能しません...次のように失敗します:

pthread.hでPTHREAD_PROCESS_SHAREDをチェックしています...はい
pthread_mutexattr_setpsharedをチェックしています...はい
動作中のPROCESS_SHAREDロックをチェックしています...configure:error:in `/Users/michaelsafyan/Downloads/apr-1.3.8':
configure:エラー:クロスコンパイル中にテストプログラムを実行できません
詳細については、`config.log'を参照してください。

ただし、これはAPRの特定のテストで問題になる可能性があります。リンクにフォローアップの質問を投稿しています。

編集

iPhone用のApachePortableRuntimeのクロスコンパイルでより完全なソリューションを提供しました。

于 2009-10-22T00:18:00.363 に答える
1

スクリプトをありがとうございます。それは私を大いに助けました。armビルドしたlibのアーキテクチャがそうではないように、いくつかの変更を加える必要がありましたがi386

まず、コンパイラを変更する必要がありました。

# export CC="$DEVROOT/usr/bin/gcc-4.2"
export CC="$DEVROOT/usr/bin/arm-apple-darwin10-gcc-4.2.1"

-arch armv6次に、このコンパイラが理解できないため、オプションを削除しました。CFLAGS, CXXFLAGS, LDFLAGS

SDKVERとgccのバージョンを更新し、機能しました。

于 2010-10-08T08:49:42.967 に答える