Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt Creator and other tools
  4. Qt creator has issues while building android for x86 using Cmake

Qt creator has issues while building android for x86 using Cmake

Scheduled Pinned Locked Moved Unsolved Qt Creator and other tools
androidcmakegccandroid studio
3 Posts 2 Posters 2.4k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    ankitdg
    wrote on 24 Jan 2018, 13:14 last edited by
    #1

    Hello,

    I tried to build a simple app from http://doc.qt.io/qtcreator/qtcreator-accelbubble-example.html to build on my Linux virtual machine. The program compiles perfect with the desktop build but has an issue when building for android.
    The error i get is as follows:

    -- Check for working CXX compiler: /home/user/android-ndk-r16b/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/arm-linux-androideabi-g++
    -- Check for working CXX compiler: /home/user/android-ndk-r16b/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/arm-linux-androideabi-g++ -- broken
    CMake Error at /home/user/Android/Sdk/cmake/3.6.4111459/share/cmake-3.6/Modules/CMakeTestCXXCompiler.cmake:54 (message):
      The C++ compiler
      "/home/user/android-ndk-r16b/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/arm-linux-androideabi-g++"
      is not able to compile a simple test program.
    
      It fails with the following output:
    
       Change Dir: /home/user/testProjects/build-bubbleWork-Android_for_x86_GCC_4_9_Qt_5_9_3_for_Android_x86-newBuild/CMakeFiles/CMakeTmp
    

    I have installed all the necessary tools from android studio and linked my android SDK and NDK (SDK Version: 26.1.1, NDK Version: 16.1.4479499) to my Qt creator.

    The java settings: java-1.8.0-openjdk-amd64

    the issue I feel is the default android GCC compilers.

    The compiler i am currently using for C and CXX is: toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/arm-linux-androideabi-g++
    I did use different compilers but all gave me the same error.

    What can be the issue for this? Should I use Clang instead of GCC? Do I need to create a platform-independent build tool?

    J 1 Reply Last reply 25 Jan 2018, 05:47
    0
    • A ankitdg
      24 Jan 2018, 13:14

      Hello,

      I tried to build a simple app from http://doc.qt.io/qtcreator/qtcreator-accelbubble-example.html to build on my Linux virtual machine. The program compiles perfect with the desktop build but has an issue when building for android.
      The error i get is as follows:

      -- Check for working CXX compiler: /home/user/android-ndk-r16b/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/arm-linux-androideabi-g++
      -- Check for working CXX compiler: /home/user/android-ndk-r16b/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/arm-linux-androideabi-g++ -- broken
      CMake Error at /home/user/Android/Sdk/cmake/3.6.4111459/share/cmake-3.6/Modules/CMakeTestCXXCompiler.cmake:54 (message):
        The C++ compiler
        "/home/user/android-ndk-r16b/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/arm-linux-androideabi-g++"
        is not able to compile a simple test program.
      
        It fails with the following output:
      
         Change Dir: /home/user/testProjects/build-bubbleWork-Android_for_x86_GCC_4_9_Qt_5_9_3_for_Android_x86-newBuild/CMakeFiles/CMakeTmp
      

      I have installed all the necessary tools from android studio and linked my android SDK and NDK (SDK Version: 26.1.1, NDK Version: 16.1.4479499) to my Qt creator.

      The java settings: java-1.8.0-openjdk-amd64

      the issue I feel is the default android GCC compilers.

      The compiler i am currently using for C and CXX is: toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/arm-linux-androideabi-g++
      I did use different compilers but all gave me the same error.

      What can be the issue for this? Should I use Clang instead of GCC? Do I need to create a platform-independent build tool?

      J Offline
      J Offline
      jsulm
      Lifetime Qt Champion
      wrote on 25 Jan 2018, 05:47 last edited by
      #2

      @ankitdg In the title you write you're building for x86, but you're using compiler for ARM.
      Also, you should check the CMake log to see what exactly fails.

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      1
      • A Offline
        A Offline
        ankitdg
        wrote on 25 Jan 2018, 10:47 last edited by ankitdg
        #3

        Hello,

        Sorry for the novice mistake! I was trying to use different compilers in the NDK but i end up with the same error. The code i uploaded before was from one of my trials.
        I did change my configuration to x86 but i still get the same error. Since this is my 1st time for android, I may have missed something.

        The error stays the same. The 1st few line of my cmake error log states:

        Compiling the CXX compiler identification source file "CMakeCXXCompilerId.cpp" failed.
        Compiler: /home/user/android-ndk-r16b/toolchains/x86-4.9/prebuilt/linux-x86_64/bin/i686-linux-android-g++ 
        Build flags: 
        Id flags: 
        The output was:
        1
        /home/user/android-ndk-r16b/toolchains/x86-4.9/prebuilt/linux-x86_64/bin/../lib/gcc/i686-linux-android/4.9.x/../../../../i686-linux-android/bin/ld: error: cannot open crtbegin_dynamic.o: No such file or directory
        /home/user/android-ndk-r16b/toolchains/x86-4.9/prebuilt/linux-x86_64/bin/../lib/gcc/i686-linux-android/4.9.x/../../../../i686-linux-android/bin/ld: error: cannot open crtend_android.o: No such file or directory
        /home/user/android-ndk-r16b/toolchains/x86-4.9/prebuilt/linux-x86_64/bin/../lib/gcc/i686-linux-android/4.9.x/../../../../i686-linux-android/bin/ld: error: cannot find -lstdc++
        /home/user/android-ndk-r16b/toolchains/x86-4.9/prebuilt/linux-x86_64/bin/../lib/gcc/i686-linux-android/4.9.x/../../../../i686-linux-android/bin/ld: error: cannot find -lm
        /home/user/android-ndk-r16b/toolchains/x86-4.9/prebuilt/linux-x86_64/bin/../lib/gcc/i686-linux-android/4.9.x/../../../../i686-linux-android/bin/ld: error: cannot find -lc
        /home/user/android-ndk-r16b/toolchains/x86-4.9/prebuilt/linux-x86_64/bin/../lib/gcc/i686-linux-android/4.9.x/../../../../i686-linux-android/bin/ld: error: cannot find -ldl
        collect2: error: ld returned 1 exit status
        
        

        and the cmake output states

        -- The CXX compiler identification is GNU 4.9.0
        -- Check for working CXX compiler: /home/user/android-ndk-r16b/toolchains/x86-4.9/prebuilt/linux-x86_64/bin/i686-linux-android-gcc
        -- Check for working CXX compiler: /home/user/android-ndk-r16b/toolchains/x86-4.9/prebuilt/linux-x86_64/bin/i686-linux-android-gcc -- broken
        CMake Error at /usr/share/cmake-3.5/Modules/CMakeTestCXXCompiler.cmake:54 (message):
          The C++ compiler
          "/home/user/android-ndk-r16b/toolchains/x86-4.9/prebuilt/linux-x86_64/bin/i686-linux-android-gcc"
          is not able to compile a simple test program.
        
          It fails with the following output:
        
           Change Dir: /home/user/testProjects/build-bubbleWork-Android_for_x86_GCC_4_9_Qt_5_9_3_for_Android_x86-Default/CMakeFiles/CMakeTmp
        
          
        
          Run Build Command:"/usr/bin/make" "cmTC_c05c5/fast"
        
          /usr/bin/make -f CMakeFiles/cmTC_c05c5.dir/build.make
          CMakeFiles/cmTC_c05c5.dir/build
        
          make[1]: Entering directory
          '/home/user/testProjects/build-bubbleWork-Android_for_x86_GCC_4_9_Qt_5_9_3_for_Android_x86-Default/CMakeFiles/CMakeTmp'
        
        
          Building CXX object CMakeFiles/cmTC_c05c5.dir/testCXXCompiler.cxx.o
        
          
          /home/user/android-ndk-r16b/toolchains/x86-4.9/prebuilt/linux-x86_64/bin/i686-linux-android-gcc
          -o CMakeFiles/cmTC_c05c5.dir/testCXXCompiler.cxx.o -c
          /home/user/testProjects/build-bubbleWork-Android_for_x86_GCC_4_9_Qt_5_9_3_for_Android_x86-Default/CMakeFiles/CMakeTmp/testCXXCompiler.cxx
        
        
          Linking CXX executable cmTC_c05c5
        
          /usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_c05c5.dir/link.txt
          --verbose=1
        
          
          /home/user/android-ndk-r16b/toolchains/x86-4.9/prebuilt/linux-x86_64/bin/i686-linux-android-gcc
          CMakeFiles/cmTC_c05c5.dir/testCXXCompiler.cxx.o -o cmTC_c05c5 -rdynamic
        
          
          /home/user/android-ndk-r16b/toolchains/x86-4.9/prebuilt/linux-x86_64/bin/../lib/gcc/i686-linux-android/4.9.x/../../../../i686-linux-android/bin/ld:
          error: cannot open crtbegin_dynamic.o: No such file or directory
        
        
        1 Reply Last reply
        0

        1/3

        24 Jan 2018, 13:14

        • Login

        • Login or register to search.
        1 out of 3
        • First post
          1/3
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved