I want to make another application using Qt to build Android app and 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 -lcC:\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 103: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 complaining about missing lc++ library. After doing some research i finally resolve the problem.
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
Hope it’s help you with the same problem when you building an application using Qt.
Originally posted 2019-07-20 17:00:00.