简体   繁体   English

尝试为 Android 构建 PyQt5 应用程序并收到链接错误:找不到 -lc++

[英]Trying to build a PyQt5 app for Android and get a link error: cannot find -lc++

I try to build the demo app from pyqtdeploy and I am running into this linker error.我尝试从 pyqtdeploy 构建演示应用程序,但遇到此链接器错误。
cannot find -lc++找不到 -lc++

Here is the command which generates the error:这是生成错误的命令:

/home/art/Android/Sdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++ -D__ANDROID_API__=27 -target aarch64-none-linux-android -gcc-toolchain /home/art/Android/Sdk/ndk-bundle/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=/home/art/Android/Sdk/ndk-bundle/platforms/android-27/arch-arm64/ -Wl,-soname,libpyqt-demo.so -Wl,-rpath=/home/art/Qt/5.12.3/android_arm64_v8a/lib -Wl,--no-undefined -Wl,-z,noexecstack -shared -o libpyqt-demo.so pyqtdeploy_main.o pyqtdeploy_start.o pdytools_module.o _abc.o _bisectmodule.o blake2b_impl.o blake2module.o blake2s_impl.o _datetimemodule.o _hashopenssl.o _heapqmodule.o _math.o _posixsubprocess.o _randommodule.o sha3module.o _ssl.o _struct.o binascii.o mathmodule.o selectmodule.o socketmodule.o zlibmodule.o qrc_pyqtdeploy.o   -L/home/art/Sourcecode/pyqtdeploy-2.4/demo/sysroot-android-64/lib -L/home/art/Sourcecode/pyqtdeploy-2.4/demo/sysroot-android-64/lib/python3.7/site-packages/PyQt5 -lQtAndroidExtras -lQtCore -lQtGui -lQtNetwork -lQtWidgets -lcrypto -lpython3.7 -lsip -lssl -lz -L/home/art/Qt/5.12.3/android_arm64_v8a/lib -lQt5Widgets -L/opt/android/android-ndk-r18b/sources/cxx-stl/llvm-libc++/libs/arm64-v8a -lQt5Gui -lQt5Network -lQt5AndroidExtras -lQt5Core -lGLESv2  -L/home/art/Android/Sdk/ndk-bundle/sources/cxx-stl/llvm-libc++/libs/arm64-v8a /home/art/Android/Sdk/ndk-bundle/sources/cxx-stl/llvm-libc++/libs/arm64-v8a/libc++.so.27 -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: /home/art/Android/Sdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/bin
Found candidate GCC installation: /home/art/Android/Sdk/ndk-bundle/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64/lib/gcc/aarch64-linux-android/4.9.x
Selected GCC installation: /home/art/Android/Sdk/ndk-bundle/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64/lib/gcc/aarch64-linux-android/4.9.x
Candidate multilib: .;@m64
Selected multilib: .;@m64
 "/home/art/Android/Sdk/ndk-bundle/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64/lib/gcc/aarch64-linux-android/4.9.x/../../../../aarch64-linux-android/bin/ld" --sysroot=/home/art/Android/Sdk/ndk-bundle/platforms/android-27/arch-arm64/ -EL --fix-cortex-a53-843419 -z now -z relro --hash-style=both --enable-new-dtags --eh-frame-hdr -m aarch64linux -shared -o libpyqt-demo.so /home/art/Android/Sdk/ndk-bundle/platforms/android-27/arch-arm64//usr/lib/crtbegin_so.o -L/home/art/Sourcecode/pyqtdeploy-2.4/demo/sysroot-android-64/lib -L/home/art/Sourcecode/pyqtdeploy-2.4/demo/sysroot-android-64/lib/python3.7/site-packages/PyQt5 -L/home/art/Qt/5.12.3/android_arm64_v8a/lib -L/opt/android/android-ndk-r18b/sources/cxx-stl/llvm-libc++/libs/arm64-v8a -L/home/art/Android/Sdk/ndk-bundle/sources/cxx-stl/llvm-libc++/libs/arm64-v8a -L/home/art/Android/Sdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/lib64/clang/8.0.7/lib/linux/aarch64 -L/home/art/Android/Sdk/ndk-bundle/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64/lib/gcc/aarch64-linux-android/4.9.x -L/home/art/Android/Sdk/ndk-bundle/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64/lib/gcc/aarch64-linux-android/4.9.x/../../../../aarch64-linux-android/lib/../lib64 -L/home/art/Android/Sdk/ndk-bundle/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64/lib/gcc/aarch64-linux-android/4.9.x/../../../../aarch64-linux-android/lib -L/home/art/Android/Sdk/ndk-bundle/platforms/android-27/arch-arm64//usr/lib --exclude-libs libgcc.a --exclude-libs libatomic.a -soname libpyqt-demo.so -rpath=/home/art/Qt/5.12.3/android_arm64_v8a/lib --no-undefined -z noexecstack pyqtdeploy_main.o pyqtdeploy_start.o pdytools_module.o _abc.o _bisectmodule.o blake2b_impl.o blake2module.o blake2s_impl.o _datetimemodule.o _hashopenssl.o _heapqmodule.o _math.o _posixsubprocess.o _randommodule.o sha3module.o _ssl.o _struct.o binascii.o mathmodule.o selectmodule.o socketmodule.o zlibmodule.o qrc_pyqtdeploy.o -lQtAndroidExtras -lQtCore -lQtGui -lQtNetwork -lQtWidgets -lcrypto -lpython3.7 -lsip -lssl -lz -lQt5Widgets -lQt5Gui -lQt5Network -lQt5AndroidExtras -lQt5Core -lGLESv2 /home/art/Android/Sdk/ndk-bundle/sources/cxx-stl/llvm-libc++/libs/arm64-v8a/libc++.so.27 -llog -lz -lm -ldl -lc -lc++ -lm -lgcc -ldl -lc -lgcc -ldl /home/art/Android/Sdk/ndk-bundle/platforms/android-27/arch-arm64//usr/lib/crtend_so.o
/home/art/Android/Sdk/ndk-bundle/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)

Has anybody got an idea how to fix this?有没有人知道如何解决这个问题?

The compiler is missing this file: /home/art/Android/Sdk/ndk-bundle/sources/cxx-stl/llvm-libc++/libs/arm64-v8a/libc++.so.27 given as a dependency in the call. 编译器缺少此文件:/home/art/Android/Sdk/ndk-bundle/sources/cxx-stl/llvm-libc++/libs/arm64-v8a/libc++.so.27作为调用中的依赖项给出。 look if it is on your system. 看看它是否在你的系统上。 If not you can try to find it with s.th. 如果没有,你可以尝试用s.th.找到它。 like: 喜欢:

find /home/art/ -name "libc++.so.27"

Or even more generic: 或者甚至更通用:

find /home/art -name "libc++.so*"

to find other versions of this file. 找到此文件的其他版本。 If you can't find it in the expected version, I'd guess you don't have the proper SDK. 如果你在预期的版本中找不到它,我猜你没有合适的SDK。 Try to clean up. 尽量清理。 (don't know what you're doing, but maybe download a version of the demo app which fits to the SDK?!) (不知道你在做什么,但可能下载适合SDK的演示应用程序版本?!)

Just in case other people are also running into a similar problem. 以防万一其他人也遇到类似的问题。
I could solve this problem using NDK 19 instead of NDK-20. 我可以使用NDK 19而不是NDK-20来解决这个问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM