2017-05-09 55 views
0

我試圖編譯完全單聲道運行在(根)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

不,複製該文件不正確。 –

回答

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