使用编译ICU臂的Linux androideabi-4.4.3Linux、ICU、androideabi

2023-09-05 00:25:41 作者:一万吨的少女心

我想交叉编译ICU静态库的使用Cygwin的Andr​​oid。到目前为止,我已经能够配置并在Cygwin / MSVC和Cygwin版本。我已经安装了android-NDK-R7,可以看到工具链目录下一个版本的GCC。有几个例子说明使用主机:臂EABI - 但这不是我的机器上present

I would like to cross-compile ICU static libs for Android using Cygwin. So far, I have been able to configure and make the Cygwin/MSVC and Cygwin versions. I have installed the android-ndk-r7 and can see a version of gcc in the toolchains directory. Several examples suggest using host:arm-eabi - but this is not present on my machine.

我抄的 MH-linux的的到的 MH-未知的中的 / ICU /来源/配置的,并运行以下命令:

I have copied mh-linux to mh-unknown in /icu/source/config and run the following:

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

我收到以下错误:

I get the following error:

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 \ gcc的工具链\ ARM-Linux的androideabi-4.4.3 \ prebuilt \ WINDOWS \臂的Linux androideabi \ BIN?我失去了一些设置或安装?我应该设置我的道路,使得第一的的gcc 的发现是一个在 ARM-Linux的androiedeabi 的?

I'm sure this is a "stupid" question, but how do I get the ICU configure script to point to the gcc under $NDK_ROOT\toolchains\arm-linux-androideabi-4.4.3\prebuilt\windows\arm-linux-androideabi\bin? Am I missing some setup or install? Should I be setting my PATH so that the first gcc found is the one in arm-linux-androiedeabi?

更新1。我只注意到,虽然 WINDOWS \手臂的Linux = androideabi \ BIN 的包含的的gcc 的 WINDOWS \斌的包含的 ARM-Linux的androideabi-GCC 的。我如何获得ICU打电话吗?

Update 1. I just noticed that while windows\arm-linux=androideabi\bin contains gcc, windows\bin contains arm-linux-androideabi-gcc. How do I get ICU to call this?

更新2。在史蒂芬R.卢米斯的建议下,我拿起了config.sub文件和更新的config.guess从

Update 2. On the suggestion of Steven R. Loomis, I picked up updates for config.sub and config.guess from

的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

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

放置的的Andr​​oid NDK-R7 /工具链/ ARM-Linux的androideabi-4.4.3 / prebuilt /窗/箱的到我的道路,并重新运行配置与--host =臂的Linux androideabi ...这个时候:

placed android-ndk-r7/toolchains/arm-linux-androideabi-4.4.3/prebuilt/windows/bin into my path, and re-ran configure with --host=arm-linux-androideabi... this time:

checking for arm-linux-androideabi-gcc... arm-linux-androideabi-gcc
checking whether the C compiler works... no

绝对接近。从config.log的详细的错误

Definitely closer. Detailed error from 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 /平台/ Android为8 /弓臂/ usr / lib目录,尽管这是在LDFLAGS。我也有一个在原来的LDFLAGS -L后额外的空间,但在取出这并没有帮助。

Update 3. The changes to config.sub and config.guess worked in that we are now using the right gcc compiler. The -lc failure comes from not being able to find libc.so (which is in android-ndk-r7/platforms/android-8/arch-arm/usr/lib" even though this is in the LDFLAGS. I did have an extra space after -L in the original LDFLAGS, but removing this did not help.

更新4。据的http://groups.google.com/group/android-ndk/browse_thread/thread/46295616a889bc12

窗户NDK工具链(谢天谢地)原产于窗口,所以它   犯规经过cygwin的转换层将转化   / cygdrive路径。

"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 /带D的所有实例:/。现在,C编译器的工作原理虽然它仍然不会使。怀疑ICU_CROSS_BUILD必须在ICU /源目录。

Update 5. Swapped all instances of /cygdrive/d/ with D:/. Now C compiler works though it still doesn't make. Suspect that ICU_CROSS_BUILD has to be in the icu/source directory.

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。我重新配置和rbuilt我Cygwin的文件夹中的ICU-cygwin的。去的身影,这时候icucross.mk在那里。配置成功!但是......

Update 6. I re-configured and rbuilt my Cygwin folder in icu-cygwin. Go figure, this time icucross.mk was there. Successful configuration! But...

更新7 *的请的*最终没有那么好。

Update 7 *Make* did not end up so well.

$ make
D:/Projects/__/External/SQLite/icu/source/config/mh-linux:41: *** target pattern contains no `%'.  Stop.

什么?!?!看来,现在我们又希望Cygwin的路径..:(

What?!?! It seems that now we want Cygwin paths again.. :(

更新8。改变了我的路径,以便HOST_ICU和ICU_CROSS_BUILD使用Cygwin的路径,但NDK_ROOT是Windows路径(由于Android NDK LD不能处理cygwin的路径)。

Update 8. Changed my paths so that HOST_ICU and ICU_CROSS_BUILD use Cygwin paths, but NDK_ROOT is Windows path (since Android NDK ld can't handle cygwin paths).

这个时候再而

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

似乎有什么已经发生的是,臂的Linux androideabi-gcc的需求Cygwin来进行,或者跨版本将无法正常工作。

Seems that what has to happen is that arm-linux-androideabi-gcc needs to be made for cygwin, or the cross-build will not work.

更新9 看来臂的Linux androideabi-GCC不支持Cygwin的路径 - 虽然ndk_build一样。然而,ICU设置为来电臂的Linux androideabi-gcc的,而制造需要Cygwin的路径。也许时间切换到OSX或Linux做到这一点。

Update 9. It seems that arm-linux-androideabi-gcc does not support cygwin paths - though ndk_build does. However, ICU is set to call arm-linux-androideabi-gcc while "make" requires cygwin paths. Maybe time to switch to OSX or Linux to do this.

更新10 - 仍然没有成功。 的Cygwin 的 - 显然,臂的Linux androideabi Crystax版本也不支持-L cygwin的路径。在Cygwin下尝试交叉编译会给-lc错误,因为它无法分析-L / cygdrive /天/ ...库路径。更改为D:/帮助,但后来做的原因失败,因为它是Cygwin的做

Update 10 - Still no success. Cygwin - Apparently the arm-linux-androideabi Crystax build also doesn't support cygwin paths in -L. Attempting to cross-compile under Cygwin will give the -lc error, since it cannot parse the -L/cygdrive/d/... path to the library. Changing to D:/ helps, but later causes make to fail since it is Cygwin make.

的Linux 的 - 如果在正常的NDK R7版本,配置将失败,并为wchar_t = 0的错误。该Crystax NDK版本将解决这个问题,并会失败抱怨uint64_t中在Android的SYS / type.h。请参阅Android的NDK ICU库。您可以强制其进行定义,它会导致另一个有关大小不匹配错误。

Linux - Using the normal NDK r7 build, configuration will fail with a wchar_t = 0 error. The Crystax NDK build will fix this, and make will fail complaining about uint64_t in Android's sys/type.h. See ICU library in Android NDK. You can force it to be defined and it will lead to yet another error about size mismatch.

OSX 的 - 可能是最成功,使用官方版本或Crystax构建编译,这直接导致了uint64_t中的bug。如果你砍它周围,它会导致你

OSX - Probably the most successful, compiling using the official build or the Crystax build, it leads directly to the uint64_t bug. If you hack around it, it will lead you to

icu/source/common/ustrenum.cpp:118: error: must #include <typeinfo> before using typeid

帮助!

推荐答案

00 下载Android NDK的 http://developer.android.com/tool​​s/sdk/ndk/index.html

00. Download android ndk http://developer.android.com/tools/sdk/ndk/index.html

例如安装D:\ Android的R9B

01 下载安装例如 D:\ MSYS MSys的的 http://www.mingw.org/wiki/MSYS 1.01

01. Download install example d:\msys MSys http://www.mingw.org/wiki/MSYS 1.01

02 下载GCC 3.8.1 W64 的http://的MinGW-W64。 sourceforge.net/ 例如安装 D:\ mingw32_64

02. Download gcc 3.8.1 w64 http://mingw-w64.sourceforge.net/ example install d:\mingw32_64

03 下载ICU versin 52.1 HTTP ://site.icu-project.org/download/52#TOC-ICU4C-Download

03. Download icu versin 52.1 http://site.icu-project.org/download/52#TOC-ICU4C-Download

04 摘录ICU源$ C ​​$ C到 D:\ ICU

04. Extract icu source code to d:\icu

05 输入 MSYS 使用导出PATH = / D / MSYS / 1.0 /斌:/ D / ming32_64 /的mingw32 /斌:$ PATH

06 CD / D / ICU;的mkdir的MinGW;的mkdir android的; CD的MinGW

这是遵循ICU的readme.html交叉编译步骤

this is follow icu readme.html cross compile steps

07 CD / D / ICU /明; ../源/ runConfigureICU MinGW的;使

没有问题,一切正常,并在 / D / ICU / MinGW的/ bin中生成跨工具后进行编译。

no problem,all is working and under /d/icu/mingw/bin generate tools for cross compile later.

08 CD / D / ICU /安卓

09 /d/android-ndk-r9b/build/tool​​s/make-standalone-toolchain.sh --platform = Android的9 --install-DIR = / D / androidgcc / - 工具链=臂的Linux androideabi-4.8

如果使用窗口7/8的64位增加额外的选项: - 系统= windowx86_64

if use window 7/8 64bit add additional options: --system=windowx86_64

10 导出 PATH 再次。 导出PATH = / D / MSYS / 1.0 /斌/:/ D / androidgcc /斌/:/ D / androidgcc / ARM-Linux的androideabi /斌/

该路径必须包含 ar.exe 执行关于创建库。

the path must include the ar.exe execute for create library.

11 创建共享库。

sh ../source/configure --host=armv6-google-linux --enable-shared=yes --disable-static -with-cross-build=/d/icu/mingw CC=arm-linux-androideabi-gcc CXX=arm-linux-androideabi-g++ AR=arm-linux-androideabi-ar --with-data-packaging=archive

12

所有成功