2014-05-09 90 views
0

我試圖打造爲GT-I9300 objdump的可執行文件。的Android NDK建立獨立的工具鏈ARM

我得到當我試圖使用的是Android NDK 在亞行外殼採用SU提供一個以下錯誤:

[email protected]:/data/local/tmp # ./arm-linux-androideabi-objdump      
sh: ./arm-linux-androideabi-objdump: not executable: magic 7F45 

根據this blog post的錯誤是由於不同的架構拋出該文件和設備。所以,我需要得到一個版本objdump的爲我設備

[email protected]:/ $ uname -a 
Linux localhost 3.0.64-CM #1 SMP PREEMPT Fri May 9 09:17:55 CEST 2014 armv7l GNU/Linux 

到目前爲止,我通過編譯它放在我的的Ubuntu通過以下方式得到了arm-linux-androideabi-objdump 12.10

[email protected]:~$ uname -a 
Linux ubuntu1210 3.11.0-20-generiC#35~precise1-Ubuntu SMP Fri May 2 21:32:55 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux 

我編譯獨立工具鏈,我用ARM作爲CPU:

[email protected]:~/Programs/android-ndk-r9d$ ./build/tools/make-standalone-toolchain.sh --platform=android-19 --install-dir=/home/someuser/my-android-toolchain --verbose 
Auto-config: --arch=arm 
Auto-config: --toolchain=arm-linux-androideabi-4.6 
Targetting CPU: arm 
Using GCC version: 4.6 
Copying prebuilt binaries... 
## COMMAND: copy_directory ./toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86_64 /tmp/ndk-someuser/tmp/build-3493/standalone/arm-linux-androideabi-4.6 
Copying directory: 
    from ./toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86_64 
    to /tmp/ndk-someuser/tmp/build-3493/standalone/arm-linux-androideabi-4.6 
Copying directory: 
    from ./prebuilt/linux-x86_64/include/python2.7 
    to /tmp/ndk-someuser/tmp/build-3493/standalone/arm-linux-androideabi-4.6/include/python2.7 
Copying directory: 
    from ./prebuilt/linux-x86_64/lib/python2.7 
    to /tmp/ndk-someuser/tmp/build-3493/standalone/arm-linux-androideabi-4.6/lib/python2.7 
Copying file: python python2 python2.7 
    from ./prebuilt/linux-x86_64/bin 
    to /tmp/ndk-someuser/tmp/build-3493/standalone/arm-linux-androideabi-4.6/bin 
Copying sysroot headers and libraries... 
## COMMAND: copy_directory_nolinks ./platforms/android-19/arch-arm/usr/include /tmp/ndk-someuser/tmp/build-3493/standalone/arm-linux-androideabi-4.6/sysroot/usr/include 
Copying directory (without symlinks): 
    from ./platforms/android-19/arch-arm/usr/include 
    to /tmp/ndk-someuser/tmp/build-3493/standalone/arm-linux-androideabi-4.6/sysroot/usr/include 
## COMMAND: copy_directory_nolinks ./platforms/android-19/arch-arm/usr/lib /tmp/ndk-someuser/tmp/build-3493/standalone/arm-linux-androideabi-4.6/sysroot/usr/lib 
Copying directory (without symlinks): 
    from ./platforms/android-19/arch-arm/usr/lib 
    to /tmp/ndk-someuser/tmp/build-3493/standalone/arm-linux-androideabi-4.6/sysroot/usr/lib 
Copying libstdc++ headers and libraries... 
Copying directory: 
    from ./sources/cxx-stl/gnu-libstdc++/4.6/include 
    to /tmp/ndk-someuser/tmp/build-3493/standalone/arm-linux-androideabi-4.6/include/c++/4.6 
Copying directory: 
    from ./sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi/include/bits 
    to /tmp/ndk-someuser/tmp/build-3493/standalone/arm-linux-androideabi-4.6/include/c++/4.6/arm-linux-androideabi//bits 
Copying file: libgnustl_shared.so 
    from ./sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi 
    to /tmp/ndk-someuser/tmp/build-3493/standalone/arm-linux-androideabi-4.6/arm-linux-androideabi/lib/ 
Copying file: libsupc++.a 
    from ./sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi 
    to /tmp/ndk-someuser/tmp/build-3493/standalone/arm-linux-androideabi-4.6/arm-linux-androideabi/lib/ 
Copying directory: 
    from ./sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi/include/bits 
    to /tmp/ndk-someuser/tmp/build-3493/standalone/arm-linux-androideabi-4.6/include/c++/4.6/arm-linux-androideabi//thumb/bits 
Copying file: libgnustl_shared.so 
    from ./sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi/thumb 
    to /tmp/ndk-someuser/tmp/build-3493/standalone/arm-linux-androideabi-4.6/arm-linux-androideabi/lib//thumb 
Copying file: libsupc++.a 
    from ./sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi/thumb 
    to /tmp/ndk-someuser/tmp/build-3493/standalone/arm-linux-androideabi-4.6/arm-linux-androideabi/lib//thumb 
Copying directory: 
    from ./sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi-v7a/include/bits 
    to /tmp/ndk-someuser/tmp/build-3493/standalone/arm-linux-androideabi-4.6/include/c++/4.6/arm-linux-androideabi/armv7-a/bits 
Copying file: libgnustl_shared.so 
    from ./sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi-v7a 
    to /tmp/ndk-someuser/tmp/build-3493/standalone/arm-linux-androideabi-4.6/arm-linux-androideabi/lib/armv7-a 
Copying file: libsupc++.a 
    from ./sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi-v7a 
    to /tmp/ndk-someuser/tmp/build-3493/standalone/arm-linux-androideabi-4.6/arm-linux-androideabi/lib/armv7-a 
Copying directory: 
    from ./sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi-v7a/include/bits 
    to /tmp/ndk-someuser/tmp/build-3493/standalone/arm-linux-androideabi-4.6/include/c++/4.6/arm-linux-androideabi/armv7-a/thumb/bits 
Copying file: libgnustl_shared.so 
    from ./sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi-v7a/thumb 
    to /tmp/ndk-someuser/tmp/build-3493/standalone/arm-linux-androideabi-4.6/arm-linux-androideabi/lib/armv7-a/thumb 
Copying file: libsupc++.a 
    from ./sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi-v7a/thumb 
    to /tmp/ndk-someuser/tmp/build-3493/standalone/arm-linux-androideabi-4.6/arm-linux-androideabi/lib/armv7-a/thumb 
Copying directory: 
    from ./sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi-v7a-hard/include/bits 
    to /tmp/ndk-someuser/tmp/build-3493/standalone/arm-linux-androideabi-4.6/include/c++/4.6/arm-linux-androideabi/armv7-a/hard/bits 
Copying file: libgnustl_shared.so 
    from ./sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi-v7a-hard/. 
    to /tmp/ndk-someuser/tmp/build-3493/standalone/arm-linux-androideabi-4.6/arm-linux-androideabi/lib/armv7-a/hard 
Copying file: libsupc++.a 
    from ./sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi-v7a-hard/. 
    to /tmp/ndk-someuser/tmp/build-3493/standalone/arm-linux-androideabi-4.6/arm-linux-androideabi/lib/armv7-a/hard 
Copying directory: 
    from ./sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi-v7a-hard/include/bits 
    to /tmp/ndk-someuser/tmp/build-3493/standalone/arm-linux-androideabi-4.6/include/c++/4.6/arm-linux-androideabi/armv7-a/thumb/hard/bits 
Copying file: libgnustl_shared.so 
    from ./sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi-v7a-hard/thumb 
    to /tmp/ndk-someuser/tmp/build-3493/standalone/arm-linux-androideabi-4.6/arm-linux-androideabi/lib/armv7-a/thumb/hard 
Copying file: libsupc++.a 
    from ./sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi-v7a-hard/thumb 
    to /tmp/ndk-someuser/tmp/build-3493/standalone/arm-linux-androideabi-4.6/arm-linux-androideabi/lib/armv7-a/thumb/hard 
Copying files to: /home/someuser/my-android-toolchain 
## COMMAND: copy_directory /tmp/ndk-someuser/tmp/build-3493/standalone/arm-linux-androideabi-4.6 /home/someuser/my-android-toolchain 
Copying directory: 
    from /tmp/ndk-someuser/tmp/build-3493/standalone/arm-linux-androideabi-4.6 
    to /home/someuser/my-android-toolchain 
Cleaning up... 
## COMMAND: rm -rf /tmp/ndk-someuser/tmp/build-3493/standalone/arm-linux-androideabi-4.6 
Done. 
[email protected]:~/Programs/android-ndk-r9d$ cd /home/someuser/my-android-toolchain/ 
[email protected]:~/my-android-toolchain$ cd bin/ 
[email protected]:~/my-android-toolchain/bin$ file arm-linux-androideabi-objdump 
arm-linux-androideabi-objdump: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.8, stripped 
[email protected]:~/my-android-toolchain/bin$ 

我得到的格式[R編譯:

[email protected]:~/my-android-toolchain/bin$ file arm-linux-androideabi-objdump 
    arm-linux-androideabi-objdump: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.8, stripped 

我的問題是:爲什麼不想要的格式產生的彙編arm-linux-androideabi-objdump,這樣我可以從設備亞行外殼執行呢?

回答

0

我認爲這是正常的。

的NDK的目標是產生一個交叉編譯工具鏈。因此,所有這些工具都是本地主機平臺(linux/x86-64),但是讀取並生成目標(android/arm)格式。

爲了讓您的目標平臺的可執行文件objdump的,你必須使用這些工具來編譯objdump的。