Qt5生成失败

Qt5 build failing

本文关键字:失败 Qt5      更新时间:2023-10-16

我正在尝试编译PhantomJS 2,它使用Qt5。我遇到了这个故障:

make[2]: Entering directory `/app/phantomjs/src/qt/qtbase/src/platformsupport'
g++ -c -include .pch/Qt5PlatformSupport -pipe -O2 -fPIC -fvisibility=hidden -fvisibility-inlines-hidden -std=c++0x -fno-exceptions -Wall -W -D_REENTRANT -DQT_NO_MTDEV -DQT_NO_LIBUDEV -DQT_NO_EVDEV -DQT_NO_GRAPHICSVIEW -DQT_NO_GRAPHICSEFFECT -DQT_NO_STYLESHEET -DQT_NO_STYLE_CDE -DQT_NO_STYLE_CLEANLOOKS -DQT_NO_STYLE_MOTIF -DQT_NO_STYLE_PLASTIQUE -DQT_NO_CAST_FROM_ASCII -DQT_NO_FONTCONFIG -DQT_BUILD_PLATFORMSUPPORT_LIB -DQT_BUILDING_QT -DQT_NO_CAST_TO_ASCII -DQT_ASCII_CAST_WARNINGS -DQT_MOC_COMPAT -DQT_USE_QSTRINGBUILDER -DQT_DEPRECATED_WARNINGS -DQT_DISABLE_DEPRECATED_BEFORE=0x050000 -DQT_NO_EXCEPTIONS -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -I../../mkspecs/linux-g++ -I. -I../../include -I../../include/QtPlatformSupport -I../../include/QtPlatformSupport/5.3.0 -I../../include/QtPlatformSupport/5.3.0/QtPlatformSupport -I../../include/QtGui/5.3.0 -I../../include/QtGui/5.3.0/QtGui -I../../include/QtGui -I../../include/QtCore/5.3.0 -I../../include/QtCore/5.3.0/QtCore -I../../include/QtCore -I.moc -o .obj/qbasicfontdatabase.o fontdatabases/basic/qbasicfontdatabase.cpp
In file included from ../../include/QtGui/5.3.0/QtGui/private/../../../../../src/gui/text/qfontengine_ft_p.h:58:0,
                 from ../../include/QtGui/5.3.0/QtGui/private/qfontengine_ft_p.h:1,
                 from fontdatabases/basic/qbasicfontdatabase.cpp:54:
/usr/include/ft2build.h:56:38: fatal error: freetype/config/ftheader.h: No such file or directory
 #include <freetype/config/ftheader.h>
                                      ^
compilation terminated.
make[2]: *** [.obj/qbasicfontdatabase.o] Error 1
make[2]: Leaving directory `/app/phantomjs/src/qt/qtbase/src/platformsupport'
make[1]: *** [sub-platformsupport-make_first] Error 2
make[1]: Leaving directory `/app/phantomjs/src/qt/qtbase/src'
make: *** [sub-src-make_first] Error 2

我安装了freetype2:

$ find / -name ftheader.h
/usr/include/freetype2/freetype/config/ftheader.h
/app/phantomjs/src/qt/qtbase/src/3rdparty/freetype/include/freetype/config/ftheader.h

不知道如何解决这个问题,因为我对C/C++构建没有太多经验。我可能需要添加/更改前缀,但我不确定如何添加/更改。

如果您查看错误()的位置,它的正上方有以下注释:

55   /* `<prefix>/include/freetype2' must be in your current inclusion path */                                                                                                                                                               
56 #include <freetype/config/ftheader.h>  

不确定为什么构建没有自己解决这个问题,因为它已经解决了它所依赖的其他库,但将-I /usr/include/freetype2添加到构建配置中就成功了。

特别是对于PhantomJS的情况,完整的命令是:

./build.sh --confirm --qt-config '-I /usr/include/freetype2'