Qt 5.5.1在Archlinux上编译结果时出现错误:使用;定义为;可能不可移植[-weexpansion to defined]

Qt 5.5.1在Archlinux上编译结果时出现错误:使用;定义为;可能不可移植[-weexpansion to defined],linux,qt,gcc,makefile,qmake,Linux,Qt,Gcc,Makefile,Qmake,我需要编译qt-5.5来构建各种应用程序。 Qt提供了完成此操作的指令,但按照提供的步骤,将导致make错误 注意:我试图搜索此的解决方案,但未成功发出警告,但可能是其他人遇到此问题 使用的系统: Archlinux(Linux arch desktop 4.9.77-1-lts#1 SMP周三1月17日12:59:05 CET 2018 x86_64 GNU/Linux) Qt5.5.1 OpenSSL1.0.2g GCC(GCC)7.2.1 20171224 采取的步骤: 操作系统安装:

我需要编译qt-5.5来构建各种应用程序。 Qt提供了完成此操作的指令,但按照提供的步骤,将导致
make
错误

注意:我试图搜索此
的解决方案,但未成功发出
警告,但可能是其他人遇到此问题

使用的系统:

  • Archlinux(Linux arch desktop 4.9.77-1-lts#1 SMP周三1月17日12:59:05 CET 2018 x86_64 GNU/Linux)
  • Qt5.5.1
  • OpenSSL1.0.2g
  • GCC(GCC)7.2.1 20171224
采取的步骤:

操作系统安装:

  • 在ArchLinux安装期间,我安装了带有
    pacstrap/mnt/point/here base-devel
    的开发包,有关更多信息,请参阅
安装后:

  • 从下载的Qt 5.5.1
  • 下载了相应的OpenSSL 1.0.2g(与Ubuntu发行版中的相同,这是我的目标平台)
  • 安装此OpenSSL版本将打破依赖关系,因此我将其解压缩到
    /opt/lib/OpenSSL/
    ,并将
    lib
    bin
    share
    文件夹放在上述根文件夹中
  • 提取Qt-5.5.1
  • ran
    OPENSSL_LIBS='-L/opt/lib/OPENSSL/lib/-lssl-lcrypto'/配置-开发者构建-开源-nomake示例-nomake测试-确认许可证-openssl链接-前缀/opt/qt-5.5.1
    (这将设置用于配置的openssl库位置。然后我链接openssl库,并将Qt-5.5.1配置为安装到
    /opt/Qt-5.5.1
  • 这将产生一个适当的功能输出,一旦安装了Qt,就可以在其中找到
    OpenSSL
最后,
make
ing与 -
make-j 8

这需要一段时间才能最终抛出错误:

In file included from ../../include/QtCore/qlist.h:1:0,
                 from ../../include/QtCore/../../src/corelib/kernel/qobject.h:43,
                 from ../../include/QtCore/qobject.h:1,
                 from ../../include/QtCore/../../src/corelib/io/qiodevice.h:39,
                 from ../../include/QtCore/qiodevice.h:1,
                 from io/qfiledevice.h:37:
../../include/QtCore/../../src/corelib/tools/qlist.h:169:1: error: this use of "defined" may not be portable [-Wexpansion-to-defined]
 #if QT_SUPPORTS(UNSHARABLE_CONTAINERS)
 ^~~~~~~~~~~~~~~~~~~~~~~~~~~
make[3]: *** [Makefile:2660: .obj/header_qtextcodec.o] Error 1
make[3]: *** Waiting for unfinished jobs....
make[3]: *** [Makefile:2436: .obj/header_qsequentialanimationgroup.o] Error 1
make[3]: *** [Makefile:3127: .obj/header_qlibraryinfo.o] Error 1
make[3]: *** [Makefile:1855: .obj/header_qabstractanimation.o] Error 1
make[3]: *** [Makefile:1964: .obj/header_qanimationgroup.o] Error 1
make[3]: *** [Makefile:2075: .obj/header_qparallelanimationgroup.o] Error 1
make[3]: *** [Makefile:2186: .obj/header_qpauseanimation.o] Error 1
make[3]: *** [Makefile:2573: .obj/header_qvariantanimation.o] Error 1
make[3]: *** [Makefile:2325: .obj/header_qpropertyanimation.o] Error 1
make[3]: *** [Makefile:3714: .obj/header_qbuffer.o] Error 1
make[3]: *** [Makefile:3825: .obj/header_qdatastream.o] Error 1
make[3]: *** [Makefile:4202: .obj/header_qdiriterator.o] Error 1
make[3]: *** [Makefile:4079: .obj/header_qdir.o] Error 1
make[3]: *** [Makefile:4313: .obj/header_qfile.o] Error 1
make[3]: *** [Makefile:4422: .obj/header_qfiledevice.o] Error 1
make[3]: *** [Makefile:3958: .obj/header_qdebug.o] Error 1
make[3]: Leaving directory '/home/cybex/qt-5.5/qt-everywhere-opensource-src-5.5.1/qtbase/src/corelib'
make[2]: *** [Makefile:142: sub-corelib-make_first] Error 2
make[2]: Leaving directory '/home/cybex/qt-5.5/qt-everywhere-opensource-src-5.5.1/qtbase/src'
make[1]: *** [Makefile:46: sub-src-make_first] Error 2
make[1]: Leaving directory '/home/cybex/qt-5.5/qt-everywhere-opensource-src-5.5.1/qtbase'
make: *** [Makefile:73: module-qtbase-make_first] Error 2
如果您怀疑使用OpenSSL的花式“技巧”可能是导致问题的原因。没有,因为我使用我的OpenSSL-1.1安装尝试了它,这导致了相同的问题。较旧的OpenSSL版本将与较旧的Qt版本兼容(Ubuntu系统仍然支持)

你有没有想过是什么导致了这个问题

更新

正如
@ssbssa
所提到的,在应用了建议的更改之后,我可以继续进行编译,但仍然遇到了问题

我对新的源代码提取使用了以下configure命令:

OPENSSL_LIBS='-L/opt/lib/OPENSSL/lib/-lssl-lcrypto'/配置-开源-nomake示例-nomake测试-确认许可证-openssl链接-前缀/opt/qt-5.5.1

我收到了以下错误输出

//...

g++ -o .obj/moc_qopengltimerquery.o .moc/moc_qopengltimerquery.cpp
In file included from ../../include/QtCore/qcontiguouscache.h:1:0,
                 from ../../include/QtCore/../../src/corelib/io/qdebug.h:46,
                 from ../../include/QtCore/qdebug.h:1,
                 from ../../include/QtGui/../../src/gui/math3d/qgenericmatrix.h:38,
                 from ../../include/QtGui/qgenericmatrix.h:1,
                 from ../../include/QtGui/../../src/gui/math3d/qquaternion.h:37,
                 from ../../include/QtGui/qquaternion.h:1,
                 from ../../include/QtGui/../../src/gui/math3d/qmatrix4x4.h:39,
                 from ../../include/QtGui/qmatrix4x4.h:1,
                 from .moc/../opengl/qopenglshaderprogram.h:45,
                 from .moc/moc_qopenglshaderprogram.cpp:9:
../../include/QtCore/../../src/corelib/tools/qcontiguouscache.h:99:1: warning: this use of "defined" may not be portable [-Wexpansion-to-defined]
 #if QT_SUPPORTS(UNSHARABLE_CONTAINERS)
 ^~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ../../include/QtCore/qcontiguouscache.h:1:0,
                 from ../../include/QtCore/../../src/corelib/io/qdebug.h:46,
                 from ../../include/QtCore/qdebug.h:1,
                 from ../../include/QtGui/../../src/gui/math3d/qgenericmatrix.h:38,
                 from ../../include/QtGui/qgenericmatrix.h:1,
                 from ../../include/QtGui/../../src/gui/math3d/qquaternion.h:37,
                 from ../../include/QtGui/qquaternion.h:1,
                 from ../../include/QtGui/../../src/gui/math3d/qmatrix4x4.h:39,
                 from ../../include/QtGui/qmatrix4x4.h:1,
                 from ../../include/QtGui/../../src/gui/opengl/qopenglshaderprogram.h:45,
                 from ../../include/QtGui/qopenglshaderprogram.h:1,
                 from ../../include/QtGui/QOpenGLShader:1,
                 from .moc/../opengl/qopenglengineshadermanager_p.h:217,
                 from .moc/moc_qopenglengineshadermanager_p.cpp:9:
../../include/QtCore/../../src/corelib/tools/qcontiguouscache.h:99:1: warning: this use of "defined" may not be portable [-Wexpansion-to-defined]
 #if QT_SUPPORTS(UNSHARABLE_CONTAINERS)
 ^~~~~~~~~~~~~~~~~~~~~~~~~~~
rm -f libQt5Gui.so.5.5.1 libQt5Gui.so libQt5Gui.so.5 libQt5Gui.so.5.5
g++ -Wl,--no-undefined -Wl,-O1 -fuse-ld=gold -Wl,--enable-new-dtags -Wl,-rpath,/opt/qt-5.5.1/lib -shared -Wl,-Bsymbolic-functions -Wl,--dynamic-list,/home/cybex/qt5-5-1/qt-everywhere-opensource-src-5.5.1/qtbase/src/gui/QtGui.dynlist -Wl,-soname,libQt5Gui.so.5 -o libQt5Gui.so.5.5.1 .obj/qimage_ssse3.o .obj/qdrawhelper_ssse3.o .obj/qimage_sse4.o .obj/qdrawhelper_sse4.o .obj/qimagescale_sse4.o .obj/qimage_avx2.o .obj/qdrawhelper_avx2.o .obj/qimage_compat.o .obj/qaccessible.o .obj/qaccessiblecache.o .obj/qaccessibleobject.o .obj/qaccessibleplugin.o .obj/qplatformaccessibility.o .obj/qaccessiblebridge.o .obj/qgenericpluginfactory.o .obj/qgenericplugin.o .obj/qwindowsysteminterface.o .obj/qplatforminputcontextfactory.o .obj/qplatforminputcontextplugin.o .obj/qplatforminputcontext.o .obj/qplatformintegration.o .obj/qplatformdrag.o .obj/qplatformscreen.o .obj/qplatformintegrationfactory.o .obj/qplatformintegrationplugin.o .obj/qplatformtheme.o .obj/qplatformthemefactory.o .obj/qplatformthemeplugin.o .obj/qplatformwindow.o .obj/qplatformoffscreensurface.o .obj/qplatformcursor.o .obj/qplatformclipboard.o .obj/qplatformnativeinterface.o .obj/qsessionmanager.o .obj/qshapedpixmapdndwindow.o .obj/qsimpledrag.o .obj/qsurfaceformat.o .obj/qguiapplication.o .obj/qwindow.o .obj/qoffscreensurface.o .obj/qplatformsurface.o .obj/qsurface.o .obj/qclipboard.o .obj/qcursor.o .obj/qdrag.o .obj/qdnd.o .obj/qevent.o .obj/qinputmethod.o .obj/qkeysequence.o .obj/qkeymapper.o .obj/qpalette.o .obj/qguivariant.o .obj/qscreen.o .obj/qshortcutmap.o .obj/qstylehints.o .obj/qtouchdevice.o .obj/qplatformsharedgraphicscache.o .obj/qplatformdialoghelper.o .obj/qplatformservices.o .obj/qplatformsystemtrayicon.o .obj/qplatformsessionmanager.o .obj/qplatformmenu.o .obj/qpixelformat.o .obj/qpaintdevicewindow.o .obj/qrasterwindow.o .obj/qplatformgraphicsbuffer.o .obj/qplatformgraphicsbufferhelper.o .obj/qinputdevicemanager.o .obj/qplatformopenglcontext.o .obj/qopenglcontext.o .obj/qopenglwindow.o .obj/qbitmap.o .obj/qimage.o .obj/qimage_conversions.o .obj/qimageiohandler.o .obj/qimagereader.o .obj/qimagewriter.o .obj/qpaintengine_pic.o .obj/qpicture.o .obj/qpictureformatplugin.o .obj/qpixmap.o .obj/qpixmapcache.o .obj/qplatformpixmap.o .obj/qmovie.o .obj/qpixmap_raster.o .obj/qpixmap_blitter.o .obj/qnativeimage.o .obj/qimagepixmapcleanuphooks.o .obj/qicon.o .obj/qiconloader.o .obj/qiconengine.o .obj/qiconengineplugin.o .obj/qbmphandler.o .obj/qppmhandler.o .obj/qxbmhandler.o .obj/qxpmhandler.o .obj/qpnghandler.o .obj/qfont.o .obj/qfontengine.o .obj/qfontsubset.o .obj/qfontmetrics.o .obj/qfontdatabase.o .obj/qtextengine.o .obj/qtextlayout.o .obj/qtextformat.o .obj/qtextobject.o .obj/qtextoption.o .obj/qfragmentmap.o .obj/qtextdocument.o .obj/qtextdocument_p.o .obj/qtexthtmlparser.o .obj/qabstracttextdocumentlayout.o .obj/qtextdocumentlayout.o .obj/qtextcursor.o .obj/qtextdocumentfragment.o .obj/qtextimagehandler.o .obj/qtexttable.o .obj/qtextlist.o .obj/qtextdocumentwriter.o .obj/qsyntaxhighlighter.o .obj/qcssparser.o .obj/qzip.o .obj/qtextodfwriter.o .obj/qstatictext.o .obj/qrawfont.o .obj/qglyphrun.o .obj/qdistancefield.o .obj/qfontengine_qpf2.o .obj/qplatformfontdatabase.o .obj/qharfbuzzng.o .obj/qbackingstore.o .obj/qbezier.o .obj/qblendfunctions.o .obj/qblittable.o .obj/qbrush.o .obj/qcolor.o .obj/qcolor_p.o .obj/qcosmeticstroker.o .obj/qcssutil.o .obj/qdrawhelper.o .obj/qemulationpaintengine.o .obj/qgammatables.o .obj/qgrayraster.o .obj/qimagescale.o .obj/qmatrix.o .obj/qmemrotate.o .obj/qoutlinemapper.o .obj/qpagedpaintdevice.o .obj/qpagelayout.o .obj/qpagesize.o .obj/qpaintdevice.o .obj/qpaintengine.o .obj/qpaintengineex.o .obj/qpaintengine_blitter.o .obj/qpaintengine_raster.o .obj/qpainter.o .obj/qpainterpath.o .obj/qpathclipper.o .obj/qpdf.o .obj/qpdfwriter.o .obj/qpen.o .obj/qpolygon.o .obj/qrasterizer.o .obj/qregion.o .obj/qstroker.o .obj/qtextureglyphcache.o .obj/qtransform.o .obj/qplatformbackingstore.o .obj/qpathsimplifier.o .obj/qdesktopservices.o .obj/qvalidator.o .obj/qgridlayoutengine.o .obj/qabstractlayoutstyleinfo.o .obj/qlayoutpolicy.o .obj/qgenericmatrix.o .obj/qmatrix4x4.o .obj/qquaternion.o .obj/qvector2d.o .obj/qvector3d.o .obj/qvector4d.o .obj/qopengl.o .obj/qopenglfunctions.o .obj/qopenglframebufferobject.o .obj/qopenglpaintdevice.o .obj/qopenglbuffer.o .obj/qopenglshaderprogram.o .obj/qopenglgradientcache.o .obj/qopengltexturecache.o .obj/qopenglengineshadermanager.o .obj/qopengl2pexvertexarray.o .obj/qopenglpaintengine.o .obj/qopenglcustomshaderstage.o .obj/qtriangulatingstroker.o .obj/qopengltextureglyphcache.o .obj/qtriangulator.o .obj/qopenglversionfunctions.o .obj/qopenglversionfunctionsfactory.o .obj/qopenglvertexarrayobject.o .obj/qopengldebug.o .obj/qopengltextureblitter.o .obj/qopengltexture.o .obj/qopengltexturehelper.o .obj/qopenglpixeltransferoptions.o .obj/qopenglfunctions_1_0.o .obj/qopenglfunctions_1_1.o .obj/qopenglfunctions_1_2.o .obj/qopenglfunctions_1_3.o .obj/qopenglfunctions_1_4.o .obj/qopenglfunctions_1_5.o .obj/qopenglfunctions_2_0.o .obj/qopenglfunctions_2_1.o .obj/qopenglfunctions_3_0.o .obj/qopenglfunctions_3_1.o .obj/qopenglfunctions_3_2_core.o .obj/qopenglfunctions_3_3_core.o .obj/qopenglfunctions_4_0_core.o .obj/qopenglfunctions_4_1_core.o .obj/qopenglfunctions_4_2_core.o .obj/qopenglfunctions_4_3_core.o .obj/qopenglfunctions_4_4_core.o .obj/qopenglfunctions_4_5_core.o .obj/qopenglfunctions_3_2_compatibility.o .obj/qopenglfunctions_3_3_compatibility.o .obj/qopenglfunctions_4_0_compatibility.o .obj/qopenglfunctions_4_1_compatibility.o .obj/qopenglfunctions_4_2_compatibility.o .obj/qopenglfunctions_4_3_compatibility.o .obj/qopenglfunctions_4_4_compatibility.o .obj/qopenglfunctions_4_5_compatibility.o .obj/qopengltimerquery.o .obj/qguivariantanimation.o .obj/qstandarditemmodel.o .obj/qimage_sse2.o .obj/qdrawhelper_sse2.o .obj/moc_qaccessible.o .obj/moc_qaccessiblecache_p.o .obj/moc_qaccessibleplugin.o .obj/moc_qaccessiblebridge.o .obj/moc_qgenericplugin.o .obj/moc_qplatforminputcontext.o .obj/moc_qplatforminputcontextplugin_p.o .obj/moc_qplatformintegrationplugin.o .obj/moc_qplatformthemeplugin.o .obj/moc_qplatformnativeinterface.o .obj/moc_qplatformmenu.o .obj/moc_qshapedpixmapdndwindow_p.o .obj/moc_qoffscreensurface.o .obj/moc_qclipboard.o .obj/moc_qdrag.o .obj/moc_qdnd_p.o .obj/moc_qevent.o .obj/moc_qkeysequence.o .obj/moc_qkeymapper_p.o .obj/moc_qpalette.o .obj/moc_qsessionmanager.o .obj/moc_qscreen.o .obj/moc_qstylehints.o .obj/moc_qtouchdevice.o .obj/moc_qplatformsharedgraphicscache.o .obj/moc_qplatformdialoghelper.o .obj/moc_qpaintdevicewindow.o .obj/moc_qrasterwindow.o .obj/moc_qplatformgraphicsbuffer.o .obj/moc_qinputdevicemanager_p.o .obj/moc_qopenglcontext.o .obj/moc_qopenglwindow.o .obj/moc_qimageiohandler.o .obj/moc_qpictureformatplugin.o .obj/moc_qiconengineplugin.o .obj/moc_qfont.o .obj/moc_qfontdatabase.o .obj/moc_qtextformat.o .obj/moc_qtextobject.o .obj/moc_qtextdocument.o .obj/moc_qtextimagehandler_p.o .obj/moc_qtexttable.o .obj/moc_qtextlist.o .obj/moc_qbrush.o .obj/moc_qpainter.o .obj/moc_qpdfwriter.o .obj/moc_qplatformbackingstore.o .obj/moc_qvalidator.o .obj/moc_qopenglshaderprogram.o .obj/moc_qopenglengineshadermanager_p.o .obj/moc_qopengltimerquery.o  -L/home/cybex/qt5-5-1/qt-everywhere-opensource-src-5.5.1/qtbase/lib -lQt5Core -lpthread -lpng -lqtharfbuzzng -lz -lGL 
ln -s libQt5Gui.so.5.5.1 libQt5Gui.so
ln -s libQt5Gui.so.5.5.1 libQt5Gui.so.5
ln -s libQt5Gui.so.5.5.1 libQt5Gui.so.5.5
rm -f ../../lib/libQt5Gui.so.5.5.1
mv -f libQt5Gui.so.5.5.1  ../../lib/ 
rm -f ../../lib/libQt5Gui.so
rm -f ../../lib/libQt5Gui.so.5
rm -f ../../lib/libQt5Gui.so.5.5
mv -f libQt5Gui.so ../../lib/ 
mv -f libQt5Gui.so.5 ../../lib/ 
mv -f libQt5Gui.so.5.5 ../../lib/ 
make[3]: Leaving directory '/home/cybex/qt5-5-1/qt-everywhere-opensource-src-5.5.1/qtbase/src/gui'
make[2]: Leaving directory '/home/cybex/qt5-5-1/qt-everywhere-opensource-src-5.5.1/qtbase/src'
make[1]: *** [Makefile:46: sub-src-make_first] Error 2
make[1]: Leaving directory '/home/cybex/qt5-5-1/qt-everywhere-opensource-src-5.5.1/qtbase'
make: *** [Makefile:73: module-qtbase-make_first] Error 2
我省略了大部分的
make
输出,但上面是它如何失败的,对此有什么想法吗

更新2

谢谢你花时间帮忙。以下是
make-j8
的完整输出(编译Qt5.5.1)


现在您有许多这样的错误:

ssl/qsslcertificate_openssl.cpp: In function ‘uint qHash(const QSslCertificate&, uint)’:
ssl/qsslcertificate_openssl.cpp:63:30: error: invalid use of incomplete type ‘X509 {aka struct x509_st}’
         return qHashBits(x509->sha1_hash, SHA_DIGEST_LENGTH, seed);
                              ^~
In file included from /usr/include/openssl/crypto.h:31:0,
                 from /usr/include/openssl/comp.h:16,
                 from /usr/include/openssl/ssl.h:47,
                 from ../../include/QtNetwork/5.5.1/QtNetwork/private/../../../../../src/network/ssl/qsslcontext_openssl_p.h:53,
                 from ../../include/QtNetwork/5.5.1/QtNetwork/private/qsslcontext_openssl_p.h:1,
                 from ssl/qsslsocket_p.h:55,
                 from ssl/qsslsocket_openssl_p.h:63,
                 from ssl/qsslsocket_openssl_symbols_p.h:64,
                 from ssl/qsslcertificate_openssl.cpp:35:
/usr/include/openssl/ossl_typ.h:119:16: note: forward declaration of ‘X509 {aka struct x509_st}’
 typedef struct x509_st X509;
                ^~~~~~~
因此,您将openssl 1.0.2g提取到了
/opt/lib/openssl/
,但是
/usr/include
中还有其他(更新的?)openssl头


根据,明确指定您的openssl头目录(添加
-I/opt/lib/openssl/include/openssl
应该可以解决这个问题。

您是否需要
-developer build
选项,因为我怀疑它会将
-Werror
添加到编译选项中。@ssbssa请查看更新您共享的新输出中现在只有警告,这意味着错误一定发生得更早。@ssbssa hi,谢谢您的帮助。)帮助。请参阅更新2