在 Qt Creator (Windows) 中构建 Qt 库的问题

Posted

技术标签:

【中文标题】在 Qt Creator (Windows) 中构建 Qt 库的问题【英文标题】:Issue building Qt libraries in Qt Creator (Windows) 【发布时间】:2020-05-21 06:26:41 【问题描述】:

我在 Windows 中遇到 Qt Creator 问题:

我制作了一个使用 QtSerialPort 和 QtSerialBus 库的应用程序,我为 Windows 构建并部署了它,一切顺利。 现在我正在尝试为 android 构建它,但这些库在 official documentation 状态下不可用。

我从 Github 下载了 QtSerialPort 和 QtSerialBus 的源代码,现在我正在尝试自己为 Android 构建它们。 AFAIK 我遇到的问题是在 make install 步骤中,这是我得到的消息:

08:05:28: Starting: "C:\Android\ndk-bundle\prebuilt\windows-x86_64\bin\make.exe" "INSTALL_ROOT=C:\Users\giovanni.lucenti\Downloads\qtserialport\android-build" install
cd src\ && ( if not exist Makefile C:\Qt\5.14.2\android\bin\qmake.exe -o Makefile C:\Users\giovanni.lucenti\Downloads\qtserialport-dev\src\src.pro -spec android-clang "CONFIG+=qtquickcompiler" "ANDROID_ABIS=armeabi-v7a" ) && C:/Android/ndk-bundle/prebuilt/windows-x86_64/bin/make -f Makefile install
make[1]: Entering directory 'C:/Users/giovanni.lucenti/Downloads/qtserialport/src'
cd serialport\ && ( if not exist Makefile C:\Qt\5.14.2\android\bin\qmake.exe -o Makefile C:\Users\giovanni.lucenti\Downloads\qtserialport-dev\src\serialport\serialport.pro -spec android-clang "CONFIG+=qtquickcompiler" "ANDROID_ABIS=armeabi-v7a" ) && C:/Android/ndk-bundle/prebuilt/windows-x86_64/bin/make -f Makefile install
make[2]: Entering directory 'C:/Users/giovanni.lucenti/Downloads/qtserialport/src/serialport'
La sintassi del nome del file, della directory o del volume non Š corretta.
make[2]: *** [Makefile:639: install_target] Error 1
make[2]: Leaving directory 'C:/Users/giovanni.lucenti/Downloads/qtserialport/src/serialport'
make[1]: *** [Makefile:59: sub-serialport-install_subtargets] Error 2
make[1]: Leaving directory 'C:/Users/giovanni.lucenti/Downloads/qtserialport/src'
make: *** [Makefile:61: sub-src-install_subtargets] Error 2
08:05:30: The process "C:\Android\ndk-bundle\prebuilt\windows-x86_64\bin\make.exe" exited with code 2.
Error while building/deploying project qtserialport (kit: Android for armeabi-v7a,arm64-v8a,x86,x86_64 (Clang Qt 5.14.2 for Android))
When executing step "Copy application data"
08:05:30: Elapsed time: 00:23.

我已经尝试将文件夹移动到较短的路径 (C:\tmpbuild) 但一切都一样。 我错过了什么吗? 我应该在哪里设置 make install 目标路径? 这些是我的Qt Creator build settings

【问题讨论】:

错误信息是意大利语,对不起。意思是:“文件名、目录名或卷标语法不正确” 【参考方案1】:

您不能在 Android 上使用 QSerialPort,因为那里不支持它。

【讨论】:

很抱歉,但这并不能解释我收到的错误消息。此外,我能够“偶然”构建 qtserialport 并且它可以在我的手机上运行,​​但我无法重复成功。 qtserialbus 也不能这样做 1.我再重复一遍:Android 不支持 QtSerialPort,如果没有 root 权限,它就不能在那里工作。因此,您应该自担风险使用它。 2. QtSerialBus 在没有 QSerialPort 支持的情况下在 Android 上编译。在这种情况下,您将只能通过 TCP/IP 与 Modbus 进行通信。 好的,我会告诉我的电脑 QtSerialBus 编译,尽管日志告诉我相反。

以上是关于在 Qt Creator (Windows) 中构建 Qt 库的问题的主要内容,如果未能解决你的问题,请参考以下文章

安装 qt-creator 不运行

无法让 Qt Creator 调试在 Windows 10 上运行

在 Windows 8 上的 Creator 中编译将在 Windows 7 上运行的 Qt 5 应用程序?

如何在 Windows 上使用 QT Creator 独立编译?

Qt Creator - 在 Windows 上构建持续时间更长

如何在 Windows 10 上将 Quazip 与 Qt 5.6、Qt Creator 一起使用?