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. error: cannot find -lc++ qt 5.12 android
QtWS25 Last Chance

error: cannot find -lc++ qt 5.12 android

Scheduled Pinned Locked Moved Solved Mobile and Embedded
25 Posts 21 Posters 15.0k 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.
  • K Offline
    K Offline
    kechkibet
    wrote on last edited by
    #1

    Hi,
    I am trying to run a hello world qt application on android and am getting the error:

    C:\Android\sdk\ndk-bundle/toolchains/llvm/prebuilt/windows-x86_64/bin/clang++ -D__ANDROID_API__=21 -target aarch64-none-linux-android -gcc-toolchain C:\Android\sdk\ndk-bundle/toolchains/aarch64-linux-android-4.9/prebuilt/windows-x86_64 -fno-limit-debug-info -Wl,--exclude-libs,libgcc.a -Wl,--exclude-libs,libatomic.a --sysroot=C:\Android\sdk\ndk-bundle/platforms/android-21/arch-arm64/ -Wl,-soname,libandroid-e.so -Wl,-rpath=C:/Qt/5.12.3/android_arm64_v8a/lib -Wl,--no-undefined -Wl,-z,noexecstack -shared -o libandroid-e.so main.obj qrc_qml.obj -LC:/Qt/5.12.3/android_arm64_v8a/lib -lQt5Quick -LC:\Qt\5.12.3\android_arm64_v8a/lib -Lc:\Utils\Android\android-ndk-r18b/sources/cxx-stl/llvm-libc++/libs/arm64-v8a -lQt5Gui -lQt5Qml -lQt5Network -lQt5Core -lGLESv2 -LC:\Android\sdk\ndk-bundle/sources/cxx-stl/llvm-libc++/libs/arm64-v8a C:\Android\sdk\ndk-bundle/sources/cxx-stl/llvm-libc++/libs/arm64-v8a/libc++.so.21 -llog -lz -lm -ldl -lc
    C:\Android\sdk\ndk-bundle/toolchains/aarch64-linux-android-4.9/prebuilt/windows-x86_64/lib/gcc/aarch64-linux-android/4.9.x/../../../../aarch64-linux-android/bin\ld: cannot find -lc++
    clang++: error: linker command failed with exit code 1 (use -v to see invocation)
    make: *** [libandroid-e.so] Error 1
    03:24:10: The process "C:\Android\sdk\ndk-bundle\prebuilt\windows-x86_64\bin\make.exe" exited with code 2.
    Error while building/deploying project android-e (kit: Android for arm64-v8a (Clang Qt 5.12.3 for Android ARM64-v8a))
    When executing step "Make"

    It is working perfectly fine when i compile it for desktop but when i try to run on android kit it breaks with the above error.
    I have installed the following:
    Android settings are OK. (SDK Version: 26.1.1, NDK Version: 20.0.5594570)

    1 Reply Last reply
    4
    • K Offline
      K Offline
      kechkibet
      wrote on last edited by
      #2

      More infor on the error:

      E:\qt-projects\build-android-e-Android_for_arm64_v8a_Clang_Qt_5_12_3_for_Android_ARM64_v8a-Debug>C:\Android\sdk\ndk-bundle/toolchains/llvm/prebuilt/windows-x86_64/bin/clang++ -D__ANDROID_API__=21 -target aarch64-none-linux-android -gcc-toolchain C:\Android\sdk\ndk-bundle/toolchains/aarch64-linux-android-4.9/prebuilt/windows-x86_64 -fno-limit-debug-info -Wl,--exclude-libs,libgcc.a -Wl,--exclude-libs,libatomic.a --sysroot=C:\Android\sdk\ndk-bundle/platforms/android-21/arch-arm64/ -Wl,-soname,libandroid-e.so -Wl,-rpath=C:/Qt/5.12.3/android_arm64_v8a/lib -Wl,--no-undefined -Wl,-z,noexecstack -shared -o libandroid-e.so main.obj qrc_qml.obj -LC:/Qt/5.12.3/android_arm64_v8a/lib -lQt5Quick -LC:\Qt\5.12.3\android_arm64_v8a/lib -Lc:\Utils\Android\android-ndk-r18b/sources/cxx-stl/llvm-libc++/libs/arm64-v8a -lQt5Gui -lQt5Qml -lQt5Network -lQt5Core -lGLESv2 -LC:\Android\sdk\ndk-bundle/sources/cxx-stl/llvm-libc++/libs/arm64-v8a C:\Android\sdk\ndk-bundle/sources/cxx-stl/llvm-libc++/libs/arm64-v8a/libc++.so.21 -llog -lz -lm -ldl -lc -v
      Android (5220042 based on r346389c) clang version 8.0.7 (https://android.googlesource.com/toolchain/clang b55f2d4ebfd35bf643d27dbca1bb228957008617) (https://android.googlesource.com/toolchain/llvm 3c393fe7a7e13b0fba4ac75a01aa683d7a5b11cd) (based on LLVM 8.0.7svn)
      Target: aarch64-none-linux-android
      Thread model: posix
      InstalledDir: C:\Android\sdk\ndk-bundle/toolchains/llvm/prebuilt/windows-x86_64/bin
      Found candidate GCC installation: C:\Android\sdk\ndk-bundle/toolchains/aarch64-linux-android-4.9/prebuilt/windows-x86_64/lib/gcc/aarch64-linux-android\4.9.x
      Selected GCC installation: C:\Android\sdk\ndk-bundle/toolchains/aarch64-linux-android-4.9/prebuilt/windows-x86_64/lib/gcc/aarch64-linux-android/4.9.x
      Candidate multilib: .;@m64
      Selected multilib: .;@m64
      Found CUDA installation: C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.1, version 9.1
      "C:\Android\sdk\ndk-bundle/toolchains/aarch64-linux-android-4.9/prebuilt/windows-x86_64/lib/gcc/aarch64-linux-android/4.9.x/../../../../aarch64-linux-android/bin\ld" "--sysroot=C:\Android\sdk\ndk-bundle/platforms/android-21/arch-arm64/" -EL --fix-cortex-a53-843419 -z now -z relro --hash-style=both --enable-new-dtags --eh-frame-hdr -m aarch64linux -shared -o libandroid-e.so "C:\Android\sdk\ndk-bundle/platforms/android-21/arch-arm64//usr/lib\crtbegin_so.o" -LC:/Qt/5.12.3/android_arm64_v8a/lib "-LC:\Qt\5.12.3\android_arm64_v8a/lib" "-Lc:\Utils\Android\android-ndk-r18b/sources/cxx-stl/llvm-libc++/libs/arm64-v8a" "-LC:\Android\sdk\ndk-bundle/sources/cxx-stl/llvm-libc++/libs/arm64-v8a" "-LC:\Android\sdk\ndk-bundle\toolchains\llvm\prebuilt\windows-x86_64\lib64\clang\8.0.7\lib\linux\aarch64" "-LC:\Android\sdk\ndk-bundle/toolchains/aarch64-linux-android-4.9/prebuilt/windows-x86_64/lib/gcc/aarch64-linux-android/4.9.x" "-LC:\Android\sdk\ndk-bundle/toolchains/aarch64-linux-android-4.9/prebuilt/windows-x86_64/lib/gcc/aarch64-linux-android/4.9.x/../../../../aarch64-linux-android/lib/../lib64" "-LC:\Android\sdk\ndk-bundle/toolchains/aarch64-linux-android-4.9/prebuilt/windows-x86_64/lib/gcc/aarch64-linux-android/4.9.x/../../../../aarch64-linux-android/lib" "-LC:\Android\sdk\ndk-bundle/platforms/android-21/arch-arm64//usr/lib" --exclude-libs libgcc.a --exclude-libs libatomic.a -soname libandroid-e.so -rpath=C:/Qt/5.12.3/android_arm64_v8a/lib --no-undefined -z noexecstack main.obj qrc_qml.obj -lQt5Quick -lQt5Gui -lQt5Qml -lQt5Network -lQt5Core -lGLESv2 "C:\Android\sdk\ndk-bundle/sources/cxx-stl/llvm-libc++/libs/arm64-v8a/libc++.so.21" -llog -lz -lm -ldl -lc -lc++ -lm -lgcc -ldl -lc -lgcc -ldl "C:\Android\sdk\ndk-bundle/platforms/android-21/arch-arm64//usr/lib\crtend_so.o"
      C:\Android\sdk\ndk-bundle/toolchains/aarch64-linux-android-4.9/prebuilt/windows-x86_64/lib/gcc/aarch64-linux-android/4.9.x/../../../../aarch64-linux-android/bin\ld: cannot find -lc++
      clang++: error: linker command failed with exit code 1 (use -v to see invocation)

      1 Reply Last reply
      0
      • A Offline
        A Offline
        AriosJentu
        wrote on last edited by AriosJentu
        #3

        Have almost the same trouble. After some system updates (Manjaro), it won't run on my any android devices. Crashing with error that cannot found linker -lc++

        02:46:40: Running steps for project Calendar...
        02:46:40: Configuration unchanged, skipping qmake step.
        02:46:40: Starting: "/opt/android-ndk/prebuilt/linux-x86_64/bin/make" -j4
        /opt/android-ndk/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++ -D__ANDROID_API__=22 -target aarch64-none-linux-android -gcc-toolchain /opt/android-ndk/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64 -fno-limit-debug-info -Wl,--exclude-libs,libgcc.a -Wl,--exclude-libs,libatomic.a --sysroot=/opt/android-ndk/platforms/android-22/arch-arm64/ -Wl,-soname,libCalendar.so -Wl,-rpath=/opt/android-libs/aarch64/lib -Wl,--no-undefined -Wl,-z,noexecstack -shared -o libCalendar.so event.o eventmodel.o main.o qrc_resources.o moc_event.o moc_eventmodel.o   -L/opt/android-libs/aarch64/lib -lQt5Quick -L/opt/android-ndk/sources/cxx-stl/llvm-libc++/libs/arm64-v8a -lQt5Gui -lQt5Qml -lQt5Network -lQt5Sql -lQt5Core /opt/android-ndk/platforms/android-22/arch-arm64/usr/lib/libGLESv2.so  -L/opt/android-ndk/sources/cxx-stl/llvm-libc++/libs/arm64-v8a /opt/android-ndk/sources/cxx-stl/llvm-libc++/libs/arm64-v8a/libc++.so.22 -llog -lz -lm -ldl -lc
        /opt/android-ndk/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64/lib/gcc/aarch64-linux-android/4.9.x/../../../../aarch64-linux-android/bin/ld: cannot find -lc++
        clang++: error: linker command failed with exit code 1 (use -v to see invocation)
        make: *** [libCalendar.so] Error 1
        02:46:40: The process "/opt/android-ndk/prebuilt/linux-x86_64/bin/make" exited with code 2.
        Error while building/deploying project Calendar (kit: Android)
        When executing step "Make"
        02:46:40: Elapsed time: 00:00.
        

        SDK is 26.1.1, NDK is 20.0.5594570.

        L 1 Reply Last reply
        1
        • W Offline
          W Offline
          Woazim
          wrote on last edited by
          #4

          I had the same issue with NDK 20. What worked for me was to download NDK r19c (here : https://developer.android.com/ndk/downloads/older_releases) and configure QtCreator to use it in Tools/Options/Devices.

          NoWhereMan1979N 1 Reply Last reply
          3
          • A Offline
            A Offline
            AriosJentu
            wrote on last edited by
            #5

            For me fixed reinstalling (updating) next packages -> android-aarch64-qt5 and android-armv7a-eabi-qt5 with editing their PKGBUILDs and disabling packages for build tools and platform tools.

            1 Reply Last reply
            1
            • G Offline
              G Offline
              GarineaudDylan
              wrote on last edited by
              #6

              I have the same problem and I don't know how to resolve it. I had already done all your issues and don't works...

              1 Reply Last reply
              3
              • W Woazim

                I had the same issue with NDK 20. What worked for me was to download NDK r19c (here : https://developer.android.com/ndk/downloads/older_releases) and configure QtCreator to use it in Tools/Options/Devices.

                NoWhereMan1979N Offline
                NoWhereMan1979N Offline
                NoWhereMan1979
                wrote on last edited by
                #7

                @Woazim thanks, i used your advise and it worked.

                1 Reply Last reply
                0
                • A Offline
                  A Offline
                  Albertino
                  wrote on last edited by
                  #8

                  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

                  B I M D S 5 Replies Last reply
                  18
                  • 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

                    B Offline
                    B Offline
                    BeMind
                    wrote on last edited by
                    #9

                    @Albertino solution Works!!! :) Thank you.

                    1 Reply Last reply
                    0
                    • A Offline
                      A Offline
                      alepez
                      wrote on last edited by
                      #10

                      @Albertino solution works for me (Qt 5.12.3)

                      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

                        I Offline
                        I Offline
                        ignusin
                        wrote on last edited by
                        #11

                        @Albertino thank you Sir, you just saved my day (night to be honest).

                        1 Reply Last reply
                        0
                        • R Offline
                          R Offline
                          rch_shukla
                          wrote on last edited by aha_1980
                          #12

                          @Albertino @AriosJentu Hello , I am getting while deploying 5.10 project into QT 5.13. It is perfectly deploying for windows but for android unable to deploy i have already tried all available solutions but nothing is working out for me.
                          This is my error-
                          clang++.exe: error: no such file or directory: 'c:\Utils\Android\android-ndk-r19c/sources/cxx-stl/llvm-libc++/libs/arm64-v8a/libc++.so.21'
                          make: *** [libMNSBLauncher.so] Error 1
                          12:26:15: The process "C:\Android\android-ndk-r19c\prebuilt\windows-x86_64\bin\make.exe" exited with code 2.
                          Error while building/deploying project mobilauncher (kit: Android for arm64-v8a (Clang Qt 5.13.0 for Android ARM64-v8a))
                          When executing step "Make" 😢

                          1 Reply Last reply
                          0
                          • 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

                            M Offline
                            M Offline
                            mzelina
                            wrote on last edited by
                            #13

                            @Albertino thank you!

                            1 Reply Last reply
                            0
                            • T Offline
                              T Offline
                              trousev
                              wrote on last edited by
                              #14

                              You also can write this into your own qmake file, not into system one. To be precise, just add into your project's .pro the following:

                              QMAKE_LINK += -nostdlib++
                              

                              and that's it

                              A R B 4 Replies Last reply
                              7
                              • T trousev

                                You also can write this into your own qmake file, not into system one. To be precise, just add into your project's .pro the following:

                                QMAKE_LINK += -nostdlib++
                                

                                and that's it

                                A Offline
                                A Offline
                                Albertino
                                wrote on last edited by
                                #15
                                This post is deleted!
                                1 Reply Last reply
                                0
                                • T trousev

                                  You also can write this into your own qmake file, not into system one. To be precise, just add into your project's .pro the following:

                                  QMAKE_LINK += -nostdlib++
                                  

                                  and that's it

                                  A Offline
                                  A Offline
                                  Albertino
                                  wrote on last edited by
                                  #16

                                  @trousev said in error: cannot find -lc++ qt 5.12 android:

                                  QMAKE_LINK += -nostdlib++

                                  Oh nice to know, thanks

                                  1 Reply Last reply
                                  0
                                  • 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

                                    D Offline
                                    D Offline
                                    deleted510
                                    wrote on last edited by
                                    #17

                                    @albertino THANK YOU! WOOORKS!!!!

                                    1 Reply Last reply
                                    0
                                    • T trousev

                                      You also can write this into your own qmake file, not into system one. To be precise, just add into your project's .pro the following:

                                      QMAKE_LINK += -nostdlib++
                                      

                                      and that's it

                                      R Offline
                                      R Offline
                                      RickF
                                      wrote on last edited by
                                      #18

                                      @trousev What's the underlying problem this solves? It works for me but why? Thx.

                                      D 1 Reply Last reply
                                      0
                                      • B Offline
                                        B Offline
                                        bogong
                                        wrote on last edited by
                                        #19

                                        @albertino said in error: cannot find -lc++ qt 5.12 android:

                                        https://codereview.qt-project.org/c/qt/qtbase/+/264903/9/mkspecs/android-clang/qmake.conf#34

                                        Solution works on 5.12.4

                                        1 Reply Last reply
                                        0
                                        • R RickF

                                          @trousev What's the underlying problem this solves? It works for me but why? Thx.

                                          D Offline
                                          D Offline
                                          DonLakeFlyer
                                          wrote on last edited by
                                          #20

                                          @rickf I'd like to know the same thing. Is this just a workaround or the correct setup?

                                          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