使用Android NDK交叉编译全单声道

时间:2017-05-09 06:24:59

标签: c# android-ndk mono

我正在尝试编译完整的单声道以在(root)Android设备上运行。我需要这个,因为我想将一个应用程序从嵌入式Linux移植到Android。该软件目前在嵌入式Linux设备上运行......我真的想重复使用该软件而不重写它的一部分......

到目前为止我做了什么:

- 安装Linux Debian

- 从http://developer.android.com/ndk/guides/index.html

开始安装Android SDK NDK

- 下载了MONO Tarball(我已尝试过不同的版本4.6,4.8和5.0)

- 运行以下命令:

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

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

我可以将文件math_private.h从NDK目录复制到单声道目录,但之后它会中断:

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

1 个答案:

答案 0 :(得分:0)

为自己省点麻烦并使用standalone toolchain。它会照顾到使用NDK的autoconf给你带来的麻烦。