Note that there are some explanatory texts on larger screens.

plurals
  1. POBuilding a toolchain with cmake to cross-compile for android
    text
    copied!<pre><code>gcc (GCC) 4.8.1 android-ndk-r9 </code></pre> <p>Hello,</p> <p>My host machine is <code>Fedora 19</code> and I want to create a tool-chain for compiling programs to run on android, later I want to extend this for iOS.</p> <p>I get the following error:</p> <pre><code>Check for working C compiler: /opt/ndk/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86_64/bin/arm-linux-androideabi-gcc -- broken </code></pre> <p>I am not sure why I am getting this error, as everything has been installed. I have also installed <code>binutils-arm-linux-gnu</code>. However, this is my first time do this type of thing, so many I have got something mixed up.</p> <p>I am trying to create a toolchain file using cmake to croos-compile to run libraries on an android device.</p> <p>I have installed the android-ndk-r9 in the following location with the path to the compiler:</p> <pre><code>/opt/ndk/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86_64/bin arm-linux-androideabi-addr2line arm-linux-androideabi-ar arm-linux-androideabi-as arm-linux-androideabi-c++ arm-linux-androideabi-c++filt arm-linux-androideabi-cpp arm-linux-androideabi-elfedit arm-linux-androideabi-g++ arm-linux-androideabi-gcc arm-linux-androideabi-gcc-4.8 arm-linux-androideabi-gcc-ar arm-linux-androideabi-gcc-nm arm-linux-androideabi-gcc-ranlib arm-linux-androideabi-gcov arm-linux-androideabi-gdb arm-linux-androideabi-gprof arm-linux-androideabi-ld arm-linux-androideabi-ld.bfd arm-linux-androideabi-ld.gold arm-linux-androideabi-ld.mcld arm-linux-androideabi-nm arm-linux-androideabi-objcopy arm-linux-androideabi-objdump arm-linux-androideabi-ranlib arm-linux-androideabi-readelf arm-linux-androideabi-run arm-linux-androideabi-size arm-linux-androideabi-strings arm-linux-androideabi-strip </code></pre> <p>My cross-compile file is:</p> <pre><code>include(CMakeForceCompiler) set(toolchain_path /opt/ndk/toolchains) # Target system set(CMAKE_SYSTEM_NAME Linux) set(CMAKE_SYSTEM_PROCESSOR arm) set(CMAKE_SYSTEM_VERSION 1) # Compiler to build for the target set(CMAKE_C_COMPILER /opt/ndk/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86_64/bin/arm-linux-androideabi-gcc) set(CMAKE_FIND_ROOT_PATH /opt/ndk/toolchains) </code></pre> <p>I run this from my build/debug directory with my toolchain being in the root directory.</p> <pre><code>[ant@localhost debug]$ cmake -DCMAKE_TOOLCHAIN_FILE=arm-eabi-gcc.cmake ../.. </code></pre> <p>Output</p> <pre><code>-- The C compiler identification is GNU 4.8.0 -- Check for working C compiler: /opt/ndk/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86_64/bin/arm-linux-androideabi-gcc -- Check for working C compiler: /opt/ndk/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86_64/bin/arm-linux-androideabi-gcc -- broken CMake Error at /usr/share/cmake/Modules/CMakeTestCCompiler.cmake:61 (message): The C compiler "/opt/ndk/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86_64/bin/arm-linux-androideabi-gcc" is not able to compile a simple test program. It fails with the following output: Change Dir: /home/steve/mobile_progs/linux_pjsip/build/debug/CMakeFiles/CMakeTmp Run Build Command:/usr/bin/gmake "cmTryCompileExec379796592/fast" /usr/bin/gmake -f CMakeFiles/cmTryCompileExec379796592.dir/build.make CMakeFiles/cmTryCompileExec379796592.dir/build gmake[1]: Entering directory `/home/steve/mobile_progs/linux_pjsip/build/debug/CMakeFiles/CMakeTmp' /usr/bin/cmake -E cmake_progress_report /home/steve/mobile_progs/linux_pjsip/build/debug/CMakeFiles/CMakeTmp/CMakeFiles 1 Building C object CMakeFiles/cmTryCompileExec379796592.dir/testCCompiler.c.o /opt/ndk/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86_64/bin/arm-linux-androideabi-gcc -o CMakeFiles/cmTryCompileExec379796592.dir/testCCompiler.c.o -c /home/steve/mobile_progs/linux_pjsip/build/debug/CMakeFiles/CMakeTmp/testCCompiler.c Linking C executable cmTryCompileExec379796592 /usr/bin/cmake -E cmake_link_script CMakeFiles/cmTryCompileExec379796592.dir/link.txt --verbose=1 /opt/ndk/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86_64/bin/arm-linux-androideabi-gcc CMakeFiles/cmTryCompileExec379796592.dir/testCCompiler.c.o -o cmTryCompileExec379796592 -rdynamic /opt/android-ndk-r9/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.8/../../../../arm-linux-androideabi/bin/ld: error: cannot open crtbegin_dynamic.o: No such file or directory /opt/android-ndk-r9/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.8/../../../../arm-linux-androideabi/bin/ld: error: cannot open crtend_android.o: No such file or directory /opt/android-ndk-r9/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.8/../../../../arm-linux-androideabi/bin/ld: error: cannot find -lc /opt/android-ndk-r9/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.8/../../../../arm-linux-androideabi/bin/ld: error: cannot find -ldl collect2: error: ld returned 1 exit status gmake[1]: *** [cmTryCompileExec379796592] Error 1 gmake[1]: Leaving directory `/home/steve/mobile_progs/linux_pjsip/build/debug/CMakeFiles/CMakeTmp' gmake: *** [cmTryCompileExec379796592/fast] Error 2 CMake will not be able to correctly generate this project. Call Stack (most recent call first): CMakeLists.txt:4 (project) </code></pre> <p>Many thanks in advance,</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload