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

时间:2019-06-18 12:59:35

标签: c python-3.x pyqt5

我尝试从pyqtdeploy构建演示应用程序,但遇到了此链接器错误。
找不到-lc ++

以下是生成错误的命令:

/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)

有人知道如何解决此问题吗?

2 个答案:

答案 0 :(得分:0)

编译器缺少此文件:/home/art/Android/Sdk/ndk-bundle/sources/cxx-stl/llvm-libc++/libs/arm64-v8a/libc++.so.27在呼叫。 查看它是否在您的系统上。如果没有,您可以尝试通过s.th找到它。喜欢:

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

或更通用:

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

查找此文件的其他版本。如果您无法在预期的版本中找到它,则可能是您没有正确的SDK。尝试清理。 (不知道您在做什么,但是也许下载适合SDK的演示应用程序版本?!)

答案 1 :(得分:0)

以防万一其他人也遇到类似的问题。
我可以使用 NDK 19 而不是NDK-20来解决此问题。