使用fontconfig支持为Linux x86构建Qt

使用fontconfig支持为Linux x86构建Qt,qt,qt5,Qt,Qt5,我正在将我的Qt应用程序移植到Linux for x86体系结构,由于该平台的上一个官方版本是5.5,我正在尝试自己构建Qt 5.11.3。我想使用fontconfig启用系统字体的使用。我的构建平台是Centos 7.5,我使用的是一个GCC工具链,它使用-m32开关构建x86二进制文件。 问题是,我无法让它看到fontconfig库。我已经安装了fontconfig-devel-2.13.0-4.3.el7.i686包 使用-fontconfig选项运行configure时,我收到以下错误消

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

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

错误:已启用功能“fontconfig”,但前提条件“!config.win32&&features.system-freetype&&libs.fontconfig'失败

我的理解是,我必须使用-system freetype,不能使用-qt freetype,但当我尝试使用-feature freetype时,我得到了以下信息:

错误:功能“system freetype”已启用,但前提条件“features.freetype&&libs.freetype”失败

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
配置标志:

-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

尝试使用包含在Qt源代码中的Freetype库:运行configure时使用标志“-Qt Freetype

我发现可以通过设置CPATH来解决这个问题(并且库路径指向我也需要的Freetype的特定构建)。当检测到FREETYPE的存在时,FREETYPE变量被忽略,这似乎是配置脚本中的一个错误。

你能编译并链接一个链接到FREETYPE的最小C程序(使用-m32)吗?您能否共享调用配置脚本时使用的参数?请注意,从x86_64主机编译x86是一种交叉编译,这样做需要不同于本机构建的配置参数(这可能是禁用pkg config的原因)。如果我提供-I/usr/include/freetype2开关,我可以构建并链接一个链接到freetype的最小C程序,这样它就可以找到ft2build头——在Qt配置的上下文中,我希望用freetype_INCDIR=/usr/include/freetype2实现这个头——但它似乎无法像日志摘录中所证明的那样工作原始帖子,这似乎阻止我使用fontconfig:
-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