gpt4 book ai didi

qt - 使用 fontconfig 支持为 Linux x86 构建 Qt

转载 作者:行者123 更新时间:2023-12-04 13:43:13 37 4
gpt4 key购买 nike

我正在将我的 Qt 应用程序移植到用于 x86 架构的 Linux,并且由于该平台的最后一个官方版本是 5.5,我正在尝试构建自己的 Qt 5.11.3。我想使用 fontconfig 来启用系统字体。我的构建平台是 Centos 7.5,我使用的是 GCC 工具链,它使用 -m32 开关构建 x86 二进制文件。
问题是,我无法让它看到 fontconfig 库。我已经用 fontconfig-devel-2.13.0-4.3.el7.i686 包安装了它

使用选项 -fontconfig 运行配置时,我收到以下错误消息:

ERROR: Feature 'fontconfig' was enabled, but the pre-condition '!config.win32 && features.system-freetype && libs.fontconfig' failed.



我对此的理解是,我必须使用 -system-freetype 而不能使用 -qt-freetype,但是当我尝试这样做时(也使用 -feature-freetype),我收到以下消息:

ERROR: Feature 'system-freetype' was enabled, but the pre-condition 'features.freetype && libs.freetype' failed.



config.log 中的相关消息是:
looking for library freetype
Trying source 0 (type pkgConfig) of library freetype ...
pkg-config use disabled globally.
=> source produced no result.
Trying source 1 (type freetype) of library freetype ...
+ cd /home/myuser/qt-build/config.tests/freetype && /home/myuser/qt-build/qtbase/bin/qmake "CONFIG -= qt debug_and_release app_bundle lib_bundle" "CONFIG += shared warn_off console single_arch" -early "CONFIG += cross_compile" 'LIBS += -lfreetype' /home/myuser/qt-build/config.tests/freetype
+ cd /home/myuser/qt-build/config.tests/freetype && MAKEFLAGS= /usr/bin/gmake
> g++ -c -m32 -pipe -O2 -std=gnu++11 -w -fPIC -I. -I/home/myuser/qt-everywhere-src-5.11.3/qtbase/mkspecs/linux-g++-32 -o main.o main.cpp
> main.cpp:2:22: fatal error: ft2build.h: No such file or directory
> #include <ft2build.h>
> ^
> compilation terminated.
> gmake: *** [main.o] Error 1
=> source failed verification.
test config.qtbase_gui.libraries.freetype FAILED

现在,我也收到了这条消息:

WARNING: Cross compiling without sysroot. Disabling pkg-config



我理解这是“源0”失败的根源。但是,我尝试通过传递 FREETYPE_INCDIR=/usr/include/freetype2 来手动将配置指向 freetype 包含目录;但是,从日志文件中可以看出,在检测 freetype 时似乎没有使用该值。

我在这里错过了一个技巧,还是配置脚本损坏了?如果是后者,有没有办法解决这个问题?

编辑:为了完整起见,运行配置的环境:
CFLAGS=-m32
CXXFLAGS=-m32 --std=c++1x

配置标志:
-opensource
-xplatform linux-g++-32
-nomake tests -nomake examples -nomake tools
-prefix /home/myuser/qt_install/
-qpa xcb
-no-use-gold-linker
-icu ICU_PREFIX=/home/myuser/icu_install ICU_LIBS="-licui18n -licuuc -licudata"
-no-opengl
-fontconfig -feature-freetype -system-freetype FREETYPE_INCDIR=/usr/include/freetype2

最佳答案

我发现可以通过设置 CPATH(和 LIBRARY_PATH 指向 Freetype 的特定版本来解决这个问题,结果证明我也需要)。看起来在检测到 Freetype 存在时忽略 FREETYPE_* 变量的事实确实是配置脚本中的一个错误。

关于qt - 使用 fontconfig 支持为 Linux x86 构建 Qt,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53745257/

37 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com