与Android NDK交叉编译全单声道

问题描述:

我试图编译完全单声道运行在(根)Android设备上。我需要这个,因为我想将应用程序从嵌入式Linux移植到Android。该软件目前嵌入式Linux设备上运行...我真的想重用的软件,因为它是无需重写它的部分......与Android NDK交叉编译全单声道

什么我迄今所做的:

-Installed在Linux的Debian

-Installed Android SDK中NDK作为http://developer.android.com/ndk/guides/index.html

-Downloaded的MONO压缩包(我已经尝试不同的版本4.6,4.8和5.0)

-run以下命令:

export CC=/home/alex/Android/mytoolchain/bin/arm-linux-androideabi-gcc 
export CXX=/home/alex/Android/mytoolchain/bin/arm-linux-androideabi-g++ 
export CPP=/home/alex/Android/mytoolchain/bin/arm-linux-androideabi-cpp 
export AR=/home/alex/Android/mytoolchain/bin/arm-linux-androideabi-ar 
export AS=/home/alex/Android/mytoolchain/bin/arm-linux-androideabi-as 
export ANDROID_STANDALONE_TOOLCHAIN=/home/alex/Android/mytoolchain 

./configure --prefix=/home/alex/Android/monobuild/ --with-sigaltstack=no --with-mcs-docs=no --disable-mcs-build --host=arm-linux-androideabi --target=arm-linux-androideabi --disable-nls --with-sysroot=/home/alex/Android/mytoolchain/sysroot/ --cache=/home/alex/Android/my.cache 

make 

--> 
CC libmonoruntimesgen_la-w32file-unix-glob.lo 
CC libmonoruntimesgen_la-w32error-unix.lo 

CC ../../support/libm/libmonoruntimesgen_la-complex.lo 
../../support/libm/complex.c:19:26: fatal error: math_private.h: No such file or Directory #include "math_private.h" 

compilation terminated. 
Makefile:4173: recipe for target '../../support/libm/libmonoruntimesgen_la-complex.lo' failed 
make[3]: *** [../../support/libm/libmonoruntimesgen_la-complex.lo] Error 1 
make[3]: Leaving directory '/home/alex/Android/mono-5.0.0/mono/metadata' 
Makefile:446: recipe for target 'all-recursive' failed 
make[2]: *** [all-recursive] Error 1 
make[2]: Leaving directory '/home/alex/Android/mono-5.0.0/mono' 
Makefile:522: recipe for target 'all-recursive' failed 
make[1]: *** [all-recursive] Error 1 
make[1]: Leaving directory '/home/alex/Android/mono-5.0.0' 
Makefile:451: recipe for target 'all' failed 
make: *** [all] Error 2 

在mono配置脚本中,我看到了很多关于Android的东西,所以我认为它必须可以交叉编译。谁知道有关错误的更多细节?

我可以从NDK目录复制文件math_private.h到单目录,但后来它打破在稍后阶段:

Making all in mini 
make[3]: Entering directory '/home/alex/Android/mono-4.8.1/mono/mini' 
make all-am 
make[4]: Entering directory '/home/alex/Android/mono-4.8.1/mono/mini' 
    CCLD  mono-sgen 
./.libs/libmonosgen-2.0.so: error: undefined reference to 'tkill' 
main.c:172: error: undefined reference to 'mono_dl_open' 
main.c:179: error: undefined reference to 'mono_loader_register_module' 
main.c:339: error: undefined reference to 'mono_build_date' 
collect2: error: ld returned 1 exit status 
Makefile:1468: recipe for target 'mono-sgen' failed 
make[4]: *** [mono-sgen] Error 1 
make[4]: Leaving directory '/home/alex/Android/mono-4.8.1/mono/mini' 
Makefile:1293: recipe for target 'all' failed 
make[3]: *** [all] Error 2 
make[3]: Leaving directory '/home/alex/Android/mono-4.8.1/mono/mini' 
Makefile:445: recipe for target 'all-recursive' failed 
make[2]: *** [all-recursive] Error 1 
make[2]: Leaving directory '/home/alex/Android/mono-4.8.1/mono' 
Makefile:525: recipe for target 'all-recursive' failed 
make[1]: *** [all-recursive] Error 1 
make[1]: Leaving directory '/home/alex/Android/mono-4.8.1' 
Makefile:454: recipe for target 'all' failed 
make: *** [all] Error 2 
+0

您正在构建的项目中是否有'math_private.h'部分?它不是NDK的一部分,我不相信它是任何C库公共接口的一部分。如果它是单声道的一部分,并没有包括在内,我怀疑他们的makefile有什么问题。你能够为你的主机构建相同的源代码吗(不交叉编译)? –

+0

我在NDK中找到了这个文件:./Sdk/ndk-bundle/sources/android/support/src/msun/math_private.h但我不确定是否只是复制文件是正确的。无论如何,如果我复制文件,那么后来我得到另一个错误: make [4]:进入目录'/home/alex/Android/mono-4.8.1/mono/mini' CCLD mono-sgen ./。 libs/libmonosgen-2.0.so:error:undefined reference to'tkill' main.c:172:error:未定义引用'mono_dl_open' main.c:179:错误:未定义引用'mono_loader_register_module' main.c :339:错误:未定义引用'mono_build_date' – Alex111

+0

不,复制该文件不正确。 –

保存自己的一些麻烦和使用standalone toolchain。它会照顾使用autoconf与NDK的头痛问题。

+0

谢谢 - 我已经试过了,上面的结果已经在独立工具链中: make-standalone-toolchain .sh --arch = arm-linux-androideabi-4.9 --platform = android-23 --install-dir =/home/alex/Android/mytoolchain – Alex111