2

我正在尝试在 Ubuntu 机器上编译 VLC。因此,在获得构建所需的所有附加包之后,当我运行它时,./configure它说 Qt5Core 以及其他一些 Qt 相关库都没有找到。问题是我知道 Qt5 的完整安装及其库在我的系统上的主目录而不是全局目录中可用。在构建时,似乎 pkg-config 不检查主目录。如何将 Qt5 安装的实际位置告知构建系统?

注意:我尝试从 apt 源下载 Qt,但该安装是针对 Qt5.9 而不是必需的 Qt5.11。

4

1 回答 1

0

configure需要.pc查找 Qt 模块的文件,
如果您检查config.log,可能会抱怨:

configure:xxxx: $PKG_CONFIG --exists --print-errors "Qt5Core >= 5.11.0 Qt5Widgets Qt5Gui Qt5Quick Qt5QuickWidgets Qt5QuickControls2 Qt5Svg"

Package Qt5Quick was not found in the pkg-config search path.
Perhaps you should add the directory containing `Qt5Quick.pc'
to the PKG_CONFIG_PATH environment variable
No package 'Qt5Quick' found
Package Qt5QuickWidgets was not found in the pkg-config search path.
Perhaps you should add the directory containing `Qt5QuickWidgets.pc'
to the PKG_CONFIG_PATH environment variable

在那里,要链接configure到特定的 Qt 安装,您有几个选项,要么导出变量QT_LIBS

export QT_LIBS=/path/to/qt/libs/

或者,直接将包含文件的 Qtpkgconfig路径添加.pc到 shellPKG_CONFIG_PATH中,

export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/path/to/qt/libs/pkgconfig/
于 2021-02-04T21:48:41.230 回答