我想使用Cygwin爲Android交叉編譯ICU靜態庫。到目前爲止,我已經能夠配置和製作Cygwin/MSVC和Cygwin版本。我已經安裝了android-ndk-r7,並且可以在工具鏈目錄中看到gcc的一個版本。幾個例子表明使用主機:arm-eabi - 但這並不存在於我的機器上。使用arm-linux-androideabi-4.4.3編譯ICU
我抄MH-linux的到MH-不明/ICU /源 /配置和運行以下命令:
export HOST_ICU=/cygdrive/d/__/External/SQLite/icu
export ICU_CROSS_BUILD=/cygdrive/d/__/External/SQLite/icu-cygwin
export NDK_ROOT=/cygdrive/d/__/android-ndk-r7
export CPPFLAGS="-I$NDK_ROOT/platforms/android-8/arch-arm/usr/include/ -O3 -fno-short-wchar -DU_USING_ICU_NAMESPACE=0 -DU_GNUC_UTF16_STRING=0 -fno-short-enums -nostdlib"
export CXXFLAGS="-I$NDK_ROOT/platforms/android-8/arch-arm/usr/include/ -O3 -fno-short-wchar -DU_USING_ICU_NAMESPACE=0 -DU_GNUC_UTF16_STRING=0 -fno-short-enums -nostdlib"
export CFLAGS="-I$NDK_ROOT/platforms/android-8/arch-arm/usr/include/ -O3 -fno-short-wchar -DU_USING_ICU_NAMESPACE=0 -DU_GNUC_UTF16_STRING=0 -fno-short-enums -nostdlib"
export LDFLAGS="-lc -Wl,-rpath-link=$NDK_ROOT/platforms/android-8/arch-arm/usr/lib/ -L $NDK_ROOT/platforms/android-8/arch-arm/usr/lib/"
$HOST_ICU/source/configure --with-cross-build=$ICU_CROSS_BUILD --enable-extras=no --enable-strict=no --enable-static --enable-shared=no --enable-tests=no --enable-samples=no --enable-dyload=no --enable-tools=no --host=arm-eabi --with-data-packaging=archive
我收到以下錯誤:
checking for ICU version numbers... release 4.8.1.1, library 48.1.1, unicode version 6.0
checking build system type... i686-pc-cygwin
checking host system type... arm-unknown-eabi
checking target system type... arm-unknown-eabi
checking whether to build debug libraries... no
checking whether to build release libraries... yes
checking for arm-eabi-gcc... no
checking for gcc... gcc
checking whether the C compiler works... no
configure: error: in `/cygdrive/d/Projects/__/External/SQLite/icu-android':
configure: error: C compiler cannot create executables
See `config.log' for more details
我敢肯定這是一個「愚蠢的」問題,但是如何讓ICU配置腳本指向$ NDK_ROOT \ toolchains \ arm-linux-androideabi-4.4.3 \預建\ WINDOWS \ ARM-Linux的androideabi \ BIN?我是否缺少一些設置或安裝?我應該設置我的路徑,以便發現第一個gcc是arm-linux-androiedeabi?
更新1我剛纔注意到,雖然窗戶\ ARM-Linux的= androideabi \ BIN包含GCC,WINDOWS \斌包含ARM-Linux的androideabi-GCC。我如何讓ICU調用它?
更新2.在史蒂芬R.盧米斯的建議下,我拿起了config.sub和更新的config.guess從
http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
放置的Android NDK-R7 /工具鏈/掰Linux的androideabi-4.4.3 /預建/窗/ bin中到我的道路,並重新運行配置與主機=在arm-linux的-androideabi ......這個時候:
checking for arm-linux-androideabi-gcc... arm-linux-androideabi-gcc
checking whether the C compiler works... no
肯定密切。從的config.log
gcc version 4.4.3 (GCC)
configure:3125: $? = 0
configure:3114: arm-linux-androideabi-gcc -V >&5
arm-linux-androideabi-gcc.exe: '-V' option must have argument
configure:3125: $? = 1
configure:3114: arm-linux-androideabi-gcc -qversion >&5
arm-linux-androideabi-gcc.exe: unrecognized option '-qversion'
arm-linux-androideabi-gcc.exe: no input files
configure:3125: $? = 1
configure:3145: checking whether the C compiler works
configure:3167: arm-linux-androideabi-gcc -I/cygdrive/d/Projects/android-ndk-r7/platforms/android-8/arch-arm/usr/include
/-O3 -fno-short-wchar -DU_USING_ICU_NAMESPACE=0 -DU_GNUC_UTF16_STRING=0 -fno-short-enums -nostdlib -I/cygdrive/d/Projec
ts/android-ndk-r7/platforms/android-8/arch-arm/usr/include/ -O3 -fno-short-wchar -DU_USING_ICU_NAMESPACE=0 -DU_GNUC_UTF1
6_STRING=0 -fno-short-enums -nostdlib -lc -Wl,-rpath-link=/cygdrive/d/Projects/android-ndk-r7/platforms/android-8/arch-a
rm/usr/lib/ -L /cygdrive/d/Projects/android-ndk-r7/platforms/android-8/arch-arm/usr/lib/ conftest.c >&5
D:/Projects/android-ndk-r7/toolchains/arm-linux-androideabi-4.4.3/prebuilt/windows/bin/../lib/gcc/arm-linux-androideabi/
4.4.3/../../../../arm-linux-androideabi/bin/ld.exe: cannot find -lc
collect2: ld returned 1 exit status
configure:3171: $? = 1
configure:3209: result: no
configure: failed program was:
| /* confdefs.h */
| #define PACKAGE_NAME ""
| #define PACKAGE_TARNAME ""
| #define PACKAGE_VERSION ""
| #define PACKAGE_STRING ""
| #define PACKAGE_BUGREPORT ""
| #define PACKAGE_URL ""
| /* end confdefs.h. */
|
| int
| main()
| {
|
| ;
| return 0;
| }
configure:3214: error: in `/cygdrive/d/Projects/__/External/SQLITE/icu-android':
configure:3216: error: C compiler cannot create executables
See `config.log' for more details
更新詳細的錯誤3.的變化config.sub和的config.guess曾在我們現在使用的是正確的gcc編譯器。 -lc失敗來自於無法找到libc.so(這是在android-ndk-r7/platforms/android-8/arch-arm/usr/lib中),即使這是在LDFLAGS中。 -L後額外的空間在原有的LDFLAGS,但除去這並沒有幫助。
更新4根據舊的帖子在http://groups.google.com/group/android-ndk/browse_thread/thread/46295616a889bc12
"The windows ndk toolchain is (thankfully) native to windows, so it doesnt go through the cygwin translation layer which would translate /cygdrive paths."
更新5被交換的/所有實例cygdrive/d/with D:/。現在C編譯器仍然可以工作,但仍然無法工作。懷疑ICU_CROSS_BUILD必須位於icu/source目錄中。
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... yes
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether arm-linux-androideabi-gcc accepts -g... yes
checking for arm-linux-androideabi-gcc option to accept ISO C89... none needed
checking for arm-linux-androideabi-g++... arm-linux-androideabi-g++
checking whether we are using the GNU C++ compiler... yes
checking whether arm-linux-androideabi-g++ accepts -g... yes
checking how to run the C preprocessor... arm-linux-androideabi-gcc -E
checking for a BSD-compatible install... /usr/bin/install -c
checking for gmake... /usr/bin/gmake
configure: error: D:/Projects/__/External/SQLite/icu-cygwin/config/icucross.mk not found. Please build ICU in
D:/Projects/__/External/SQLite/icu-cygwin first.
更新6。我重新配置並在icu-cygwin中建立我的Cygwin文件夾。去圖,這次icucross.mk在那裏。配置成功!但是...
更新7使並沒有結束如此好。
$ make
D:/Projects/__/External/SQLite/icu/source/config/mh-linux:41: *** target pattern contains no `%'. Stop.
什麼?!?!看來,現在我們要再次Cygwin的路徑.. :(
更新8改變了我的路徑,以便HOST_ICU和ICU_CROSS_BUILD使用Cygwin的路徑,但NDK_ROOT是Windows路徑(由於Android NDK LD不能處理的cygwin路徑)。
這段時間進一步不過
arm-linux-androideabi-gcc.exe: /cygdrive/d/Projects/__/External/SQLit e/icu/source/stubdata/stubdata.c: No such file or directory
arm-linux-androideabi-gcc.exe: no input files
似乎有什麼有發生的是,ARM-Linux的androideabi-GCC需求Cygwin來進行,或跨版本將無法正常工作。
更新9.似乎arm-linux-androideabi-gcc不支持cygwin路徑 - 儘管ndk_build會。但是,ICU設置爲調用arm-linux-androideabi-gcc,而「make」則需要cygwin路徑。也許有時間切換到OSX或Linux來做到這一點。
更新10 - 仍然沒有成功。 Cygwin - 顯然arm-linux-androideabi Crystax版本也不支持-L中的cygwin路徑。試圖在Cygwin下交叉編譯會出現-lc錯誤,因爲它無法解析庫的-L/cygdrive/d/...路徑。改爲D:/有幫助,但後來會導致失敗,因爲它是Cygwin製作的。
Linux - 使用正常的NDK r7版本,配置將失敗,並出現wchar_t = 0錯誤。 Crystax NDK內部版本將解決這個問題,並使得在Android的sys/type.h中uint64_t無法投訴。見ICU library in Android NDK。你可以強制它被定義,它會導致關於尺寸不匹配的另一個錯誤。
OSX - 可能是最成功的,使用官方版本或Crystax版本編譯,它直接導致uint64_t錯誤。如果你破解它,它會導致你
icu/source/common/ustrenum.cpp:118: error: must #include <typeinfo> before using typeid
幫助!
我在這裏採取了戳。你錯過了一個圖書館。看起來像你的C編譯器無法爲目標架構構建。過時的構建腳本等 – Vangel 2012-02-09 22:07:28
@Vangel在這一點上,正是這樣。 arm-linux-androideabi-gcc正在尋找-lc(libc.so),它位於/ cygdrive/d/Projects/android-ndk-r7/platforms/android-8/arch-arm/lib /中-L)但以某種方式無法找到它。試圖在腳本之外複製,但不知道在哪裏可以找到conftest.c – tofutim 2012-02-09 22:30:56
難道是arm-linux-androideabi-gcc無法理解cygwin路徑嗎? – tofutim 2012-02-09 22:35:10