1.概要
1.编译安装的基本流程
查看选项
./configure -help
运行脚本
./configure -prefix /opt/qtcharts-6.7.2 -release -opensource -confirm-license
./configure -prefix /opt/qt6.7.2 -opensource -confirm-license -platform linux-g++ -release -nomake tests -nomake examples
编译
make -j$(nproc) # 使用与 CPU 核心数相同的并行作业数加快编译速度
安装
sudo make install
2.内容
编译和安装 Qt 6.7.2 从源代码(qt-everywhere-src-6.7.2.tar.xz
)可以是一个复杂的过程,但通过遵循以下步骤,你应该能够在 Linux 或 macOS 系统上成功完成它。在开始之前,确保你的系统满足必要的依赖项,例如编译器和构建工具。
步骤 1: 准备环境
-
安装依赖项:
- 在 Debian/Ubuntu 上:
sudo apt update sudo apt install build-essential perl python2 git libxcb-xinerama0-dev libx11-dev libxext-dev libxfixes-dev \ libxi-dev libxrender-dev libx11-xcb-dev libxcb1-dev libxcb-keysyms1-dev libxcb-image0-dev \ libxcb-shm0-dev libxcb-icccm4-dev libxcb-sync-dev libxcb-xfixes0-dev libxcb-shape0-dev \ libxcb-randr0-dev libxcb-glx0-dev libxcb-xinerama0-dev libfontconfig1-dev libfreetype6-dev \ libssl-dev libpng-dev libjpeg-dev libglib2.0-dev libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev
- 在 Fedora 上:
sudo dnf install gcc gcc-c++ make perl python3 git libxcb-devel libX11-devel libXext-devel libXfixes-devel \ libXi-devel libXrender-devel libX11-xcb-devel libxcb-devel libxcb-keysyms-devel libxcb-image-devel \ libxcb-shm-devel libxcb-icccm-devel libxcb-sync-devel libxcb-xfixes-devel libxcb-shape-devel \ libxcb-randr-devel libxcb-glx-devel libxcb-xinerama-devel fontconfig-devel freetype-devel \ openssl-devel libpng-devel libjpeg-devel glib2-devel gstreamer1-devel gstreamer-plugins-base-devel
- 在 macOS 上,你可能需要安装 Xcode 和 Homebrew,然后通过 Homebrew 安装必要的依赖项。
- 在 Debian/Ubuntu 上:
-
下载源代码:
wget https://download.qt.io/archive/qt/6.7/6.7.2/qt-everywhere-src-6.7.2.tar.xz
-
解压源代码:
tar -xvf qt-everywhere-src-6.7.2.tar.xz cd qt-everywhere-src-6.7.2
步骤 2: 配置和编译
-
配置构建选项:
在构建目录下运行./configure
脚本。你可以指定许多选项,例如安装路径、想要支持的模块等。以下是一个基本配置示例:./configure -prefix /opt/qt6.7.2 -opensource -confirm-license -platform linux-g++ -release -nomake tests -nomake examples
-prefix
:指定 Qt 安装目录。-opensource
:选择开源许可。-confirm-license
:自动确认许可协议。-platform
:指定构建平台。-release
:构建发布版本。-nomake tests
和-nomake examples
:不构建测试和示例,减少编译时间。
-
编译 Qt:
使用make
命令编译 Qt。这可能需要一些时间,具体取决于你的系统性能。make -j$(nproc)
-
安装 Qt:
在编译完成后,使用make install
命令将 Qt 安装到指定的目录。sudo make install
步骤 3: 设置环境变量
为了确保系统使用新安装的 Qt 版本,你可能需要更新环境变量,例如 PATH
和 LD_LIBRARY_PATH
(在 Linux 上)或 DYLD_LIBRARY_PATH
(在 macOS 上)。
在 ~/.bashrc
或 ~/.zshrc
文件中添加:
export PATH=/opt/qt6.7.2/bin:$PATH
export LD_LIBRARY_PATH=/opt/qt6.7.2/lib:$LD_LIBRARY_PATH
然后运行 source ~/.bashrc
或 source ~/.zshrc
以应用更改。
步骤 4: 验证安装
运行以下命令以验证 Qt 是否已成功安装:
qmake -v
这应该输出 Qt 的版本信息,确认安装成功。
通过这些步骤,你应该能够从源代码成功编译和安装 Qt 6.7.2。如果你遇到任何问题,请查阅 Qt 官方文档或在线资源以获得更多帮助。
3.关联链接
4.关联知识
1.ubuntu,qt 编译安装的时候编译完的文件都放哪里了
在Ubuntu系统中,Qt编译安装完成后,编译生成的文件(如可执行文件、库文件、头文件等)的存放位置,主要取决于您在编译时通过configure
脚本指定的安装路径。如果没有指定安装路径,Qt通常会默认将文件安装到系统的标准目录,如/usr/local
。
具体来说:
-
默认安装路径:
- 如果没有在
configure
脚本中指定安装路径(即没有使用--prefix
选项),Qt编译生成的文件将默认安装到/usr/local
目录下。 - 在这个目录下,Qt的可执行文件通常放在
/usr/local/bin
中,库文件放在/usr/local/lib
中,头文件放在/usr/local/include
中,配置文件可能放在/usr/local/etc
中,文档等资源文件可能放在/usr/local/share
中。
- 如果没有在
-
自定义安装路径:
- 如果您希望在特定的目录下安装Qt,可以使用
--prefix
选项指定安装路径。例如,./configure --prefix=$PWD/qtbase
将安装路径设置为当前目录下的qtbase
文件夹。 - 在这种情况下,Qt编译生成的文件将按照指定的目录结构存放在
qtbase
文件夹及其子目录中。
- 如果您希望在特定的目录下安装Qt,可以使用
-
查找安装路径:
- 如果您不确定Qt编译生成的文件安装在哪个位置,可以使用
find
或whereis
命令在系统中搜索相关的文件。例如,find / -name "libQt5Core.so"
可以搜索系统中所有名为libQt5Core.so
的库文件。
- 如果您不确定Qt编译生成的文件安装在哪个位置,可以使用
建议:
- 在编译安装Qt之前,最好先规划好安装路径,以便后续管理和使用。
- 如果需要在多个项目中使用不同版本的Qt,建议将不同版本的Qt安装到不同的目录中,并通过设置环境变量来选择使用哪个版本的Qt。
示例:
假设您在编译Qt时使用了以下命令:
./configure --prefix=/opt/qt5.15.13
make
sudo make install
那么,Qt编译生成的文件将安装在/opt/qt5.15.13
目录下,目录结构类似于:
/opt/qt5.15.13/
├── bin/
├── lib/
├── include/
├── etc/
├── share/
└── ...
这样,您就可以很方便地找到和管理Qt编译生成的文件了。
2.--prefix 这个路径是指定的安装路径吗
./configure --prefix=/opt/qt5.15.13
是的,--prefix
选项确实是用来指定 Qt 编译安装时的目标路径。这个选项告诉 configure
脚本将编译生成的文件安装到哪个目录。
使用 --prefix
选项
当你在运行 Qt 的 configure
脚本时,通过添加 --prefix=/path/to/install
,你可以指定 Qt 应该被安装到的目录。例如:
./configure --prefix=/opt/qt5.15.13
这条命令告诉 configure
脚本,将 Qt 安装到 /opt/qt5.15.13
目录。执行 make
和 make install
后,所有相关的文件(可执行文件、库文件、头文件等)都将被放置在这个目录下相应的子目录中。
安装后的目录结构
通常情况下,安装后的目录结构会包括:
bin/
:存放可执行文件。lib/
:存放库文件(如.so
文件)。include/
:存放头文件。share/
:存放文档、示例等资源文件。plugins/
:存放 Qt 插件。
为什么使用 --prefix
使用 --prefix
选项有几个好处:
- 自定义安装位置:你可以将 Qt 安装到系统的非标准位置,避免与系统自带的库或软件冲突。
- 多版本管理:可以安装多个版本的 Qt,并通过不同的路径进行管理。
- 便于卸载:只需删除指定的安装目录即可完全卸载 Qt。
注意事项
- 如果你没有指定
--prefix
,Qt 通常会默认安装到/usr/local
,这可能需要管理员权限(即使用sudo
)。 - 确保指定的安装路径有足够的权限进行写入操作。
- 在安装后,你可能需要更新环境变量(如
PATH
、LD_LIBRARY_PATH
)以便系统能够找到新安装的 Qt。
通过合理使用 --prefix
选项,你可以更灵活地管理和使用不同版本的 Qt。
3.编译完的文件放哪里了
在 Qt 编译过程中,编译生成的文件(例如编译中间产物、对象文件等)的存放位置,主要取决于您在编译时使用的构建配置和工具选项。以下是对这一问题的详细解答:
编译生成文件的存放位置
-
使用 Qt Creator 的情况
- 默认构建路径:
- 在 Qt Creator 中,如果您没有启用“影子构建”(Shadow Build),编译生成的文件(包括中间产物和最终的可执行文件)默认会存放在项目的源代码目录中。
- 影子构建:
- 如果启用了影子构建,您可以在项目设置中指定一个与源代码目录不同的构建目录。这样,编译生成的文件将存放在您指定的构建目录中,而不是源代码目录。
- 在 Qt Creator 中,您可以在“项目”设置中找到“构建设置”部分,并修改构建目录。
- 默认构建路径:
-
命令行编译的情况
- 使用 qmake:
- 如果您通过命令行使用
qmake
生成 Makefile,并使用make
进行编译,编译生成的文件(如.o
文件、可执行文件等)的存放位置将取决于 Makefile 中的配置。 - 默认情况下,编译中间产物(如
.o
文件)可能存放在项目的源代码目录中,或者由 Makefile 指定的其他目录中。 - 最终的可执行文件通常会存放在项目的源代码目录中,或者由 Makefile 中的
DESTDIR
变量指定的目录中。
- 如果您通过命令行使用
- 自定义构建路径:
- 您可以在运行
qmake
时通过命令行选项指定构建目录,或者在生成的 Makefile 中修改构建路径。
- 您可以在运行
- 使用 qmake:
查找编译生成的文件
- 使用 Qt Creator:
- 您可以在 Qt Creator 的“项目”视图中查看构建目录和生成的文件。
- 使用命令行:
- 您可以在命令行中导航到构建目录,并使用
ls
或find
命令查找生成的文件。
- 您可以在命令行中导航到构建目录,并使用
总结
在 Qt 编译过程中,编译生成的文件(包括中间产物和最终的可执行文件)的存放位置取决于您的构建配置和工具选项。如果您使用了 Qt Creator,可以通过项目设置中的构建设置来查看和修改构建目录。如果您使用了命令行工具(如 qmake
和 make
),则可以通过 Makefile 或命令行选项来指定构建目录。无论使用哪种方法,您都可以方便地查找和管理编译生成的文件。
4.把qtcharts 编译安装
要在 Ubuntu 上编译安装 QtCharts,您可以按照以下步骤进行操作。QtCharts 是 Qt 框架的一个模块,提供了一套易于使用的图表组件。以下是一个通用的编译安装指南:
一、安装 Qt 开发环境
-
下载并安装 Qt
-
访问 Qt 官方网站 下载适合您操作系统的 Qt 安装包。确保下载的开发工具中包含 QtCharts 模块(Qt 6.x 或更高版本通常默认包含该模块)。
-
双击安装包并按照向导提示进行安装。安装过程中,请确保选择“Custom”或“Advanced”安装选项,并勾选 QtCharts 组件。
-
-
安装必要的工具和依赖
-
确保系统安装了
build-essential
、perl
、git
等编译工具和依赖。您可以通过以下命令安装这些工具:sudo apt update sudo apt install build-essential perl git
-
二、获取 QtCharts 源码
-
从 GitHub 获取源码
-
使用
git
克隆 QtCharts 的源码仓库:git clone https://github.com/qtproject/qtcharts.git cd qtcharts
-
切换到与您的 Qt 版本兼容的分支或标签。例如,如果您使用的是 Qt 6.x,可以切换到相应的分支:
git checkout v6.x.x # 替换为实际的版本标签或分支名
-
三、配置编译环境
-
使用
qmake
生成构建文件-
进入源码目录后,运行
qmake
生成构建文件。确保您的 Qt 环境变量已正确设置,以便qmake
能够找到您的 Qt 安装路径。qmake
-
四、编译 QtCharts
-
使用
make
进行编译-
在生成构建文件后,运行
make
进行编译:make
-
编译过程可能需要一些时间,具体时间取决于您的系统性能和源码的复杂性。
-
五、安装 QtCharts
-
使用
make install
安装模块-
编译完成后,运行
make install
将 QtCharts 模块安装到您的 Qt 安装目录中。sudo make install
-
默认情况下,
make install
会将模块安装到/usr/local/Qt-<version>/
或类似路径下。如果您使用的是 Qt 的官方安装包,安装路径可能会有所不同。
-
六、验证安装
-
检查安装是否成功
-
您可以通过以下方式验证 QtCharts 是否已成功安装:
-
在 Qt Creator 中新建一个项目,并在
.pro
文件中添加QT += charts
。 -
尝试编译和运行一个简单的图表示例程序,确保没有编译错误,并且图表能够正确显示。
-
-
七、安装帮助文档(可选)
-
编译并安装帮助文档
-
如果您希望查看 QtCharts 的帮助文档,可以在编译时添加
docs
参数:make docs
-
编译完成后,将生成的帮助文档复制到您的 Qt 文档目录中。
-
注意事项
-
Qt 版本兼容性:确保您使用的 QtCharts 版本与 Qt 开发环境版本兼容。
-
环境变量:确保您的环境变量已正确设置,以便
qmake
和编译器能够找到您的 Qt 安装路径。 -
编译选项:根据需要,您可以使用
qmake
的不同选项来配置编译环境,例如调试模式、发布模式等。 -
权限问题:在某些情况下,您可能需要使用
sudo
来运行make install
,以确保具有足够的权限将模块安装到系统目录中。
通过以上步骤,您应该能够在 Ubuntu 上成功编译和安装 QtCharts 模块。如果您遇到任何问题,请查阅 Qt 官方文档或社区论坛寻求帮助。
5. qtcharts-everywhere-src-6.7.2.tar.xz 编译安装
要编译安装 qtcharts-everywhere-src-6.7.2.tar.xz
,您可以按照以下步骤进行操作。这些步骤基于通用的 Qt 源码编译安装流程,并结合了 QtCharts 的特点。
一、准备工作
-
下载源码包
- 确保您已经从可靠的来源下载了
qtcharts-everywhere-src-6.7.2.tar.xz
源码包。
- 确保您已经从可靠的来源下载了
-
安装依赖
-
在开始编译之前,确保您的系统上已经安装了必要的依赖项。对于 Ubuntu 系统,您可以使用以下命令安装常用的编译工具和库:
sudo apt update sudo apt install build-essential perl git python3
-
注意:QtCharts 的编译可能还需要其他特定的依赖项,这取决于您的 Qt 版本和配置。如果遇到编译错误,请查阅相关的错误日志和 Qt 官方文档,以获取更具体的依赖项信息。
-
二、解压源码包
-
解压源码包
-
使用
tar
命令解压下载的源码包:tar -xvf qtcharts-everywhere-src-6.7.2.tar.xz
-
这将创建一个名为
qtcharts-everywhere-src-6.7.2
的目录,包含 QtCharts 的源码。
-
三、配置编译环境
-
进入源码目录
-
切换到解压后的源码目录:
cd qtcharts-everywhere-src-6.7.2
-
-
运行
configure
脚本-
在源码目录中,运行
configure
脚本以配置编译环境。您可能需要指定一些编译选项,例如安装前缀、构建类型(调试或发布)等。以下是一个简单的示例:./configure -prefix /opt/qtcharts-6.7.2 -release -opensource -confirm-license
-
-prefix
选项指定了 QtCharts 的安装目录。 -
-release
选项指定了构建类型为发布版本。 -
-opensource
选项指定了使用开源许可证。 -
-confirm-license
选项自动确认许可协议。 -
注意:具体的编译选项可能因您的 Qt 版本和配置而有所不同。您可以运行
./configure -h
查看所有可用的编译选项。
-
四、编译源码
-
编译源码
-
在配置完成后,使用
make
命令编译源码:make -j$(nproc)
-
-j$(nproc)
选项指定了使用与您的 CPU 核心数相同的并行作业数,以加快编译速度。
-
五、安装 QtCharts
-
安装编译好的模块
-
编译完成后,使用
make install
命令将 QtCharts 安装到指定的目录:sudo make install
-
这将把 QtCharts 的库文件、头文件和文档等安装到您在
configure
脚本中指定的目录(例如/opt/qtcharts-6.7.2
)。
-
六、验证安装
-
检查安装
- 您可以检查安装目录中的文件,确保 QtCharts 已成功安装。
-
配置环境变量
-
为了使系统能够找到新安装的 QtCharts 模块,您可能需要更新环境变量。例如,将 QtCharts 的库文件目录添加到
LD_LIBRARY_PATH
环境变量中:export LD_LIBRARY_PATH=/opt/qtcharts-6.7.2/lib:$LD_LIBRARY_PATH
-
将 QtCharts 的头文件目录添加到
CPPFLAGS
环境变量中:export CPPFLAGS="-I/opt/qtcharts-6.7.2/include $CPPFLAGS"
-
您可以将这些环境变量添加到您的 shell 配置文件中(例如
.bashrc
或.zshrc
),以便每次打开终端时自动加载。
-
-
测试使用
- 创建一个新的 Qt 项目,并在
.pro
文件中添加QT += charts
,然后尝试编译和运行一个简单的图表示例程序,以确保 QtCharts 模块能够正常工作。
- 创建一个新的 Qt 项目,并在
注意事项
- 权限问题:在运行
configure
和make install
命令时,您可能需要使用sudo
来获得足够的权限。 - 依赖冲突:如果您的系统上已经安装了其他版本的 Qt 或 QtCharts,可能会遇到依赖冲突。在这种情况下,您可以考虑使用虚拟环境或容器技术(如 Docker)来隔离编译环境。
- 编译选项:根据您的具体需求和系统环境,您可能需要调整
configure
脚本中的编译选项。
通过以上步骤,您应该能够在 Ubuntu 系统上成功编译和安装 qtcharts-everywhere-src-6.7.2.tar.xz
。如果遇到任何问题,请查阅 Qt 官方文档或社区论坛以获取更多帮助。
6.如果qt 已经安装完了,这里QtCharts 的安装目录如何设置
如果您已经安装了 Qt,并且希望安装 QtCharts 模块,安装目录的设置可以通过 configure
脚本中的 -prefix
选项来完成。以下是如何设置 QtCharts 安装目录的具体步骤:
1. 进入 QtCharts 源码目录
首先,确保您已经解压了 qtcharts-everywhere-src-6.7.2.tar.xz
源码包,并进入了解压后的目录。
cd qtcharts-everywhere-src-6.7.2
2. 运行 configure
脚本并设置安装目录
在源码目录中,运行 configure
脚本,并使用 -prefix
选项来指定 QtCharts 的安装目录。例如,如果您希望将 QtCharts 安装到 /opt/qtcharts-6.7.2
目录下,可以运行以下命令:
./configure -prefix /opt/qtcharts-6.7.2 -release -opensource -confirm-license
-prefix /opt/qtcharts-6.7.2
:指定 QtCharts 的安装目录。-release
:指定构建类型为发布版本。-opensource
:指定使用开源许可证。-confirm-license
:自动确认许可协议。
3. 编译和安装 QtCharts
在配置完成后,使用 make
命令编译源码,并使用 make install
命令将 QtCharts 安装到指定的目录:
make -j$(nproc) # 使用与 CPU 核心数相同的并行作业数加快编译速度
sudo make install
4. 验证安装
安装完成后,您可以检查 /opt/qtcharts-6.7.2
目录下的文件,确保 QtCharts 已成功安装。同时,您还可以创建一个新的 Qt 项目,并在 .pro
文件中添加 QT += charts
,然后尝试编译和运行一个简单的图表示例程序,以确保 QtCharts 模块能够正常工作。
注意事项
- 权限问题:在运行
configure
和make install
命令时,您可能需要使用sudo
来获得足够的权限,尤其是在将 QtCharts 安装到系统目录(如/opt
)时。 - 环境变量:为了确保系统能够找到新安装的 QtCharts 模块,您可能需要更新环境变量。例如,将 QtCharts 的库文件目录添加到
LD_LIBRARY_PATH
环境变量中,将 QtCharts 的头文件目录添加到CPPFLAGS
环境变量中。 - 依赖冲突:如果您的系统上已经安装了其他版本的 Qt 或 QtCharts,可能会遇到依赖冲突。在这种情况下,您可以考虑使用虚拟环境或容器技术(如 Docker)来隔离编译环境。
通过以上步骤,您可以灵活地设置 QtCharts 的安装目录,并根据您的具体需求和系统环境进行调整。
7.QT += charts 会去什么目录找 charts的支持库和头文件
当您在 Qt 项目的 .pro
文件中添加 QT += charts
时,Qt 构建系统会自动处理对 QtCharts 模块的支持库和头文件的查找。具体来说,Qt 构建系统会按照以下步骤进行:
-
查找模块配置文件:
- Qt 构建系统会查找与
charts
模块相关的配置文件。这些配置文件通常位于 Qt 安装目录的mkspecs/modules
目录下。 - 对于
charts
模块,Qt 构建系统会查找类似qt_lib_charts.pri
的文件。这个文件包含了 QtCharts 模块所需的支持库和头文件的路径。
- Qt 构建系统会查找与
-
加载模块配置文件:
- Qt 构建系统加载并解析
qt_lib_charts.pri
文件。该文件会指定 QtCharts 模块的头文件路径和库文件路径。
- Qt 构建系统加载并解析
-
更新项目配置:
- 根据
qt_lib_charts.pri
文件提供的信息,Qt 构建系统会更新项目配置,将 QtCharts 模块的头文件路径和库文件路径添加到项目的搜索路径中。 - 这意味着,在编译和链接阶段,Qt 构建系统会自动在这些路径中查找 QtCharts 模块所需的头文件和库文件。
- 根据
-
编译和链接:
- 在编译阶段,编译器会在指定的头文件路径中查找 QtCharts 模块的头文件。
- 在链接阶段,链接器会在指定的库文件路径中查找 QtCharts 模块的库文件,并将其链接到最终的可执行文件中。
总结:
QT += charts
会告诉 Qt 构建系统去查找与charts
模块相关的配置文件。- 这些配置文件通常位于 Qt 安装目录的
mkspecs/modules
目录下,并包含 QtCharts 模块的头文件路径和库文件路径。 - Qt 构建系统会根据这些信息自动更新项目配置,确保编译器和链接器能够找到 QtCharts 模块所需的头文件和库文件。
注意事项:
- 确保您的 Qt 安装包含了 QtCharts 模块。如果没有,您可能需要重新安装 Qt 并选择包含 QtCharts 模块的组件。
- 在某些情况下,您可能需要手动设置 QtCharts 模块的头文件路径和库文件路径。这通常是在使用自定义构建的 Qt 版本或特定平台时可能遇到的情况。然而,在大多数情况下,使用
QT += charts
就足够了。
8.补充安装qtcharts-everywhere-src-6.7.2.tar.xz,如何安装
qt 已经安装完了,补充安装qtcharts-everywhere-src-6.7.2.tar.xz,如何安装,假设之前qt的安装目录是 qt-6-7-2
要补充安装 qtcharts-everywhere-src-6.7.2.tar.xz
到已经安装好的 Qt 目录(假设为 qt-6-7-2
),您可以按照以下步骤进行:
一、准备工作
- 下载源码包:
- 确保已经下载了
qtcharts-everywhere-src-6.7.2.tar.xz
源码包。
- 确保已经下载了
- 解压源码包:
- 使用
tar
命令解压源码包:tar xf qtcharts-everywhere-src-6.7.2.tar.xz
- 使用
二、配置编译选项
- 进入源码目录:
- 解压后,进入解压出的源码目录:
cd qtcharts-everywhere-src-6.7.2
- 解压后,进入解压出的源码目录:
- 运行
configure
脚本:- 运行
configure
脚本以配置编译选项。这里需要指定 Qt 的安装目录(假设为qt-6-7-2
),以及 QtCharts 的安装目录(可以根据需要自定义):./configure -prefix /path/to/qtcharts-install -qt-libpath /path/to/qt-6-7-2/lib -qt-headerpath /path/to/qt-6-7-2/include
-prefix /path/to/qtcharts-install
:指定 QtCharts 的安装目录。-qt-libpath /path/to/qt-6-7-2/lib
:指定 Qt 库文件的路径。-qt-headerpath /path/to/qt-6-7-2/include
:指定 Qt 头文件的路径。- 根据实际情况,替换
/path/to/qtcharts-install
、/path/to/qt-6-7-2/lib
和/path/to/qt-6-7-2/include
为正确的路径。
- 运行
三、编译和安装
- 编译源码:
- 使用
make
命令编译源码。为了加快编译速度,可以指定并行作业数(假设为与 CPU 核心数相同):make -j$(nproc)
- 使用
- 安装 QtCharts:
- 编译完成后,使用
make install
命令将 QtCharts 安装到指定的目录:sudo make install
- 编译完成后,使用
四、验证安装
- 检查安装目录:
- 确保 QtCharts 已成功安装到指定的目录,检查该目录下的文件。
- 配置项目:
- 在您的 Qt 项目中,添加
QT += charts
到.pro
文件中。 - 确保编译器和链接器能够在指定的路径中找到 QtCharts 的头文件和库文件。
- 在您的 Qt 项目中,添加
五、注意事项
- 环境变量:
- 如果需要,您可能需要更新系统的环境变量,例如
PATH
和LD_LIBRARY_PATH
,以确保系统能够找到新安装的 QtCharts 模块。
- 如果需要,您可能需要更新系统的环境变量,例如
- 依赖关系:
- 确保您的 Qt 安装包含了所有必要的依赖项,以便成功编译和安装 QtCharts。
- 权限问题:
- 在运行
configure
和make install
命令时,您可能需要使用sudo
来获得足够的权限。
- 在运行
通过以上步骤,您应该能够成功安装 qtcharts-everywhere-src-6.7.2.tar.xz
到已经安装好的 Qt 目录,并在您的 Qt 项目中使用 QtCharts 模块。
5.过程笔记
1.包含了无效的参数nomake
topeet@topeet:~/qti/qt672$ ./autoconfig.sh
+ mkdir -p qtbase
+ cd qtbase
+ exec /home/topeet/qti/qt672/qtbase/configure -top-level -release -confirm-license -no-warnings-are-errors -prefix /home/topeet/Qt/qt672 -platform linux-g++ -opengl es2 -eglfs -xcb nomake examples nomake tests skip qt3d
CMake Error at qtbase/cmake/QtProcessConfigureArgs.cmake:345 (message):
Invalid command line parameter 'nomake'.
Call Stack (most recent call first):
qtbase/cmake/QtProcessConfigureArgs.cmake:704 (qtConfAddError)
解决:删除无效的参数就行了
根据你提供的错误信息,问题出在./autoconfig.sh
脚本中执行configure
命令时,包含了无效的参数nomake examples
和nomake tests
。
在较新的Qt版本中,configure
脚本可能已经不再支持nomake
选项。这个选项过去常用于跳过构建示例(examples)和测试(tests),但现在可能需要通过其他方式来实现类似的功能。
解决方法
-
检查Qt版本和文档
确认你正在使用的Qt版本(比如Qt 6.7.2)是否支持nomake
参数。可以查看Qt官方文档或运行以下命令查看支持的配置选项:./configure -help
-
移除无效参数
如果nomake
参数已不被支持,可以直接从脚本中移除这些选项。例如,将脚本中的配置命令修改为:./configure -top-level -release -confirm-license -no-warnings-are-errors -prefix /home/topeet/Qt/qt672 -platform linux-g++ -opengl es2 -eglfs -xcb skip qt3d
-
手动控制构建内容
如果需要跳过示例和测试,可以在构建过程中通过make
命令控制。例如,构建时只针对特定模块或目标执行。 -
更新构建脚本
如果你是从Qt官方获取的源码,建议检查是否有更新的autoconfig.sh
脚本,或者参考Qt官方推荐的构建步骤,可能需要调整你的脚本内容。 -
使用CMake配置
较新的Qt版本更倾向于使用CMake进行配置和构建。可以考虑直接使用CMake命令来替代传统的configure
方式。例如:mkdir build cd build cmake .. -DCMAKE_INSTALL_PREFIX=/home/topeet/Qt/qt672 -DCMAKE_BUILD_TYPE=Release -DQT_OPENGL=es2 -DQT_EGLFS=ON
总结
你的问题主要是由于无效的nomake
参数导致的,可以通过移除这些参数或者使用CMake配置来解决。建议仔细检查Qt版本的构建文档,确保使用的配置命令与目标版本兼容。
2.几个问题需要解决
topeet@topeet:~/qti/qt672$ ./autoconfig.sh
+ mkdir -p qtbase
+ cd qtbase
+ exec /home/topeet/qti/qt672/qtbase/configure -top-level -release -confirm-license -no-warnings-are-errors -prefix /home/topeet/Qt/qt672 -platform linux-g++ -opengl es2 -eglfs -xcb -skip qt3d
'/usr/bin/cmake' '-DBUILD_qt3d=OFF' '-DQT_INTERNAL_CALLED_FROM_CONFIGURE:BOOL=TRUE' '-DWARNINGS_ARE_ERRORS=OFF' '-DCMAKE_INSTALL_PREFIX=/home/topeet/Qt/qt672' '-DQT_QMAKE_TARGET_MKSPEC=linux-g++' '-DCMAKE_BUILD_TYPE=Release' '-DINPUT_opengl=es2' '-DINPUT_eglfs=yes' '-DINPUT_xcb=yes' '-G' 'Unix Makefiles' '/home/topeet/qti/qt672'
-- The CXX compiler identification is GNU 11.4.0
-- The C compiler identification is GNU 11.4.0
-- The ASM compiler identification is GNU
-- Found assembler: /usr/bin/cc
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Checking dependencies of submodule 'qtbase'
-- Checking dependencies of submodule 'qtimageformats'
-- Checking dependencies of submodule 'qtlanguageserver'
-- Checking dependencies of submodule 'qtshadertools'
-- Checking dependencies of submodule 'qtsvg'
-- Checking dependencies of submodule 'qtdeclarative'
-- Checking dependencies of submodule 'qt5compat'
-- Checking dependencies of submodule 'qtactiveqt'
-- Checking dependencies of submodule 'qtquicktimeline'
-- Checking dependencies of submodule 'qtquick3d'
-- Checking dependencies of submodule 'qtmultimedia'
-- Checking dependencies of submodule 'qtcharts'
-- Checking dependencies of submodule 'qtcoap'
-- Checking dependencies of submodule 'qtconnectivity'
-- Checking dependencies of submodule 'qtdatavis3d'
-- Checking dependencies of submodule 'qtgraphs'
-- Checking dependencies of submodule 'qtwebsockets'
-- Checking dependencies of submodule 'qthttpserver'
-- Checking dependencies of submodule 'qtserialport'
-- Checking dependencies of submodule 'qtpositioning'
-- Checking dependencies of submodule 'qtlocation'
-- Checking dependencies of submodule 'qttools'
-- Checking dependencies of submodule 'qtwebchannel'
-- Checking dependencies of submodule 'qtwebengine'
-- Checking dependencies of submodule 'qtdoc'
-- Checking dependencies of submodule 'qtgrpc'
-- Checking dependencies of submodule 'qtlottie'
-- Checking dependencies of submodule 'qtmqtt'
-- Checking dependencies of submodule 'qtnetworkauth'
-- Checking dependencies of submodule 'qtopcua'
-- Checking dependencies of submodule 'qtquick3dphysics'
-- Checking dependencies of submodule 'qtquickeffectmaker'
-- Checking dependencies of submodule 'qtremoteobjects'
-- Checking dependencies of submodule 'qtscxml'
-- Checking dependencies of submodule 'qtsensors'
-- Checking dependencies of submodule 'qtserialbus'
-- Checking dependencies of submodule 'qtspeech'
-- Checking dependencies of submodule 'qttranslations'
-- Checking dependencies of submodule 'qtvirtualkeyboard'
-- Checking dependencies of submodule 'qtwayland'
-- Checking dependencies of submodule 'qtwebview'
-- Configuring submodule 'qtbase'
CMake Warning at qtbase/cmake/QtBuildHelpers.cmake:12 (message):
The officially supported CMake generator for building Qt is Ninja / Ninja
Multi-Config. You are using: 'Unix Makefiles' instead. Thus, you might
encounter issues. Use at your own risk.
Call Stack (most recent call first):
qtbase/cmake/QtBuildHelpers.cmake:381 (qt_internal_validate_cmake_generator)
qtbase/cmake/QtBuild.cmake:4 (qt_internal_setup_build_and_global_variables)
qtbase/cmake/QtSetup.cmake:6 (include)
qtbase/cmake/QtBuildRepoHelpers.cmake:21 (include)
qtbase/cmake/QtBuildRepoHelpers.cmake:179 (qt_build_internals_set_up_private_api)
qtbase/cmake/QtBaseHelpers.cmake:154 (qt_build_repo_begin)
qtbase/CMakeLists.txt:32 (qt_internal_qtbase_build_repo)
-- [QtBase] CMAKE_BUILD_TYPE was already explicitly set to: 'Release'
-DCMAKE_C_FLAGS_DEBUG=-g
-DCMAKE_C_FLAGS_RELEASE=-O3 -DNDEBUG
-DCMAKE_C_FLAGS_RELWITHDEBINFO=-O2 -g -DNDEBUG
-DCMAKE_CXX_FLAGS_DEBUG=-g
-DCMAKE_CXX_FLAGS_RELEASE=-O3 -DNDEBUG
-DCMAKE_CXX_FLAGS_RELWITHDEBINFO=-O2 -g -DNDEBUG
-DCMAKE_OBJCOPY=/usr/bin/objcopy
-DCMAKE_C_STANDARD=11
-DCMAKE_C_STANDARD_REQUIRED=ON
-DCMAKE_CXX_STANDARD=17
-DCMAKE_CXX_STANDARD_REQUIRED=ON
-DCMAKE_MODULE_PATH:STRING=/home/topeet/qti/qt672/qtbase/cmake/platforms
CMake Error at qtbase/cmake/QtBuildInformation.cmake:522 (message):
Feature "xcb": Forcing to "ON" breaks its condition:
QT_FEATURE_thread AND TARGET XCB::XCB AND TEST_xcb_syslibs AND QT_FEATURE_xkbcommon_x11
Condition values dump:
QT_FEATURE_thread = "ON"
TARGET XCB::XCB found
TEST_xcb_syslibs = "FALSE"
QT_FEATURE_xkbcommon_x11 not evaluated
Call Stack (most recent call first):
qtbase/cmake/QtFeature.cmake:322 (qt_configure_add_report_error)
qtbase/cmake/QtFeature.cmake:442 (qt_feature_check_and_save_internal_value)
qtbase/cmake/QtFeature.cmake:711 (qt_evaluate_feature)
qtbase/cmake/QtFeature.cmake:680 (qt_feature_module_end)
qtbase/src/CMakeLists.txt:13 (qt_feature_evaluate_features)
-- Configuring submodule 'qtimageformats'
-- Configuring submodule 'qtlanguageserver'
-- Configuring submodule 'qtshadertools'
-- Configuring submodule 'qtsvg'
-- Configuring submodule 'qtdeclarative'
-- Configuring submodule 'qt5compat'
CMake Warning (dev) at qtbase/lib/cmake/Qt6Qml/Qt6QmlBuildInternals.cmake:423 (message):
INSTALL_SOURCE_QMLTYPES option is deprecated and should not be used.
Please port your module to use declarative type registration.
Call Stack (most recent call first):
qt5compat/src/imports/graphicaleffects5/CMakeLists.txt:36 (qt_internal_add_qml_module)
This warning is for project developers. Use -Wno-dev to suppress it.
-- Configuring submodule 'qtactiveqt'
Condition "WIN32" is not met, enabling documentation build only.
-- Configuring submodule 'qtquicktimeline'
-- Configuring submodule 'qtquick3d'
-- Configuring submodule 'qtmultimedia'
-- Configuring submodule 'qtcharts'
-- Found XKB: /usr/lib/aarch64-linux-gnu/libxkbcommon.so (found suitable version "1.4.0", minimum required is "0.5.0")
-- Configuring submodule 'qtcoap'
-- Configuring submodule 'qtconnectivity'
-- Configuring submodule 'qtdatavis3d'
-- Configuring submodule 'qtgraphs'
-- Configuring submodule 'qtwebsockets'
CMake Warning (dev) at qtbase/lib/cmake/Qt6Qml/Qt6QmlBuildInternals.cmake:423 (message):
INSTALL_SOURCE_QMLTYPES option is deprecated and should not be used.
Please port your module to use declarative type registration.
Call Stack (most recent call first):
qtwebsockets/src/imports/qmlwebsockets/CMakeLists.txt:4 (qt_internal_add_qml_module)
This warning is for project developers. Use -Wno-dev to suppress it.
-- Configuring submodule 'qthttpserver'
-- Configuring submodule 'qtserialport'
-- Configuring submodule 'qtpositioning'
-- Configuring submodule 'qtlocation'
-- Configuring submodule 'qttools'
-- Could NOT find Clang (missing: Clang_DIR)
-- Could NOT find Clang (missing: Clang_DIR)
-- Configuring submodule 'qtwebchannel'
-- Configuring submodule 'qtwebengine'
Traceback (most recent call last):
File "<string>", line 1, in <module>
ModuleNotFoundError: No module named 'html5lib'
[QtWebEngine] -- Checking 'ulimit -n'
[QtWebEngine] -- Open files limit 1024
[QtWebEngine] -- Creating linker launcher
[QtWebEngine] -- Support check for QtWebEngine failed: node.js version 14 or later is required.
[QtWebEngine] -- Support check for QtPdf failed: node.js version 14 or later is required.
-- Configuring submodule 'qtdoc'
-- Configuring submodule 'qtgrpc'
-- Configuring submodule 'qtlottie'
-- Configuring submodule 'qtmqtt'
-- Configuring submodule 'qtnetworkauth'
-- Configuring submodule 'qtopcua'
-- Configuring submodule 'qtquick3dphysics'
-- Configuring submodule 'qtquickeffectmaker'
Nodes path: ./qml/QtQuickEffectMaker/defaultnodes
-- Configuring submodule 'qtremoteobjects'
-- Configuring submodule 'qtscxml'
-- Configuring submodule 'qtsensors'
-- Configuring submodule 'qtserialbus'
-- Configuring submodule 'qtspeech'
-- Configuring submodule 'qttranslations'
-- Configuring submodule 'qtvirtualkeyboard'
-- Configuring submodule 'qtwayland'
CMake Warning (dev) at qtbase/lib/cmake/Qt6Qml/Qt6QmlBuildInternals.cmake:423 (message):
INSTALL_SOURCE_QMLTYPES option is deprecated and should not be used.
Please port your module to use declarative type registration.
Call Stack (most recent call first):
qtwayland/src/imports/compositor-extensions/xdgshell/CMakeLists.txt:10 (qt_internal_add_qml_module)
This warning is for project developers. Use -Wno-dev to suppress it.
CMake Warning (dev) at qtbase/lib/cmake/Qt6Qml/Qt6QmlBuildInternals.cmake:423 (message):
INSTALL_SOURCE_QMLTYPES option is deprecated and should not be used.
Please port your module to use declarative type registration.
Call Stack (most recent call first):
qtwayland/src/imports/compositor-extensions/iviapplication/CMakeLists.txt:10 (qt_internal_add_qml_module)
This warning is for project developers. Use -Wno-dev to suppress it.
CMake Warning (dev) at qtbase/lib/cmake/Qt6Qml/Qt6QmlBuildInternals.cmake:423 (message):
INSTALL_SOURCE_QMLTYPES option is deprecated and should not be used.
Please port your module to use declarative type registration.
Call Stack (most recent call first):
qtwayland/src/imports/compositor-extensions/wlshell/CMakeLists.txt:10 (qt_internal_add_qml_module)
This warning is for project developers. Use -Wno-dev to suppress it.
CMake Warning (dev) at qtbase/lib/cmake/Qt6Qml/Qt6QmlBuildInternals.cmake:423 (message):
INSTALL_SOURCE_QMLTYPES option is deprecated and should not be used.
Please port your module to use declarative type registration.
Call Stack (most recent call first):
qtwayland/src/imports/compositor-extensions/qtshell/CMakeLists.txt:8 (qt_internal_add_qml_module)
This warning is for project developers. Use -Wno-dev to suppress it.
-- Configuring submodule 'qtwebview'
-- Could NOT find Qt6WebEngineCore (missing: Qt6WebEngineCore_DIR)
CMake Warning at qtbase/lib/cmake/Qt6/Qt6Config.cmake:226 (message):
Failed to find optional Qt component "WebEngineCore".
Expected Config file at
"/home/topeet/qti/qt672/qtbase/lib/cmake/Qt6WebEngineCore/Qt6WebEngineCoreConfig.cmake"
does NOT exist
Call Stack (most recent call first):
qtwebview/CMakeLists.txt:15 (find_package)
-- Could NOT find Qt6WebEngineQuick (missing: Qt6WebEngineQuick_DIR)
CMake Warning at qtbase/lib/cmake/Qt6/Qt6Config.cmake:226 (message):
Failed to find optional Qt component "WebEngineQuick".
Expected Config file at
"/home/topeet/qti/qt672/qtbase/lib/cmake/Qt6WebEngineQuick/Qt6WebEngineQuickConfig.cmake"
does NOT exist
Call Stack (most recent call first):
qtwebview/CMakeLists.txt:15 (find_package)
-- Configuration summary shown below. It has also been written to /home/topeet/qti/qt672/config.summary
-- Configure with --log-level=STATUS or higher to increase CMake's message verbosity. The log level does not persist across reconfigurations.
-- Configure summary:
Building for: linux-g++ (arm64, CPU features: cx16 neon)
Compiler: gcc 11.4.0
Build options:
Mode ................................... release
Optimize release build for size ........ no
Fully optimize release builds (-O3) .... no
Building shared libraries .............. yes
Using ccache ........................... no
Unity Build ............................ no
Using new DTAGS ........................ yes
Relocatable ............................ yes
Using precompiled headers .............. yes
Using Link Time Optimization (LTCG) .... no
Using Intel CET ........................ no
Target compiler supports:
ARM Extensions ....................... NEON
Sanitizers:
Addresses ............................ no
Threads .............................. no
Memory ............................... no
Fuzzer (instrumentation only) ........ no
Undefined ............................ no
Build parts ............................ libs tools
Install examples sources ............... no
Qt modules and options:
Qt Concurrent .......................... yes
Qt D-Bus ............................... yes
Qt D-Bus directly linked to libdbus .... no
Qt Gui ................................. yes
Qt Network ............................. yes
Qt PrintSupport ........................ yes
Qt Sql ................................. yes
Qt Testlib ............................. yes
Qt Widgets ............................. yes
Qt Xml ................................. yes
Support enabled for:
Using pkg-config ....................... yes
Using vcpkg ............................ no
udev ................................... yes
OpenSSL ................................ yes
Qt directly linked to OpenSSL ........ no
OpenSSL 1.1 ............................ no
OpenSSL 3.0 ............................ yes
Using system zlib ...................... yes
Zstandard support ...................... no
Thread support ......................... yes
Common build options:
Linker can resolve circular dependencies yes
Qt Core:
backtrace .............................. yes
DoubleConversion ....................... yes
Using system DoubleConversion ........ no
CLONE_PIDFD support in forkfd .......... yes
GLib ................................... yes
ICU .................................... no
Using system libb2 ..................... no
Built-in copy of the MIME database ..... yes
Application permissions ................ yes
Defaulting legacy IPC to POSIX ......... no
Tracing backend ........................ <none>
OpenSSL based cryptographic hash ....... no
Logging backends:
journald ............................. no
syslog ............................... no
slog2 ................................ no
PCRE2 .................................. yes
Using system PCRE2 ................... yes
Qt Sql:
SQL item models ........................ yes
Qt Network:
getifaddrs() ........................... no
IPv6 ifname ............................ no
libproxy ............................... no
Linux AF_NETLINK ....................... yes
DTLS ................................... yes
OCSP-stapling .......................... yes
SCTP ................................... no
Use system proxies ..................... yes
GSSAPI ................................. no
Brotli Decompression Support ........... no
qIsEffectiveTLD() ...................... yes
Built-in publicsuffix database ....... yes
System publicsuffix database ......... yes
Core tools:
Android deployment tool ................ yes
macOS deployment tool .................. no
Windows deployment tool ................ no
qmake .................................. yes
Qt Gui:
Accessibility .......................... yes
FreeType ............................... yes
Using system FreeType ................ no
HarfBuzz ............................... yes
Using system HarfBuzz ................ no
Fontconfig ............................. no
Image formats:
GIF .................................. yes
ICO .................................. yes
JPEG ................................. yes
Using system libjpeg ............... yes
PNG .................................. yes
Using system libpng ................ yes
Text formats:
HtmlParser ........................... yes
CssParser ............................ yes
OdfWriter ............................ yes
MarkdownReader ....................... yes
Using system libmd4c ............... no
MarkdownWriter ....................... yes
EGL .................................... yes
OpenVG ................................. no
OpenGL:
Desktop OpenGL ....................... no
OpenGL ES 2.0 ........................ yes
OpenGL ES 3.0 ........................ yes
OpenGL ES 3.1 ........................ yes
OpenGL ES 3.2 ........................ yes
Vulkan ................................. no
Session Management ..................... yes
Features used by QPA backends:
evdev .................................. yes
libinput ............................... no
HiRes wheel support in libinput ........ no
INTEGRITY HID .......................... no
mtdev .................................. no
tslib .................................. no
xkbcommon .............................. yes
X11 specific:
XLib ................................. yes
XCB Xlib ............................. yes
EGL on X11 ........................... yes
xkbcommon-x11 ........................ yes
xcb-sm ............................... no
QPA backends:
DirectFB ............................... no
EGLFS .................................. yes
EGLFS details:
EGLFS OpenWFD ........................ no
EGLFS i.Mx6 .......................... no
EGLFS i.Mx6 Wayland .................. no
EGLFS RCAR ........................... no
EGLFS EGLDevice ...................... yes
EGLFS GBM ............................ yes
EGLFS VSP2 ........................... no
EGLFS Mali ........................... no
EGLFS Raspberry Pi ................... no
EGLFS X11 ............................ yes
LinuxFB ................................ yes
VNC .................................... yes
VK_KHR_display ......................... no
QNX:
lgmon ................................ no
IMF .................................. no
XCB:
Using system-provided xcb-xinput ..... no
GL integrations:
GLX Plugin ......................... no
XCB GLX .......................... no
EGL-X11 Plugin ..................... yes
Windows:
Direct 2D ............................ no
Direct 2D 1.1 ........................ no
DirectWrite .......................... no
DirectWrite 3 ........................ no
Qt Widgets:
GTK+ ................................... no
Styles ................................. Fusion Windows
Qt Testlib:
Tester for item models ................. yes
Batch tests ............................ no
Qt PrintSupport:
CUPS ................................... no
Qt Sql Drivers:
DB2 (IBM) .............................. no
InterBase .............................. no
MySql .................................. no
OCI (Oracle) ........................... no
ODBC ................................... no
PostgreSQL ............................. no
SQLite ................................. yes
Using system provided SQLite ......... no
Mimer .................................. no
Further Image Formats:
JasPer ................................. no
MNG .................................... no
TIFF ................................... yes
Using system libtiff ................. yes
WEBP ................................... yes
Using system libwebp ................. no
Qt QML:
QML network support .................... yes
QML debugging and profiling support .... yes
QML just-in-time compiler .............. yes
QML XML http request ................... yes
QML Locale ............................. yes
QML SSL support ........................ yes
Qt QML:
QML network support .................... yes
QML debugging and profiling support .... yes
QML just-in-time compiler .............. yes
QML XML http request ................... yes
QML Locale ............................. yes
QML SSL support ........................ yes
Qt QML Models:
QML list model ......................... yes
QML delegate model ..................... yes
Qt Quick:
AnimatedImage item ..................... yes
Canvas item ............................ yes
Support for Qt Quick Designer .......... yes
Flipable item .......................... yes
GridView item .......................... yes
ListView item .......................... yes
TableView item ......................... yes
TreeView item .......................... yes
Path support ........................... yes
PathView item .......................... yes
Positioner items ....................... yes
Repeater item .......................... yes
ShaderEffect item ...................... yes
Sprite item ............................ yes
Qt Quick Templates 2:
Hover support .......................... yes
Multi-touch support .................... yes
Calendar support ....................... yes
Qt Quick Controls 2:
Styles ................................. Basic Fusion Imagine Material Universal
Qt 5 Compatibility Libraries:
iconv .................................. yes
QtQuick3D:
Assimp ................................. yes
System Assimp .......................... no
Qt Multimedia:
Spatial Audio .......................... yes
Spatial Audio (Quick3D) ................ yes
Low level Audio Backend:
ALSA (experimental) .................. no
PulseAudio ........................... no
MMRenderer ........................... no
CoreAudio ............................ no
Windows Media SDK .................... no
Open SLES (Android) .................. no
Web Assembly ......................... no
Plugin:
GStreamer 1.0 ........................ yes
FFmpeg ............................... no
MMRenderer ........................... no
AVFoundation ......................... no
Windows Media Foundation ............. no
Hardware acceleration and features:
Video for Linux ...................... yes
VAAPI support ........................ no
Linux DMA buffer support ............. yes
VideoToolbox ......................... no
Qt Charts Types:
Area Chart ............................. yes
Line Chart ............................. yes
Spline Chart ........................... yes
Scatter Chart .......................... yes
Bar Chart .............................. yes
Pie Chart .............................. yes
Boxplot Chart .......................... yes
Candlestick Chart ...................... yes
Qt Axis Types:
DateTime Axis .......................... yes
Qt Bluetooth:
BlueZ .................................. no
BlueZ Low Energy ....................... no
Linux Crypto API ....................... no
WinRT Bluetooth API .................... no
Qt Graphs Support:
2D Graphs .............................. yes
3D Graphs .............................. yes
Qt Graphs 3D:
Bars3D ................................. yes
Scatter3D .............................. yes
Surface3D .............................. yes
Serial Port:
ntddmodm ............................... no
Qt Tools:
Qt Assistant ........................... yes
libclang found ......................... no
Clang-based lupdate parser ............. no
Qt Designer ............................ yes
Qt Distance Field Generator ............ yes
Qt Linguist ............................ yes
pixeltool .............................. yes
qdbus .................................. yes
QDoc ................................... no
Qt Attributions Scanner ................ yes
qtdiag ................................. yes
qtplugininfo ........................... yes
WebEngine Repository Build Options:
Build Ninja ............................ yes
Build Gn ............................... yes
Jumbo Build ............................ yes
Developer build ........................ no
Build QtWebEngine Modules:
Build QtWebEngineCore ................ no
Build QtWebEngineWidgets ............. no
Build QtWebEngineQuick ............... no
Build QtPdf Modules:
Build QtPdfWidgets ................... no
Build QtPdfQuick ..................... no
Optional system libraries:
re2 .................................. no
icu .................................. no
libwebp, libwebpmux and libwebpdemux . no
opus ................................. no
ffmpeg ............................... no
libvpx ............................... no
snappy ............................... no
glib ................................. yes
zlib ................................. yes
minizip .............................. no
libevent ............................. no
libxml2 and libxslt .................. no
lcms2 ................................ no
png .................................. yes
tiff ................................. yes
jpeg ................................. yes
libopenjpeg2 ......................... no
harfbuzz ............................. no
freetype ............................. no
libpci ............................... no
Qt Protobuf:
Qt Core types support .................. no
Qt Gui types support ................... no
Well-known types support ............... no
Qt Protobuf tools:
Qt Protobuf generator .................. no
Qt GRPC:
gRPC support ........................... yes
QML gRPC support ....................... yes
Qt GRPC tools:
Qt GRPC generator ...................... no
Qt Opcua:
Open62541 .............................. yes
Support for namespace 0 NodeId names ... yes
Internal code generator ................ no
Open62541 security support ............. yes
Support for global discovery server .... yes
Data type code generator ............... yes
Qt Remote Objects:
High Availability Manager (ham) ........ no
Qt Scxml:
ECMAScript data model for QtScxml ...... yes
Qt Sensors:
sensorfw ............................... no
sensorfw_enabled_with_cmake ............ no
Qt SerialBus:
Socket CAN ............................. yes
Socket CAN FD .......................... yes
SerialPort Support ..................... yes
Qt TextToSpeech:
Flite .................................. no
Flite with ALSA ........................ no
Speech Dispatcher ...................... no
Qt Virtualkeyboard:
Desktop integration .................... yes
Built-in layouts ....................... yes
Key navigation ......................... no
Retro style as default ................. no
Sensitive Debug ........................ no
Cerence ................................ no
Static Linking ....................... no
Handwriting .......................... no
Alphabetic ......................... no
CJK ................................ no
XT9 .................................. no
XT9 Debug .......................... no
XT9 9-key layouts .................. no
Bundle resources ..................... no
Handwriting ........................ no
XT9 ................................ no
Hunspell ............................... no
Using Hunspell copy from 3rdparty/ ... no
OpenWnn ................................ yes
MyScript ............................... no
Example HWR ............................ no
Language support enabled for:
Arabic ............................... yes
Bulgarian ............................ yes
Czech ................................ yes
Danish ............................... yes
German ............................... yes
Greek ................................ yes
English GB ........................... yes
English US ........................... yes
Spanish .............................. yes
Spanish Mexico ....................... yes
Estonian ............................. yes
Farsi ................................ yes
Finnish .............................. yes
French Canada ........................ yes
French France ........................ yes
Hebrew ............................... yes
Hindi ................................ yes
Croatian ............................. yes
Hungarian ............................ yes
Indonesian ........................... yes
Italian .............................. yes
Japanese ............................. yes
Korean ............................... yes
Malay ................................ yes
Norwegian ............................ yes
Dutch ................................ yes
Polish ............................... yes
Portuguese Brazil .................... yes
Portuguese Portugal .................. yes
Romanian ............................. yes
Russian .............................. yes
Slovak ............................... yes
Slovenian ............................ yes
Albanian ............................. yes
Serbian .............................. yes
Swedish .............................. yes
Thai ................................. yes
Turkish .............................. yes
Ukrainian ............................ yes
Vietnamese ........................... yes
Simplified Chinese ................... yes
Traditional Chinese .................. yes
HongKong Chinese ..................... no
Traditional chinese input methods:
Zhuyin ............................... yes
Cangjie .............................. yes
Qt Wayland Client ........................ yes
Qt Wayland Compositor .................... yes
Qt Wayland Drivers:
EGL .................................... yes
Raspberry Pi ........................... no
DRM EGL ................................ yes
libhybris EGL .......................... no
Linux dma-buf server buffer integration yes
Shm emulation server buffer integration yes
Vulkan-based server buffer integration . no
Qt Wayland Client Shell Integrations:
xdg-shell .............................. yes
ivi-shell .............................. yes
wl-shell (deprecated) .................. yes
qt-shell ............................... yes
Qt Wayland Compositor Layer Plugins:
VSP2 hardware layer integration ........ no
Note: Disabling X11 Accessibility Bridge: D-Bus or AT-SPI is missing.
Note: Hunspell in Qt Virtual Keyboard is not enabled. Spelling correction will not be available.
WARNING: No backend for low level audio found.
WARNING: QDoc will not be compiled, probably because clang's C and C++ libraries could not be located. This means that you cannot build the Qt documentation.
You may need to set CMAKE_PREFIX_PATH or LLVM_INSTALL_DIR to the location of your llvm installation.
Other than clang's libraries, you may need to install another package, such as clang itself, to provide the ClangConfig.cmake file needed to detect your libraries. Once this
file is in place, the configure script may be able to detect your system-installed libraries without further environment variables.
On macOS, you can use Homebrew's llvm package.
You will also need to set the FEATURE_clang CMake variable to ON to re-evaluate this check.
WARNING: Clang-based lupdate parser will not be available. Suitable LLVM and Clang C++ libraries have not been found.
You will need to set the FEATURE_clangcpp CMake variable to ON to re-evaluate this check.
WARNING: QtWebEngine won't be built. node.js version 14 or later is required.
WARNING: QtPdf won't be built. node.js version 14 or later is required.
WARNING: SensorFW support currently not enabled with cmake
ERROR: Feature "xcb": Forcing to "ON" breaks its condition:
QT_FEATURE_thread AND TARGET XCB::XCB AND TEST_xcb_syslibs AND QT_FEATURE_xkbcommon_x11
Condition values dump:
QT_FEATURE_thread = "ON"
TARGET XCB::XCB found
TEST_xcb_syslibs = "FALSE"
QT_FEATURE_xkbcommon_x11 not evaluated
CMake Error at qtbase/cmake/QtBuildInformation.cmake:208 (message):
Check the configuration messages for an error that has occurred.
Call Stack (most recent call first):
qtbase/cmake/QtBuildInformation.cmake:39 (qt_configure_print_summary)
qtbase/cmake/QtBaseTopLevelHelpers.cmake:84 (qt_print_feature_summary)
qtbase/cmake/QtBaseTopLevelHelpers.cmake:72 (qt_internal_print_top_level_info)
CMakeLists.txt:113 (qt_internal_top_level_end)
-- Configuring incomplete, errors occurred!
See also "/home/topeet/qti/qt672/CMakeFiles/CMakeOutput.log".
See also "/home/topeet/qti/qt672/CMakeFiles/CMakeError.log".
CMake Error at qtbase/cmake/QtProcessConfigureArgs.cmake:1077 (message):
CMake exited with code 1.
从你提供的输出中,有几个问题需要解决,特别是关于xcb
、QtWebEngine
、QtPdf
和Clang相关的问题。以下是一些建议来帮助你解决这些问题:
1. xcb 相关问题
错误信息显示,xcb
功能被强制开启,但缺少一些必要的条件。特别是TEST_xcb_syslibs
为FALSE
,这通常意味着缺少必要的系统库。
解决方法:
- 确保安装了所有必要的系统库。对于
xcb
,你可能需要安装libxcb
和libxcb-util
等库。可以使用包管理器安装,例如:sudo apt-get install libxcb1-dev libxcb-util0-dev
2. QtWebEngine 和 QtPdf 问题
这两个模块需要node.js
版本14或更高版本。
解决方法:
- 安装或更新
node.js
到版本14或更高。可以使用nvm
(Node Version Manager)来管理Node.js版本:curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")" [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" nvm install 14 nvm use 14
3. Clang 相关问题
qmake
在配置Qt时尝试使用Clang,但未能找到相关的库。
解决方法:
- 如果不需要Clang,可以通过设置环境变量来禁用它:
export FEATURE_clang=OFF
- 如果需要Clang,确保已安装Clang,并设置
LLVM_INSTALL_DIR
环境变量指向Clang的安装路径。
4. 使用 Ninja 构建
Qt建议使用Ninja构建系统,而不是传统的Makefiles。
解决方法:
- 尝试使用Ninja进行构建:
mkdir build cd build cmake .. -GNinja -DCMAKE_INSTALL_PREFIX=/home/topeet/Qt/qt672 -DCMAKE_BUILD_TYPE=Release -DQT_OPENGL=es2 -DQT_EGLFS=ON ninja ninja install
5. 检查其他依赖和警告
- 确保所有必要的依赖都已安装。
- 注意警告信息,例如关于
INSTALL_SOURCE_QMLTYPES
选项的警告,尽管这不会导致构建失败,但建议按照提示更新模块。
总结
解决上述问题后,重新运行配置脚本。确保所有依赖都已正确安装,并根据需要调整环境变量。使用Ninja进行构建可能会减少配置和构建过程中遇到的问题。
2.sudo apt-get install libxcb1-dev libxcb-util0-dev 这个命令执行,上面的问题就解决了
很高兴听到你已经解决了与xcb
相关的依赖问题。安装libxcb1-dev
和libxcb-util0-dev
通常可以解决与xcb
相关的配置错误。
然而,你的输出中还有其他一些警告和错误,例如关于QtWebEngine
、QtPdf
和Clang的。这些问题仍然需要解决。以下是一些针对这些问题的建议:
1. QtWebEngine 和 QtPdf
这两个模块需要node.js
版本14或更高版本。
解决方法:
- 安装或更新
node.js
到版本14或更高。可以使用nvm
(Node Version Manager)来管理Node.js版本:curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")" [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" nvm install 14 nvm use 14
2. Clang 相关问题
qmake
在配置Qt时尝试使用Clang,但未能找到相关的库。
解决方法:
- 如果不需要Clang,可以通过设置环境变量来禁用它:
export FEATURE_clang=OFF
- 如果需要Clang,确保已安装Clang,并设置
LLVM_INSTALL_DIR
环境变量指向Clang的安装路径。
3. 使用 Ninja 构建
Qt建议使用Ninja构建系统,而不是传统的Makefiles。
解决方法:
- 尝试使用Ninja进行构建:
mkdir build cd build cmake .. -GNinja -DCMAKE_INSTALL_PREFIX=/home/topeet/Qt/qt672 -DCMAKE_BUILD_TYPE=Release -DQT_OPENGL=es2 -DQT_EGLFS=ON ninja ninja install
4. 其他警告和注意事项
- 确保所有必要的依赖都已安装。
- 注意警告信息,例如关于
INSTALL_SOURCE_QMLTYPES
选项的警告,虽然这不会导致构建失败,但建议按照提示更新模块。 - 检查
CMakeOutput.log
和CMakeError.log
文件以获取更多关于错误的详细信息。
总结
解决上述问题后,重新运行配置脚本。确保所有依赖都已正确安装,并根据需要调整环境变量。使用Ninja进行构建可能会减少配置和构建过程中遇到的问题。如果还有其他问题,请根据错误日志中的信息进一步排查。
3.组件安装情况
topeet@topeet:~/qti/qt672$ ./autoconfig.sh
+ mkdir -p qtbase
+ cd qtbase
+ exec /home/topeet/qti/qt672/qtbase/configure -top-level -release -confirm-license -no-warnings-are-errors -prefix /home/topeet/Qt/qt672 -platform linux-g++ -opengl es2 -eglfs -xcb -skip qt3d
'/usr/bin/cmake' '-DBUILD_qt3d=OFF' '-DQT_INTERNAL_CALLED_FROM_CONFIGURE:BOOL=TRUE' '-DWARNINGS_ARE_ERRORS=OFF' '-DCMAKE_INSTALL_PREFIX=/home/topeet/Qt/qt672' '-DQT_QMAKE_TARGET_MKSPEC=linux-g++' '-DCMAKE_BUILD_TYPE=Release' '-DINPUT_opengl=es2' '-DINPUT_eglfs=yes' '-DINPUT_xcb=yes' '-G' 'Unix Makefiles' '/home/topeet/qti/qt672'
-- Checking dependencies of submodule 'qtbase'
-- Checking dependencies of submodule 'qtimageformats'
-- Checking dependencies of submodule 'qtlanguageserver'
-- Checking dependencies of submodule 'qtshadertools'
-- Checking dependencies of submodule 'qtsvg'
-- Checking dependencies of submodule 'qtdeclarative'
-- Checking dependencies of submodule 'qt5compat'
-- Checking dependencies of submodule 'qtactiveqt'
-- Checking dependencies of submodule 'qtquicktimeline'
-- Checking dependencies of submodule 'qtquick3d'
-- Checking dependencies of submodule 'qtmultimedia'
-- Checking dependencies of submodule 'qtcharts'
-- Checking dependencies of submodule 'qtcoap'
-- Checking dependencies of submodule 'qtconnectivity'
-- Checking dependencies of submodule 'qtdatavis3d'
-- Checking dependencies of submodule 'qtgraphs'
-- Checking dependencies of submodule 'qtwebsockets'
-- Checking dependencies of submodule 'qthttpserver'
-- Checking dependencies of submodule 'qtserialport'
-- Checking dependencies of submodule 'qtpositioning'
-- Checking dependencies of submodule 'qtlocation'
-- Checking dependencies of submodule 'qttools'
-- Checking dependencies of submodule 'qtwebchannel'
-- Checking dependencies of submodule 'qtwebengine'
-- Checking dependencies of submodule 'qtdoc'
-- Checking dependencies of submodule 'qtgrpc'
-- Checking dependencies of submodule 'qtlottie'
-- Checking dependencies of submodule 'qtmqtt'
-- Checking dependencies of submodule 'qtnetworkauth'
-- Checking dependencies of submodule 'qtopcua'
-- Checking dependencies of submodule 'qtquick3dphysics'
-- Checking dependencies of submodule 'qtquickeffectmaker'
-- Checking dependencies of submodule 'qtremoteobjects'
-- Checking dependencies of submodule 'qtscxml'
-- Checking dependencies of submodule 'qtsensors'
-- Checking dependencies of submodule 'qtserialbus'
-- Checking dependencies of submodule 'qtspeech'
-- Checking dependencies of submodule 'qttranslations'
-- Checking dependencies of submodule 'qtvirtualkeyboard'
-- Checking dependencies of submodule 'qtwayland'
-- Checking dependencies of submodule 'qtwebview'
-- Configuring submodule 'qtbase'
-- [QtBase] CMAKE_BUILD_TYPE was already explicitly set to: 'Release'
CMake Warning at qtbase/cmake/QtBuildHelpers.cmake:12 (message):
The officially supported CMake generator for building Qt is Ninja / Ninja
Multi-Config. You are using: 'Unix Makefiles' instead. Thus, you might
encounter issues. Use at your own risk.
Call Stack (most recent call first):
qtbase/cmake/QtBuildHelpers.cmake:381 (qt_internal_validate_cmake_generator)
qtbase/cmake/QtBuild.cmake:4 (qt_internal_setup_build_and_global_variables)
qtbase/cmake/QtSetup.cmake:6 (include)
qtbase/cmake/QtBuildRepoHelpers.cmake:21 (include)
qtbase/cmake/QtBuildRepoHelpers.cmake:179 (qt_build_internals_set_up_private_api)
qtbase/cmake/QtBaseHelpers.cmake:154 (qt_build_repo_begin)
qtbase/CMakeLists.txt:32 (qt_internal_qtbase_build_repo)
[QtBase] 'qtwebengine_build' was changed from OFF to ON
[QtBase] 'qtpdf_build' was changed from OFF to ON
[QtBase] 'qtwebengine_core_build' was changed from OFF to ON
[QtBase] 'qtwebengine_widgets_build' was changed from OFF to ON
[QtBase] 'qtwebengine_quick_build' was changed from OFF to ON
[QtBase] 'qtpdf_widgets_build' was changed from OFF to ON
[QtBase] 'qtpdf_quick_build' was changed from OFF to ON
CMake Warning at qtbase/cmake/QtFeature.cmake:910 (message):
Due to detected feature set changes, dependent features will be re-computed
automatically. This might cause a lot of files to be rebuilt. To disable
this behavior, configure with -DQT_NO_FEATURE_AUTO_RESET=ON
Call Stack (most recent call first):
qtbase/cmake/QtBuildHelpers.cmake:462 (qt_internal_detect_dirty_features)
qtbase/cmake/QtBuild.cmake:4 (qt_internal_setup_build_and_global_variables)
qtbase/cmake/QtSetup.cmake:6 (include)
qtbase/cmake/QtBuildRepoHelpers.cmake:21 (include)
qtbase/cmake/QtBuildRepoHelpers.cmake:179 (qt_build_internals_set_up_private_api)
qtbase/cmake/QtBaseHelpers.cmake:154 (qt_build_repo_begin)
qtbase/CMakeLists.txt:32 (qt_internal_qtbase_build_repo)
-DCMAKE_C_FLAGS_DEBUG=-g
-DCMAKE_C_FLAGS_RELEASE=-DNDEBUG -O2
-DCMAKE_C_FLAGS_RELWITHDEBINFO=-g -DNDEBUG -O2
-DCMAKE_CXX_FLAGS_DEBUG=-g
-DCMAKE_CXX_FLAGS_RELEASE=-DNDEBUG -O2
-DCMAKE_CXX_FLAGS_RELWITHDEBINFO=-g -DNDEBUG -O2
-DCMAKE_OBJCOPY=/usr/bin/objcopy
-DCMAKE_C_STANDARD=11
-DCMAKE_C_STANDARD_REQUIRED=ON
-DCMAKE_CXX_STANDARD=17
-DCMAKE_CXX_STANDARD_REQUIRED=ON
-DCMAKE_MODULE_PATH:STRING=/home/topeet/qti/qt672/qtbase/cmake/platforms
CMake Warning at qtbase/cmake/QtFeature.cmake:285 (message):
Resetting 'FEATURE_xcb' from 'ON' to 'OFF' because it doesn't meet its
condition after reconfiguration. Condition expression is:
'QT_FEATURE_thread;AND;TARGET;XCB::XCB;AND;TEST_xcb_syslibs;AND;QT_FEATURE_xkbcommon_x11'
Call Stack (most recent call first):
qtbase/cmake/QtFeature.cmake:434 (qt_feature_check_and_save_user_provided_value)
qtbase/cmake/QtFeature.cmake:711 (qt_evaluate_feature)
qtbase/cmake/QtFeature.cmake:680 (qt_feature_module_end)
qtbase/src/CMakeLists.txt:13 (qt_feature_evaluate_features)
-- Configuring submodule 'qtimageformats'
-- Configuring submodule 'qtlanguageserver'
-- Configuring submodule 'qtshadertools'
-- Configuring submodule 'qtsvg'
-- Configuring submodule 'qtdeclarative'
-- Configuring submodule 'qt5compat'
CMake Warning (dev) at qtbase/lib/cmake/Qt6Qml/Qt6QmlBuildInternals.cmake:423 (message):
INSTALL_SOURCE_QMLTYPES option is deprecated and should not be used.
Please port your module to use declarative type registration.
Call Stack (most recent call first):
qt5compat/src/imports/graphicaleffects5/CMakeLists.txt:36 (qt_internal_add_qml_module)
This warning is for project developers. Use -Wno-dev to suppress it.
-- Configuring submodule 'qtactiveqt'
Condition "WIN32" is not met, enabling documentation build only.
-- Configuring submodule 'qtquicktimeline'
-- Configuring submodule 'qtquick3d'
-- Configuring submodule 'qtmultimedia'
-- Configuring submodule 'qtcharts'
-- Found XKB: /usr/lib/aarch64-linux-gnu/libxkbcommon.so (found suitable version "1.4.0", minimum required is "0.5.0")
-- Configuring submodule 'qtcoap'
-- Configuring submodule 'qtconnectivity'
-- Configuring submodule 'qtdatavis3d'
-- Configuring submodule 'qtgraphs'
-- Configuring submodule 'qtwebsockets'
CMake Warning (dev) at qtbase/lib/cmake/Qt6Qml/Qt6QmlBuildInternals.cmake:423 (message):
INSTALL_SOURCE_QMLTYPES option is deprecated and should not be used.
Please port your module to use declarative type registration.
Call Stack (most recent call first):
qtwebsockets/src/imports/qmlwebsockets/CMakeLists.txt:4 (qt_internal_add_qml_module)
This warning is for project developers. Use -Wno-dev to suppress it.
-- Configuring submodule 'qthttpserver'
-- Configuring submodule 'qtserialport'
-- Configuring submodule 'qtpositioning'
-- Configuring submodule 'qtlocation'
-- Configuring submodule 'qttools'
-- Could NOT find Clang (missing: Clang_DIR)
-- Could NOT find Clang (missing: Clang_DIR)
-- Configuring submodule 'qtwebchannel'
-- Configuring submodule 'qtwebengine'
Traceback (most recent call last):
File "<string>", line 1, in <module>
ModuleNotFoundError: No module named 'html5lib'
[QtWebEngine] -- Checking 'ulimit -n'
[QtWebEngine] -- Open files limit 1024
[QtWebEngine] -- Creating linker launcher
[QtWebEngine] -- Support check for QtWebEngine failed: node.js version 14 or later is required.
[QtWebEngine] -- Support check for QtPdf failed: node.js version 14 or later is required.
-- Configuring submodule 'qtdoc'
-- Configuring submodule 'qtgrpc'
-- Configuring submodule 'qtlottie'
-- Configuring submodule 'qtmqtt'
-- Configuring submodule 'qtnetworkauth'
-- Configuring submodule 'qtopcua'
-- Configuring submodule 'qtquick3dphysics'
-- Configuring submodule 'qtquickeffectmaker'
Nodes path: qml/QtQuickEffectMaker/defaultnodes
-- Configuring submodule 'qtremoteobjects'
-- Configuring submodule 'qtscxml'
-- Configuring submodule 'qtsensors'
-- Configuring submodule 'qtserialbus'
-- Configuring submodule 'qtspeech'
-- Configuring submodule 'qttranslations'
-- Configuring submodule 'qtvirtualkeyboard'
-- Configuring submodule 'qtwayland'
CMake Warning (dev) at qtbase/lib/cmake/Qt6Qml/Qt6QmlBuildInternals.cmake:423 (message):
INSTALL_SOURCE_QMLTYPES option is deprecated and should not be used.
Please port your module to use declarative type registration.
Call Stack (most recent call first):
qtwayland/src/imports/compositor-extensions/xdgshell/CMakeLists.txt:10 (qt_internal_add_qml_module)
This warning is for project developers. Use -Wno-dev to suppress it.
CMake Warning (dev) at qtbase/lib/cmake/Qt6Qml/Qt6QmlBuildInternals.cmake:423 (message):
INSTALL_SOURCE_QMLTYPES option is deprecated and should not be used.
Please port your module to use declarative type registration.
Call Stack (most recent call first):
qtwayland/src/imports/compositor-extensions/iviapplication/CMakeLists.txt:10 (qt_internal_add_qml_module)
This warning is for project developers. Use -Wno-dev to suppress it.
CMake Warning (dev) at qtbase/lib/cmake/Qt6Qml/Qt6QmlBuildInternals.cmake:423 (message):
INSTALL_SOURCE_QMLTYPES option is deprecated and should not be used.
Please port your module to use declarative type registration.
Call Stack (most recent call first):
qtwayland/src/imports/compositor-extensions/wlshell/CMakeLists.txt:10 (qt_internal_add_qml_module)
This warning is for project developers. Use -Wno-dev to suppress it.
CMake Warning (dev) at qtbase/lib/cmake/Qt6Qml/Qt6QmlBuildInternals.cmake:423 (message):
INSTALL_SOURCE_QMLTYPES option is deprecated and should not be used.
Please port your module to use declarative type registration.
Call Stack (most recent call first):
qtwayland/src/imports/compositor-extensions/qtshell/CMakeLists.txt:8 (qt_internal_add_qml_module)
This warning is for project developers. Use -Wno-dev to suppress it.
-- Configuring submodule 'qtwebview'
-- Could NOT find Qt6WebEngineCore (missing: Qt6WebEngineCore_DIR)
CMake Warning at qtbase/lib/cmake/Qt6/Qt6Config.cmake:226 (message):
Failed to find optional Qt component "WebEngineCore".
Expected Config file at
"/home/topeet/qti/qt672/qtbase/lib/cmake/Qt6WebEngineCore/Qt6WebEngineCoreConfig.cmake"
does NOT exist
Call Stack (most recent call first):
qtwebview/CMakeLists.txt:15 (find_package)
-- Could NOT find Qt6WebEngineQuick (missing: Qt6WebEngineQuick_DIR)
CMake Warning at qtbase/lib/cmake/Qt6/Qt6Config.cmake:226 (message):
Failed to find optional Qt component "WebEngineQuick".
Expected Config file at
"/home/topeet/qti/qt672/qtbase/lib/cmake/Qt6WebEngineQuick/Qt6WebEngineQuickConfig.cmake"
does NOT exist
Call Stack (most recent call first):
qtwebview/CMakeLists.txt:15 (find_package)
-- Configuration summary shown below. It has also been written to /home/topeet/qti/qt672/config.summary
-- Configure with --log-level=STATUS or higher to increase CMake's message verbosity. The log level does not persist across reconfigurations.
-- Configure summary:
Building for: linux-g++ (arm64, CPU features: cx16 neon)
Compiler: gcc 11.4.0
Build options:
Mode ................................... release
Optimize release build for size ........ no
Fully optimize release builds (-O3) .... no
Building shared libraries .............. yes
Using ccache ........................... no
Unity Build ............................ no
Using new DTAGS ........................ yes
Relocatable ............................ yes
Using precompiled headers .............. yes
Using Link Time Optimization (LTCG) .... no
Using Intel CET ........................ no
Target compiler supports:
ARM Extensions ....................... NEON
Sanitizers:
Addresses ............................ no
Threads .............................. no
Memory ............................... no
Fuzzer (instrumentation only) ........ no
Undefined ............................ no
Build parts ............................ libs tools
Install examples sources ............... no
Qt modules and options:
Qt Concurrent .......................... yes
Qt D-Bus ............................... yes
Qt D-Bus directly linked to libdbus .... no
Qt Gui ................................. yes
Qt Network ............................. yes
Qt PrintSupport ........................ yes
Qt Sql ................................. yes
Qt Testlib ............................. yes
Qt Widgets ............................. yes
Qt Xml ................................. yes
Support enabled for:
Using pkg-config ....................... yes
Using vcpkg ............................ no
udev ................................... yes
OpenSSL ................................ yes
Qt directly linked to OpenSSL ........ no
OpenSSL 1.1 ............................ no
OpenSSL 3.0 ............................ yes
Using system zlib ...................... yes
Zstandard support ...................... no
Thread support ......................... yes
Common build options:
Linker can resolve circular dependencies yes
Qt Core:
backtrace .............................. yes
DoubleConversion ....................... yes
Using system DoubleConversion ........ no
CLONE_PIDFD support in forkfd .......... yes
GLib ................................... yes
ICU .................................... no
Using system libb2 ..................... no
Built-in copy of the MIME database ..... yes
Application permissions ................ yes
Defaulting legacy IPC to POSIX ......... no
Tracing backend ........................ <none>
OpenSSL based cryptographic hash ....... no
Logging backends:
journald ............................. no
syslog ............................... no
slog2 ................................ no
PCRE2 .................................. yes
Using system PCRE2 ................... yes
Qt Sql:
SQL item models ........................ yes
Qt Network:
getifaddrs() ........................... no
IPv6 ifname ............................ no
libproxy ............................... no
Linux AF_NETLINK ....................... yes
DTLS ................................... yes
OCSP-stapling .......................... yes
SCTP ................................... no
Use system proxies ..................... yes
GSSAPI ................................. no
Brotli Decompression Support ........... no
qIsEffectiveTLD() ...................... yes
Built-in publicsuffix database ....... yes
System publicsuffix database ......... yes
Core tools:
Android deployment tool ................ yes
macOS deployment tool .................. no
Windows deployment tool ................ no
qmake .................................. yes
Qt Gui:
Accessibility .......................... yes
FreeType ............................... yes
Using system FreeType ................ no
HarfBuzz ............................... yes
Using system HarfBuzz ................ no
Fontconfig ............................. no
Image formats:
GIF .................................. yes
ICO .................................. yes
JPEG ................................. yes
Using system libjpeg ............... yes
PNG .................................. yes
Using system libpng ................ yes
Text formats:
HtmlParser ........................... yes
CssParser ............................ yes
OdfWriter ............................ yes
MarkdownReader ....................... yes
Using system libmd4c ............... no
MarkdownWriter ....................... yes
EGL .................................... yes
OpenVG ................................. no
OpenGL:
Desktop OpenGL ....................... no
OpenGL ES 2.0 ........................ yes
OpenGL ES 3.0 ........................ yes
OpenGL ES 3.1 ........................ yes
OpenGL ES 3.2 ........................ yes
Vulkan ................................. no
Session Management ..................... yes
Features used by QPA backends:
evdev .................................. yes
libinput ............................... no
HiRes wheel support in libinput ........ no
INTEGRITY HID .......................... no
mtdev .................................. no
tslib .................................. no
xkbcommon .............................. yes
X11 specific:
XLib ................................. yes
XCB Xlib ............................. yes
EGL on X11 ........................... yes
xkbcommon-x11 ........................ yes
xcb-sm ............................... no
QPA backends:
DirectFB ............................... no
EGLFS .................................. yes
EGLFS details:
EGLFS OpenWFD ........................ no
EGLFS i.Mx6 .......................... no
EGLFS i.Mx6 Wayland .................. no
EGLFS RCAR ........................... no
EGLFS EGLDevice ...................... yes
EGLFS GBM ............................ yes
EGLFS VSP2 ........................... no
EGLFS Mali ........................... no
EGLFS Raspberry Pi ................... no
EGLFS X11 ............................ yes
LinuxFB ................................ yes
VNC .................................... yes
VK_KHR_display ......................... no
QNX:
lgmon ................................ no
IMF .................................. no
XCB:
Using system-provided xcb-xinput ..... no
GL integrations:
GLX Plugin ......................... no
XCB GLX .......................... no
EGL-X11 Plugin ..................... no
Windows:
Direct 2D ............................ no
Direct 2D 1.1 ........................ no
DirectWrite .......................... no
DirectWrite 3 ........................ no
Qt Widgets:
GTK+ ................................... no
Styles ................................. Fusion Windows
Qt Testlib:
Tester for item models ................. yes
Batch tests ............................ no
Qt PrintSupport:
CUPS ................................... no
Qt Sql Drivers:
DB2 (IBM) .............................. no
InterBase .............................. no
MySql .................................. no
OCI (Oracle) ........................... no
ODBC ................................... no
PostgreSQL ............................. no
SQLite ................................. yes
Using system provided SQLite ......... no
Mimer .................................. no
Further Image Formats:
JasPer ................................. no
MNG .................................... no
TIFF ................................... yes
Using system libtiff ................. yes
WEBP ................................... yes
Using system libwebp ................. no
Qt QML:
QML network support .................... yes
QML debugging and profiling support .... yes
QML just-in-time compiler .............. yes
QML XML http request ................... yes
QML Locale ............................. yes
QML SSL support ........................ yes
Qt QML:
QML network support .................... yes
QML debugging and profiling support .... yes
QML just-in-time compiler .............. yes
QML XML http request ................... yes
QML Locale ............................. yes
QML SSL support ........................ yes
Qt QML Models:
QML list model ......................... yes
QML delegate model ..................... yes
Qt Quick:
AnimatedImage item ..................... yes
Canvas item ............................ yes
Support for Qt Quick Designer .......... yes
Flipable item .......................... yes
GridView item .......................... yes
ListView item .......................... yes
TableView item ......................... yes
TreeView item .......................... yes
Path support ........................... yes
PathView item .......................... yes
Positioner items ....................... yes
Repeater item .......................... yes
ShaderEffect item ...................... yes
Sprite item ............................ yes
Qt Quick Templates 2:
Hover support .......................... yes
Multi-touch support .................... yes
Calendar support ....................... yes
Qt Quick Controls 2:
Styles ................................. Basic Fusion Imagine Material Universal
Qt 5 Compatibility Libraries:
iconv .................................. yes
QtQuick3D:
Assimp ................................. yes
System Assimp .......................... no
Qt Multimedia:
Spatial Audio .......................... yes
Spatial Audio (Quick3D) ................ yes
Low level Audio Backend:
ALSA (experimental) .................. no
PulseAudio ........................... no
MMRenderer ........................... no
CoreAudio ............................ no
Windows Media SDK .................... no
Open SLES (Android) .................. no
Web Assembly ......................... no
Plugin:
GStreamer 1.0 ........................ yes
FFmpeg ............................... no
MMRenderer ........................... no
AVFoundation ......................... no
Windows Media Foundation ............. no
Hardware acceleration and features:
Video for Linux ...................... yes
VAAPI support ........................ no
Linux DMA buffer support ............. yes
VideoToolbox ......................... no
Qt Charts Types:
Area Chart ............................. yes
Line Chart ............................. yes
Spline Chart ........................... yes
Scatter Chart .......................... yes
Bar Chart .............................. yes
Pie Chart .............................. yes
Boxplot Chart .......................... yes
Candlestick Chart ...................... yes
Qt Axis Types:
DateTime Axis .......................... yes
Qt Bluetooth:
BlueZ .................................. no
BlueZ Low Energy ....................... no
Linux Crypto API ....................... no
WinRT Bluetooth API .................... no
Qt Graphs Support:
2D Graphs .............................. yes
3D Graphs .............................. yes
Qt Graphs 3D:
Bars3D ................................. yes
Scatter3D .............................. yes
Surface3D .............................. yes
Serial Port:
ntddmodm ............................... no
Qt Tools:
Qt Assistant ........................... yes
libclang found ......................... no
Clang-based lupdate parser ............. no
Qt Designer ............................ yes
Qt Distance Field Generator ............ yes
Qt Linguist ............................ yes
pixeltool .............................. yes
qdbus .................................. yes
QDoc ................................... no
Qt Attributions Scanner ................ yes
qtdiag ................................. yes
qtplugininfo ........................... yes
WebEngine Repository Build Options:
Build Ninja ............................ yes
Build Gn ............................... yes
Jumbo Build ............................ yes
Developer build ........................ no
Build QtWebEngine Modules:
Build QtWebEngineCore ................ no
Build QtWebEngineWidgets ............. no
Build QtWebEngineQuick ............... no
Build QtPdf Modules:
Build QtPdfWidgets ................... no
Build QtPdfQuick ..................... no
Optional system libraries:
re2 .................................. no
icu .................................. no
libwebp, libwebpmux and libwebpdemux . no
opus ................................. no
ffmpeg ............................... no
libvpx ............................... no
snappy ............................... no
glib ................................. yes
zlib ................................. yes
minizip .............................. no
libevent ............................. no
libxml2 and libxslt .................. no
lcms2 ................................ no
png .................................. yes
tiff ................................. yes
jpeg ................................. yes
libopenjpeg2 ......................... no
harfbuzz ............................. no
freetype ............................. no
libpci ............................... no
Qt Protobuf:
Qt Core types support .................. no
Qt Gui types support ................... no
Well-known types support ............... no
Qt Protobuf tools:
Qt Protobuf generator .................. no
Qt GRPC:
gRPC support ........................... yes
QML gRPC support ....................... yes
Qt GRPC tools:
Qt GRPC generator ...................... no
Qt Opcua:
Open62541 .............................. yes
Support for namespace 0 NodeId names ... yes
Internal code generator ................ no
Open62541 security support ............. yes
Support for global discovery server .... yes
Data type code generator ............... yes
Qt Remote Objects:
High Availability Manager (ham) ........ no
Qt Scxml:
ECMAScript data model for QtScxml ...... yes
Qt Sensors:
sensorfw ............................... no
sensorfw_enabled_with_cmake ............ no
Qt SerialBus:
Socket CAN ............................. yes
Socket CAN FD .......................... yes
SerialPort Support ..................... yes
Qt TextToSpeech:
Flite .................................. no
Flite with ALSA ........................ no
Speech Dispatcher ...................... no
Qt Virtualkeyboard:
Desktop integration .................... yes
Built-in layouts ....................... yes
Key navigation ......................... no
Retro style as default ................. no
Sensitive Debug ........................ no
Cerence ................................ no
Static Linking ....................... no
Handwriting .......................... no
Alphabetic ......................... no
CJK ................................ no
XT9 .................................. no
XT9 Debug .......................... no
XT9 9-key layouts .................. no
Bundle resources ..................... no
Handwriting ........................ no
XT9 ................................ no
Hunspell ............................... no
Using Hunspell copy from 3rdparty/ ... no
OpenWnn ................................ yes
MyScript ............................... no
Example HWR ............................ no
Language support enabled for:
Arabic ............................... yes
Bulgarian ............................ yes
Czech ................................ yes
Danish ............................... yes
German ............................... yes
Greek ................................ yes
English GB ........................... yes
English US ........................... yes
Spanish .............................. yes
Spanish Mexico ....................... yes
Estonian ............................. yes
Farsi ................................ yes
Finnish .............................. yes
French Canada ........................ yes
French France ........................ yes
Hebrew ............................... yes
Hindi ................................ yes
Croatian ............................. yes
Hungarian ............................ yes
Indonesian ........................... yes
Italian .............................. yes
Japanese ............................. yes
Korean ............................... yes
Malay ................................ yes
Norwegian ............................ yes
Dutch ................................ yes
Polish ............................... yes
Portuguese Brazil .................... yes
Portuguese Portugal .................. yes
Romanian ............................. yes
Russian .............................. yes
Slovak ............................... yes
Slovenian ............................ yes
Albanian ............................. yes
Serbian .............................. yes
Swedish .............................. yes
Thai ................................. yes
Turkish .............................. yes
Ukrainian ............................ yes
Vietnamese ........................... yes
Simplified Chinese ................... yes
Traditional Chinese .................. yes
HongKong Chinese ..................... no
Traditional chinese input methods:
Zhuyin ............................... yes
Cangjie .............................. yes
Qt Wayland Client ........................ yes
Qt Wayland Compositor .................... yes
Qt Wayland Drivers:
EGL .................................... yes
Raspberry Pi ........................... no
DRM EGL ................................ yes
libhybris EGL .......................... no
Linux dma-buf server buffer integration yes
Shm emulation server buffer integration yes
Vulkan-based server buffer integration . no
Qt Wayland Client Shell Integrations:
xdg-shell .............................. yes
ivi-shell .............................. yes
wl-shell (deprecated) .................. yes
qt-shell ............................... yes
Qt Wayland Compositor Layer Plugins:
VSP2 hardware layer integration ........ no
Note: Hunspell in Qt Virtual Keyboard is not enabled. Spelling correction will not be available.
WARNING: No backend for low level audio found.
WARNING: QDoc will not be compiled, probably because clang's C and C++ libraries could not be located. This means that you cannot build the Qt documentation.
You may need to set CMAKE_PREFIX_PATH or LLVM_INSTALL_DIR to the location of your llvm installation.
Other than clang's libraries, you may need to install another package, such as clang itself, to provide the ClangConfig.cmake file needed to detect your libraries. Once this
file is in place, the configure script may be able to detect your system-installed libraries without further environment variables.
On macOS, you can use Homebrew's llvm package.
You will also need to set the FEATURE_clang CMake variable to ON to re-evaluate this check.
WARNING: Clang-based lupdate parser will not be available. Suitable LLVM and Clang C++ libraries have not been found.
You will need to set the FEATURE_clangcpp CMake variable to ON to re-evaluate this check.
WARNING: QtWebEngine won't be built. node.js version 14 or later is required.
WARNING: QtPdf won't be built. node.js version 14 or later is required.
WARNING: SensorFW support currently not enabled with cmake
--
Qt is now configured for building. Just run 'cmake --build . --parallel'
Once everything is built, you must run 'cmake --install .'
Qt will be installed into '/home/topeet/Qt/qt672'
To configure and build other Qt modules, you can use the following convenience script:
/home/topeet/Qt/qt672/bin/qt-configure-module
If reconfiguration fails for some reason, try removing 'CMakeCache.txt' from the build directory
-- Configuring done
-- Generating done
-- Build files have been written to: /home/topeet/qti/qt672
帮我总结一下安装的组件选择情况
从你的输出中,可以看到Qt配置过程中选择的各种组件和选项。以下是对安装组件和选项的总结:
主要构建选项
- 构建模式:Release
- 优化选项:未完全优化(未使用
-O3
) - 共享库:是
- 预编译头:是
- 链接时优化(LTCG):否
- Intel CET:否
- 构建部分:libs, tools
- 安装示例源代码:否
Qt 模块
- Qt Concurrent:是
- Qt D-Bus:是
- Qt Gui:是
- Qt Network:是
- Qt PrintSupport:是
- Qt Sql:是
- Qt Testlib:是
- Qt Widgets:是
- Qt Xml:是
支持特性
- pkg-config:是
- udev:是
- OpenSSL:是(未直接链接到OpenSSL)
- 系统zlib:是
- 线程支持:是
Qt Core
- backtrace:是
- DoubleConversion:是(未使用系统提供的DoubleConversion)
- GLib:是
- PCRE2:是(使用系统提供的PCRE2)
Qt Sql
- SQL item models:是
Qt Network
- getifaddrs():否
- IPv6 ifname:否
- libproxy:否
- Linux AF_NETLINK:是
- DTLS:是
- OCSP-stapling:是
- 使用系统代理:是
Qt Gui
- Accessibility:是
- FreeType:是(未使用系统提供的FreeType)
- HarfBuzz:是(未使用系统提供的HarfBuzz)
- Image formats:GIF, ICO, JPEG, PNG
- Text formats:HtmlParser, CssParser, OdfWriter, MarkdownReader, MarkdownWriter
- EGL:是
- OpenGL:OpenGL ES 2.0, 3.0, 3.1, 3.2
Qt QML 和 Qt Quick
- QML 网络支持:是
- QML 调试和性能分析支持:是
- QML JIT 编译器:是
- QML XML HTTP 请求:是
- QML 本地化:是
- QML SSL 支持:是
- Qt Quick:AnimatedImage, Canvas, Flipable, GridView, ListView, TableView, TreeView, PathView, Positioner, Repeater, ShaderEffect, Sprite
- Qt Quick Templates 2:Hover, Multi-touch, Calendar
- Qt Quick Controls 2:Basic, Fusion, Imagine, Material, Universal
其他模块
- Qt 5 兼容性库:iconv
- QtQuick3D:Assimp
- Qt Multimedia:GStreamer 1.0
- Qt Charts:多种图表类型
- Qt Bluetooth:未启用
- Qt Graphs:2D 和 3D 图
- Qt Serial Port:Socket CAN, Socket CAN FD
- Qt TextToSpeech:未启用
- Qt Virtual Keyboard:多种语言支持
- Qt Wayland:Client 和 Compositor
警告和错误
- QtWebEngine 和 QtPdf:需要
node.js
版本14或更高版本。 - Clang:未找到Clang库,可能会影响QDoc和Clang-based lupdate parser的可用性。
- QDoc:由于缺少Clang库,无法编译。
- 音频后端:未找到低级别音频后端。
- SensorFW:未启用SensorFW支持。
总结
Qt配置成功,但有几个警告和错误需要注意,特别是关于node.js
和Clang的依赖问题。在构建之前,建议解决这些问题以确保所有功能都能正常工作。使用ninja
进行构建可能会减少问题,但根据你的需求和环境,也可以继续使用make
。
4.缺少node.js
版本14或更高版本
QtWebEngine will not be built: node.js version 14 or later is required.
[ 3%] Built target WebChannelQuickplugin_version_script
[ 3%] Built target WebEngineErrorMessage
[ 3%] Check QtPdf support
QtPdf will not be built: node.js version 14 or later is required.
从你提供的输出中,QtWebEngine
和QtPdf
模块未能成功构建,原因是缺少node.js
版本14或更高版本。这两个模块依赖于node.js
来执行一些构建任务。
解决方法
-
安装或更新
node.js
要解决这个问题,你需要安装或更新
node.js
到版本14或更高。你可以使用nvm
(Node Version Manager)来管理多个Node.js版本。以下是如何使用nvm
安装Node.js 14的步骤:-
安装
nvm
:curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash
-
加载
nvm
:export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")" [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
-
安装Node.js 14:
nvm install 14
-
使用Node.js 14:
nvm use 14
-
-
重新配置和构建Qt
安装或更新
node.js
后,重新运行Qt的配置脚本和构建过程:-
重新配置Qt:
./autoconfig.sh
-
构建Qt:
cmake --build . --parallel
-
安装Qt:
cmake --install .
-
注意事项
-
使用
ninja
构建:Qt建议使用ninja
作为构建系统,因为它通常比make
更快且更可靠。你可以在配置时使用-GNinja
选项:cmake .. -GNinja -DCMAKE_INSTALL_PREFIX=/home/topeet/Qt/qt672 -DCMAKE_BUILD_TYPE=Release -DQT_OPENGL=es2 -DQT_EGLFS=ON ninja ninja install
-
检查
node.js
版本:确保node.js
版本正确安装并且当前正在使用正确的版本。可以通过运行node -v
来检查。 -
查看构建日志:如果构建过程中仍然出现问题,查看
CMakeOutput.log
和CMakeError.log
文件以获取更多信息。
通过这些步骤,你应该能够解决QtWebEngine
和QtPdf
构建失败的问题。
5.ubuntu 安装node.js
在Ubuntu上安装Node.js,你可以按照以下步骤进行操作:
一、使用APT包管理器安装
-
更新软件包列表
打开终端,运行以下命令以更新Ubuntu的软件包列表:
sudo apt update
-
安装Node.js
使用APT包管理器安装Node.js。这将安装Node.js及其包管理器npm。
sudo apt install nodejs npm
-
验证安装
安装完成后,你可以通过以下命令验证Node.js和npm是否安装成功:
node -v npm -v
这将显示Node.js和npm的版本号,确认它们已经正确安装。
二、使用nvm(Node Version Manager)安装
如果你需要管理多个Node.js版本,或者需要安装特定版本的Node.js,可以使用nvm。
-
安装nvm
首先,使用以下命令安装nvm:
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.1/install.sh | bash
安装完成后,运行以下命令以加载nvm:
export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")" [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
你可以将上述命令添加到你的shell配置文件中(如
.bashrc
或.zshrc
),以便每次打开终端时自动加载nvm。 -
使用nvm安装Node.js
使用nvm安装特定版本的Node.js,例如安装最新的LTS版本:
nvm install --lts
你也可以指定版本号来安装特定版本的Node.js:
nvm install 14 # 安装Node.js 14版本
-
使用nvm切换Node.js版本
使用以下命令切换到已安装的Node.js版本:
nvm use 14 # 切换到Node.js 14版本
或者切换到默认版本:
nvm alias default 14
三、注意事项
- 权限问题:在安装Node.js时,使用
sudo
可能会导致权限问题,特别是在使用npm全局安装包时。尽量避免使用sudo
来安装Node.js,除非系统要求。 - 版本管理:如果你需要管理多个Node.js版本,建议使用nvm。
- 环境变量:确保Node.js和npm的路径已添加到系统的环境变量中,以便在终端中直接使用
node
和npm
命令。
通过以上步骤,你应该能够在Ubuntu上成功安装Node.js,并开始使用它进行开发。
6.使用nvm来安装和管理不同版本的Node.js
你已经成功安装了nvm(Node Version Manager),这是管理多个Node.js版本的一个非常方便的工具。现在,你可以使用nvm来安装和管理不同版本的Node.js。
接下来要做的步骤
-
重新加载终端
根据安装脚本的提示,关闭并重新打开你的终端,或者运行以下命令来立即加载nvm:
export NVM_DIR="$HOME/.nvm" [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm [ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
-
安装Node.js
使用nvm安装你需要的Node.js版本。例如,安装最新的LTS(长期支持)版本:
nvm install --lts
或者安装特定版本,比如Node.js 14:
nvm install 14
-
使用Node.js
安装完成后,你可以使用以下命令切换到已安装的Node.js版本:
nvm use 14 # 切换到Node.js 14版本
或者切换到默认版本:
nvm alias default 14
-
验证安装
通过以下命令验证Node.js和npm是否安装成功:
node -v npm -v
这将显示Node.js和npm的版本号,确认它们已经正确安装。
注意事项
- 版本管理:使用nvm,你可以轻松地在不同版本的Node.js之间切换,非常适合需要支持多个项目的开发者。
- 环境变量:确保Node.js和npm的路径已添加到系统的环境变量中,以便在终端中直接使用
node
和npm
命令。 - 权限问题:在安装Node.js时,避免使用
sudo
,因为这可能会导致权限问题,特别是在使用npm全局安装包时。
现在,你已经成功安装了nvm并可以使用它来管理Node.js版本。接下来,你可以继续配置和构建Qt项目。
7.成功安装了最新版本的LTS(长期支持)Node.js
你已经成功安装了最新版本的LTS(长期支持)Node.js,版本为22.14.0,并且npm版本为10.9.2。这是一个很好的开始,因为QtWebEngine和QtPdf的构建需要Node.js版本14或更高。
接下来要做的步骤
-
验证Node.js和npm安装
确保Node.js和npm已经正确安装并可用。你可以通过以下命令来验证:
node -v npm -v
这将显示Node.js和npm的版本号,确认它们已经正确安装。
-
重新配置Qt
由于你已经安装了Node.js,现在可以重新配置Qt,以便构建QtWebEngine和QtPdf。运行以下命令来重新配置Qt:
./autoconfig.sh
如果之前使用的是
cmake
命令进行配置,你可以重新运行cmake
命令:cmake .. -GNinja -DCMAKE_INSTALL_PREFIX=/home/topeet/Qt/qt672 -DCMAKE_BUILD_TYPE=Release -DQT_OPENGL=es2 -DQT_EGLFS=ON
-
构建和安装Qt
配置完成后,你可以开始构建Qt。使用以下命令进行构建:
ninja # 如果你使用的是Ninja构建系统 # 或者 make # 如果你使用的是Makefile构建系统
构建完成后,运行以下命令来安装Qt:
ninja install # 如果你使用的是Ninja构建系统 # 或者 make install # 如果你使用的是Makefile构建系统
注意事项
- 构建系统:Qt建议使用Ninja作为构建系统,因为它通常比Makefiles更快且更可靠。如果你之前使用的是Makefiles,考虑切换到Ninja。
- 依赖检查:在构建过程中,确保所有必要的依赖都已安装。如果有任何依赖缺失,构建可能会失败。
- 构建日志:如果构建过程中遇到问题,查看
CMakeOutput.log
和CMakeError.log
文件以获取更多信息。
通过这些步骤,你应该能够成功构建Qt,包括QtWebEngine和QtPdf模块。如果遇到任何问题,请根据错误日志中的信息进一步排查。