Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. What's the problem? android compile error
Forum Updated to NodeBB v4.3 + New Features

What's the problem? android compile error

Scheduled Pinned Locked Moved Solved Mobile and Embedded
19 Posts 13 Posters 14.9k Views 2 Watching
  • 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.burksA Offline
    a.burksA Offline
    a.burks
    wrote on last edited by
    #9

    I have a similar problem. I followed the instructions of the tutorial for android and opened the analog clock example to build, deploy and start the app in the Android emulator.

    I use Qt Creator for macOS with the newest suggested Qt versuin. I get following build errors:

    /Users/burks/Library/Android/android-ndk-r20/toolchains/x86-4.9/prebuilt/darwin-x86_64/lib/gcc/i686-linux-android/4.9.x/../../../../i686-linux-android/bin/ld: error: cannot find -lc++
    clang++: error: linker command failed with exit code 1 (use -v to see invocation)
    make: *** [libshadereffects.so] Error 1
    

    Some ideas, how to make a Qt app for Android running?

    1 Reply Last reply
    1
    • J Offline
      J Offline
      JohnAmadis
      wrote on last edited by
      #10

      Hi,

      I have exactly the same issue. Google Play Console requires adaptation for android-28 and arm64-v8a
      from August 19, so QT developers cannot use r16b anymore and I have used NDK r20 instead. Unfortunatelly I received -lc++ library linking problem. I am not sure why, because the library is available in the expected path, and objdump returns correct armv7 architecture.

      To solve the issue with linking I just used android-ndk-19c version. But note, that the 19c contains some bug with support of spaces in the QRC paths, so for example I had to remove this from the QRC:

      make[1]: *** No rule to make target '/project/fonts/customfont/pobrano z /project/fonts/customfont/koikj.txt', needed by 'qrc_qml.cpp'.  Stop
      
      1 Reply Last reply
      0
      • A Offline
        A Offline
        Albertino
        wrote on last edited by
        #11

        The error: cannot find -lc++ using ndk r20 can be solved like this:
        https://codereview.qt-project.org/c/qt/qtbase/+/264903/9/mkspecs/android-clang/qmake.conf#34

        For example to compile for android armv7 ndk r20, locate the file:
        C:\Qt\5.13.0\android_armv7\mkspecs\android-clang\qmake.conf
        and add the missing -nostdlib++
        for android x86 (i use this for emulator), locate the file:
        C:\Qt\5.13.0\android_x86\mkspecs\android-clang\qmake.conf

        For error: Execution failed for task ':compileDebugAidl'
        locate the file on your build directory, mine is: C:\dev_qt\experiments\build-test_qt_5_13_0_ARMv7-Release\android-build\gradle.properties and change androidBuildToolsVersion
        from: androidBuildToolsVersion=29.0.0
        to: androidBuildToolsVersion=28.0.3

        a.burksA Y 2 Replies Last reply
        5
        • A Albertino

          The error: cannot find -lc++ using ndk r20 can be solved like this:
          https://codereview.qt-project.org/c/qt/qtbase/+/264903/9/mkspecs/android-clang/qmake.conf#34

          For example to compile for android armv7 ndk r20, locate the file:
          C:\Qt\5.13.0\android_armv7\mkspecs\android-clang\qmake.conf
          and add the missing -nostdlib++
          for android x86 (i use this for emulator), locate the file:
          C:\Qt\5.13.0\android_x86\mkspecs\android-clang\qmake.conf

          For error: Execution failed for task ':compileDebugAidl'
          locate the file on your build directory, mine is: C:\dev_qt\experiments\build-test_qt_5_13_0_ARMv7-Release\android-build\gradle.properties and change androidBuildToolsVersion
          from: androidBuildToolsVersion=29.0.0
          to: androidBuildToolsVersion=28.0.3

          a.burksA Offline
          a.burksA Offline
          a.burks
          wrote on last edited by
          #12

          @Albertino Thank your very much. Now I can build and run the calculator example project with the emulator. That's very motivating. However I get many warnings in the log. Maybe the example projects are not optimized for Android. I will check the tutorial a hallo world project.

          I zygote  : Not late-enabling -Xcheck:jni (already on)
          W zygote  : Unexpected CPU variant for X86 using defaults: x86
          W System  : ClassLoader referenced unknown path:
          I QtCore  : Start
          W linker  : "/data/app/org.qtproject.example.calculator-LvUUU6gyNuONt6Duq8qL_A==/lib/x86/libQt5Gui.so" has unsupported flags DT_FLAGS_1=0x80
          W linker  : "/data/app/org.qtproject.example.calculator-LvUUU6gyNuONt6Duq8qL_A==/lib/x86/libQt5Widgets.so" has unsupported flags DT_FLAGS_1=0x80
          W linker  : "/data/data/org.qtproject.example.calculator/qt-reserved-files/plugins/platforms/android/libqtforandroid.so" has unsupported flags DT_FLAGS_1=0x80
          I Qt      : qt started
          D OpenGLRenderer: HWUI GL Pipeline
          I zygote  : Background concurrent copying GC freed 14726(1133KB) AllocSpace objects, 18(380KB) LOS objects, 52% free, 1407KB/2MB, paused 741us total 254.773ms
          I zygote  : Do partial code cache collection, code=26KB, data=30KB
          I zygote  : After code cache collection, code=25KB, data=30KB
          I zygote  : Increasing code cache capacity to 128KB
          I zygote  : Background concurrent copying GC freed 14025(1072KB) AllocSpace objects, 20(512KB) LOS objects, 50% free, 1491KB/2MB, paused 53.091ms total 112.459ms
          I zygote  : Do partial code cache collection, code=50KB, data=56KB
          I zygote  : After code cache collection, code=48KB, data=55KB
          I zygote  : Increasing code cache capacity to 256KB
          D         : HostConnection::get() New Host Connection established 0x9a107280, tid 5700
          I zygote  : android::hardware::configstore::V1_0::ISurfaceFlingerConfigs::hasWideColorDisplay retrieved: 0
          I OpenGLRenderer: Initialized EGL, version 1.4
          D OpenGLRenderer: Swap behavior 1
          W OpenGLRenderer: Failed to choose config with EGL_SWAP_BEHAVIOR_PRESERVED, retrying without...
          D OpenGLRenderer: Swap behavior 0
          
          A 1 Reply Last reply
          0
          • a.burksA a.burks

            @Albertino Thank your very much. Now I can build and run the calculator example project with the emulator. That's very motivating. However I get many warnings in the log. Maybe the example projects are not optimized for Android. I will check the tutorial a hallo world project.

            I zygote  : Not late-enabling -Xcheck:jni (already on)
            W zygote  : Unexpected CPU variant for X86 using defaults: x86
            W System  : ClassLoader referenced unknown path:
            I QtCore  : Start
            W linker  : "/data/app/org.qtproject.example.calculator-LvUUU6gyNuONt6Duq8qL_A==/lib/x86/libQt5Gui.so" has unsupported flags DT_FLAGS_1=0x80
            W linker  : "/data/app/org.qtproject.example.calculator-LvUUU6gyNuONt6Duq8qL_A==/lib/x86/libQt5Widgets.so" has unsupported flags DT_FLAGS_1=0x80
            W linker  : "/data/data/org.qtproject.example.calculator/qt-reserved-files/plugins/platforms/android/libqtforandroid.so" has unsupported flags DT_FLAGS_1=0x80
            I Qt      : qt started
            D OpenGLRenderer: HWUI GL Pipeline
            I zygote  : Background concurrent copying GC freed 14726(1133KB) AllocSpace objects, 18(380KB) LOS objects, 52% free, 1407KB/2MB, paused 741us total 254.773ms
            I zygote  : Do partial code cache collection, code=26KB, data=30KB
            I zygote  : After code cache collection, code=25KB, data=30KB
            I zygote  : Increasing code cache capacity to 128KB
            I zygote  : Background concurrent copying GC freed 14025(1072KB) AllocSpace objects, 20(512KB) LOS objects, 50% free, 1491KB/2MB, paused 53.091ms total 112.459ms
            I zygote  : Do partial code cache collection, code=50KB, data=56KB
            I zygote  : After code cache collection, code=48KB, data=55KB
            I zygote  : Increasing code cache capacity to 256KB
            D         : HostConnection::get() New Host Connection established 0x9a107280, tid 5700
            I zygote  : android::hardware::configstore::V1_0::ISurfaceFlingerConfigs::hasWideColorDisplay retrieved: 0
            I OpenGLRenderer: Initialized EGL, version 1.4
            D OpenGLRenderer: Swap behavior 1
            W OpenGLRenderer: Failed to choose config with EGL_SWAP_BEHAVIOR_PRESERVED, retrying without...
            D OpenGLRenderer: Swap behavior 0
            
            A Offline
            A Offline
            Albertino
            wrote on last edited by
            #13

            @a.burks these are info/debug messages (not errors), QT is very verbose on android. You can ignore them

            1 Reply Last reply
            1
            • A Albertino

              The error: cannot find -lc++ using ndk r20 can be solved like this:
              https://codereview.qt-project.org/c/qt/qtbase/+/264903/9/mkspecs/android-clang/qmake.conf#34

              For example to compile for android armv7 ndk r20, locate the file:
              C:\Qt\5.13.0\android_armv7\mkspecs\android-clang\qmake.conf
              and add the missing -nostdlib++
              for android x86 (i use this for emulator), locate the file:
              C:\Qt\5.13.0\android_x86\mkspecs\android-clang\qmake.conf

              For error: Execution failed for task ':compileDebugAidl'
              locate the file on your build directory, mine is: C:\dev_qt\experiments\build-test_qt_5_13_0_ARMv7-Release\android-build\gradle.properties and change androidBuildToolsVersion
              from: androidBuildToolsVersion=29.0.0
              to: androidBuildToolsVersion=28.0.3

              Y Offline
              Y Offline
              Yerson
              wrote on last edited by
              #14

              @Albertino Gracias!! . estuve 2 semanas para arreglar ese error.

              1 Reply Last reply
              0
              • J Jay_M

                Ok, finally got mine to work. What a %@$# PITA... I really dislike windows, but it's where I chosen do android dev unfortunately.

                So... here's what I did... (it may have just been one of these that fixed the issue, but I'm too tired to go back and test them individually)

                1st: correct some invalid variables in QT's build settings/build environment (i.e. wrong slash was / instead of \)... AND add some. Specifically:

                ANDROID_HOME = D:\Android-SDK
                ANDROID_SDK_ROOT = D:\Android-SDK
                GRADLE_USER_HOME = C:\Users\pc\.gradle
                JAVA_HOME = D:\Program Files\Java\jdk1.8.0_201
                

                (obviously these need to be upd for your install directories .i.e usually on C: drive)

                Note: I specified these in Windows env settings, but it seems like they need to be specifically set in QT's env overrides.

                2nd: remove the 29.0.0RC1 from Android SDK build-tools via Android Studio SDK manager. Apply.
                Select 'show package details' to then be able to select the 28.0.3 version. Apply.

                3rd: go into theQT project/app's folder and edit the gradle.properties file... change the line to:

                androidBuildToolsVersion=28.0.3
                

                Finally: you should probably should close and reopen QT and the project.
                Build/deploy should now (hopefully/finally) work!

                M Offline
                M Offline
                Mahdi Bouafif
                wrote on last edited by
                #15
                This post is deleted!
                1 Reply Last reply
                0
                • J Jay_M

                  Ok, finally got mine to work. What a %@$# PITA... I really dislike windows, but it's where I chosen do android dev unfortunately.

                  So... here's what I did... (it may have just been one of these that fixed the issue, but I'm too tired to go back and test them individually)

                  1st: correct some invalid variables in QT's build settings/build environment (i.e. wrong slash was / instead of \)... AND add some. Specifically:

                  ANDROID_HOME = D:\Android-SDK
                  ANDROID_SDK_ROOT = D:\Android-SDK
                  GRADLE_USER_HOME = C:\Users\pc\.gradle
                  JAVA_HOME = D:\Program Files\Java\jdk1.8.0_201
                  

                  (obviously these need to be upd for your install directories .i.e usually on C: drive)

                  Note: I specified these in Windows env settings, but it seems like they need to be specifically set in QT's env overrides.

                  2nd: remove the 29.0.0RC1 from Android SDK build-tools via Android Studio SDK manager. Apply.
                  Select 'show package details' to then be able to select the 28.0.3 version. Apply.

                  3rd: go into theQT project/app's folder and edit the gradle.properties file... change the line to:

                  androidBuildToolsVersion=28.0.3
                  

                  Finally: you should probably should close and reopen QT and the project.
                  Build/deploy should now (hopefully/finally) work!

                  M Offline
                  M Offline
                  Mahdi Bouafif
                  wrote on last edited by
                  #16

                  @Jay_M My friend i searched for your answer for seven days. I m extremely thankful to you

                  1 Reply Last reply
                  0
                  • J Jay_M

                    Ok, finally got mine to work. What a %@$# PITA... I really dislike windows, but it's where I chosen do android dev unfortunately.

                    So... here's what I did... (it may have just been one of these that fixed the issue, but I'm too tired to go back and test them individually)

                    1st: correct some invalid variables in QT's build settings/build environment (i.e. wrong slash was / instead of \)... AND add some. Specifically:

                    ANDROID_HOME = D:\Android-SDK
                    ANDROID_SDK_ROOT = D:\Android-SDK
                    GRADLE_USER_HOME = C:\Users\pc\.gradle
                    JAVA_HOME = D:\Program Files\Java\jdk1.8.0_201
                    

                    (obviously these need to be upd for your install directories .i.e usually on C: drive)

                    Note: I specified these in Windows env settings, but it seems like they need to be specifically set in QT's env overrides.

                    2nd: remove the 29.0.0RC1 from Android SDK build-tools via Android Studio SDK manager. Apply.
                    Select 'show package details' to then be able to select the 28.0.3 version. Apply.

                    3rd: go into theQT project/app's folder and edit the gradle.properties file... change the line to:

                    androidBuildToolsVersion=28.0.3
                    

                    Finally: you should probably should close and reopen QT and the project.
                    Build/deploy should now (hopefully/finally) work!

                    I Offline
                    I Offline
                    iamOgunyinka
                    wrote on last edited by
                    #17

                    @Jay_M Thank you very much, this worked for me!

                    1 Reply Last reply
                    0
                    • J Jay_M

                      Ok, finally got mine to work. What a %@$# PITA... I really dislike windows, but it's where I chosen do android dev unfortunately.

                      So... here's what I did... (it may have just been one of these that fixed the issue, but I'm too tired to go back and test them individually)

                      1st: correct some invalid variables in QT's build settings/build environment (i.e. wrong slash was / instead of \)... AND add some. Specifically:

                      ANDROID_HOME = D:\Android-SDK
                      ANDROID_SDK_ROOT = D:\Android-SDK
                      GRADLE_USER_HOME = C:\Users\pc\.gradle
                      JAVA_HOME = D:\Program Files\Java\jdk1.8.0_201
                      

                      (obviously these need to be upd for your install directories .i.e usually on C: drive)

                      Note: I specified these in Windows env settings, but it seems like they need to be specifically set in QT's env overrides.

                      2nd: remove the 29.0.0RC1 from Android SDK build-tools via Android Studio SDK manager. Apply.
                      Select 'show package details' to then be able to select the 28.0.3 version. Apply.

                      3rd: go into theQT project/app's folder and edit the gradle.properties file... change the line to:

                      androidBuildToolsVersion=28.0.3
                      

                      Finally: you should probably should close and reopen QT and the project.
                      Build/deploy should now (hopefully/finally) work!

                      ali-aydinA Offline
                      ali-aydinA Offline
                      ali-aydin
                      wrote on last edited by
                      #18

                      @Jay_M said in What's the problem? android compile error:

                      theQT project/app's folder and edit the gradle.properties file

                      where is " theQT project/app's folder and edit the gradle.properties file" file or directory?
                      i can't find it

                      jsulmJ 1 Reply Last reply
                      0
                      • ali-aydinA ali-aydin

                        @Jay_M said in What's the problem? android compile error:

                        theQT project/app's folder and edit the gradle.properties file

                        where is " theQT project/app's folder and edit the gradle.properties file" file or directory?
                        i can't find it

                        jsulmJ Offline
                        jsulmJ Offline
                        jsulm
                        Lifetime Qt Champion
                        wrote on last edited by
                        #19

                        @ali-aydin said in What's the problem? android compile error:

                        where is " theQT project/app's folder

                        It's you project folder where the source code is.

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

                        1 Reply Last reply
                        0

                        • Login

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