title: Android ndk building standalone toolchain for ARM
body: <p>I am trying to build objdump executable for the GT-i9300.</p>
  
  <p>I get the following error when I am trying to use the one provided by the Android NDK
  on the adb shell with su:</p>
  
  <pre><code>root@m0:/data/local/tmp # ./arm-linux-androideabi-objdump                      
  sh: ./arm-linux-androideabi-objdump: not executable: magic 7F45
  </code></pre>
  
  <p>According to <a href="http://www.symantec.com/connect/blogs/monitoring-android-network-traffic-part-i-installing-toolchain" rel="nofollow">this blog post</a> that errors is thrown because of the different architectures of the the file and the device. So I need to get a version of objdump for my <strong>device</strong>:</p>
  
  <pre><code>shell@m0:/ $ uname -a
  Linux localhost 3.0.64-CM #1 SMP PREEMPT Fri May 9 09:17:55 CEST 2014 armv7l GNU/Linux   
  </code></pre>
  
  <p>So far I got the <code>arm-linux-androideabi-objdump</code> by compiling it the following way on my <strong>Ubuntu 12.10</strong></p>
  
  <pre><code>someuser@ubuntu1210:~$ 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
  </code></pre>
  
  <p>I compiled the standalone toolchain, I used ARM as a CPU:</p>
  
  <pre><code>someuser@ubuntu1210:~/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.
  someuser@ubuntu1210:~/Programs/android-ndk-r9d$ cd /home/someuser/my-android-toolchain/
  someuser@ubuntu1210:~/my-android-toolchain$ cd bin/
  someuser@ubuntu1210:~/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
  someuser@ubuntu1210:~/my-android-toolchain/bin$ 
  </code></pre>
  
  <p>The format I get after compiling:</p>
  
  <pre><code>someuser@ubuntu1210:~/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
  </code></pre>
  
  <p>My question is: Why is the resulting <code>arm-linux-androideabi-objdump</code> of the compilation not in the desired format so that I can execute it from the device adb shell?</p>