静态编译Qt 5.5时链接插件错误



我正在尝试创建一个Qt的静态构建,我已经配置如下:

./configure -release -opensource -confirm-license -static -no-sql-sqlite -qt-zlib -qt-libpng -qt-libjpeg -qt-freetype -qt-xcb -icu -openssl -nomake examples -skip xmlpatterns

但是,我得到以下错误:

g++ -Wl,--gc-sections -Wl,-O1 -fuse-ld=gold -Wl,--enable-new-dtags -Wl,-rpath-link,/home/coin/tmp/qt-everywhere-opensource-src-5.5.0/qtdeclarative/lib -Wl,-rpath-link,/home/coin/tmp/qt-everywhere-opensource-src-5.5.0/qtbase/lib -o ../../bin/qmltestrunner .obj/main.o .obj/qmltestrunner_plugin_import.o   -L/home/coin/tmp/qt-everywhere-opensource-src-5.5.0/qtdeclarative/lib -lQt5QuickTest -L/home/coin/tmp/qt-everywhere-opensource-src-5.5.0/qtbase/lib -lQt5Test -lQt5Widgets -L/home/coin/tmp/qt-everywhere-opensource-src-5.5.0/qtbase/plugins/platforms -lqxcb -L/home/coin/tmp/qt-everywhere-opensource-src-5.5.0/qtbase/src/plugins/platforms/xcb/xcb-static -L/home/coin/tmp/qt-everywhere-opensource-src-5.5.0/qtbase/plugins/xcbglintegrations -lqxcb-egl-integration -L/home/coin/tmp/qt-everywhere-opensource-src-5.5.0/qtbase/src/plugins/platforms/xcb/gl_integrations/xcb_egl/xcb-static -lqxcb-glx-integration -L/home/coin/tmp/qt-everywhere-opensource-src-5.5.0/qtbase/src/plugins/platforms/xcb/gl_integrations/xcb_glx/xcb-static -lQt5XcbQpa -lXi -lxcb-static -L/home/coin/tmp/qt-everywhere-opensource-src-5.5.0/qtimageformats/plugins/imageformats -lqdds -lqicns -lqjp2 -lqmng -lqtga -lqtiff -lqwbmp -lqwebp -L/home/coin/tmp/qt-everywhere-opensource-src-5.5.0/qtbase/plugins/imageformats -lqico -L/home/coin/tmp/qt-everywhere-opensource-src-5.5.0/qtbase/plugins/egldeviceintegrations -lqeglfs-x11-integration -lX11-xcb -lxcb -lQt5EglDeviceIntegration -lQt5PlatformSupport -lfontconfig -lfreetype -lXrender -lXext -lX11 -ludev -lEGL -L/home/coin/tmp/qt-everywhere-opensource-src-5.5.0/qtdeclarative/plugins/qmltooling -lqmldbg_qtquick2 -lQt5Quick -lQt5Gui -lqtharfbuzzng -lqmldbg_tcp -lQt5Qml -L/home/coin/tmp/qt-everywhere-opensource-src-5.5.0/qtbase/plugins/bearer -lqconnmanbearer -lqgenericbearer -lqnmbearer -lQt5Network -lQt5DBus -lQt5Core -licui18n -licuuc -licudata -lqtpcre -lm -ldl -pthread -lgthread-2.0 -lrt -lglib-2.0 -lGL -lpthread
.obj/qmltestrunner_plugin_import.o:qmltestrunner_plugin_import.cpp:function _GLOBAL__sub_I_qmltestrunner_plugin_import.cpp: error: undefined reference to 'qt_static_plugin_QXcbIntegrationPlugin()'
.obj/qmltestrunner_plugin_import.o:qmltestrunner_plugin_import.cpp:function _GLOBAL__sub_I_qmltestrunner_plugin_import.cpp: error: undefined reference to 'qt_static_plugin_QXcbEglIntegrationPlugin()'
.obj/qmltestrunner_plugin_import.o:qmltestrunner_plugin_import.cpp:function _GLOBAL__sub_I_qmltestrunner_plugin_import.cpp: error: undefined reference to 'qt_static_plugin_QXcbGlxIntegrationPlugin()'
.obj/qmltestrunner_plugin_import.o:qmltestrunner_plugin_import.cpp:function _GLOBAL__sub_I_qmltestrunner_plugin_import.cpp: error: undefined reference to 'qt_static_plugin_QDDSPlugin()'
.obj/qmltestrunner_plugin_import.o:qmltestrunner_plugin_import.cpp:function _GLOBAL__sub_I_qmltestrunner_plugin_import.cpp: error: undefined reference to 'qt_static_plugin_QICNSPlugin()'
.obj/qmltestrunner_plugin_import.o:qmltestrunner_plugin_import.cpp:function _GLOBAL__sub_I_qmltestrunner_plugin_import.cpp: error: undefined reference to 'qt_static_plugin_QJp2Plugin()'
.obj/qmltestrunner_plugin_import.o:qmltestrunner_plugin_import.cpp:function _GLOBAL__sub_I_qmltestrunner_plugin_import.cpp: error: undefined reference to 'qt_static_plugin_QMngPlugin()'
.obj/qmltestrunner_plugin_import.o:qmltestrunner_plugin_import.cpp:function _GLOBAL__sub_I_qmltestrunner_plugin_import.cpp: error: undefined reference to 'qt_static_plugin_QTgaPlugin()'
.obj/qmltestrunner_plugin_import.o:qmltestrunner_plugin_import.cpp:function _GLOBAL__sub_I_qmltestrunner_plugin_import.cpp: error: undefined reference to 'qt_static_plugin_QTiffPlugin()'
.obj/qmltestrunner_plugin_import.o:qmltestrunner_plugin_import.cpp:function _GLOBAL__sub_I_qmltestrunner_plugin_import.cpp: error: undefined reference to 'qt_static_plugin_QWbmpPlugin()'
.obj/qmltestrunner_plugin_import.o:qmltestrunner_plugin_import.cpp:function _GLOBAL__sub_I_qmltestrunner_plugin_import.cpp: error: undefined reference to 'qt_static_plugin_QWebpPlugin()'
.obj/qmltestrunner_plugin_import.o:qmltestrunner_plugin_import.cpp:function _GLOBAL__sub_I_qmltestrunner_plugin_import.cpp: error: undefined reference to 'qt_static_plugin_QICOPlugin()'
.obj/qmltestrunner_plugin_import.o:qmltestrunner_plugin_import.cpp:function _GLOBAL__sub_I_qmltestrunner_plugin_import.cpp: error: undefined reference to 'qt_static_plugin_QEglFSX11IntegrationPlugin()'
.obj/qmltestrunner_plugin_import.o:qmltestrunner_plugin_import.cpp:function _GLOBAL__sub_I_qmltestrunner_plugin_import.cpp: error: undefined reference to 'qt_static_plugin_QConnmanEnginePlugin()'
.obj/qmltestrunner_plugin_import.o:qmltestrunner_plugin_import.cpp:function _GLOBAL__sub_I_qmltestrunner_plugin_import.cpp: error: undefined reference to 'qt_static_plugin_QGenericEnginePlugin()'
.obj/qmltestrunner_plugin_import.o:qmltestrunner_plugin_import.cpp:function _GLOBAL__sub_I_qmltestrunner_plugin_import.cpp: error: undefined reference to 'qt_static_plugin_QNetworkManagerEnginePlugin()'
collect2: error: ld returned 1 exit status
make[3]: *** [../../bin/qmltestrunner] Error 1
make[3]: Leaving directory `/home/coin/tmp/qt-everywhere-opensource-src-5.5.0/qtdeclarative/tools/qmltestrunner'

这似乎是插件和静态构建之间的问题。配置给出以下警告:

警告:使用静态链接将禁用动态链接加载插件。确保导入所有需要的静态插件,或者将需要的模块编译到库中。

Qt现在配置为构建。只需运行"make"。一旦一切都构建好了,你必须运行"make install"。Qt将被安装到/usr/local/Qt-5.5.0

在重新配置之前,请确保从上一个版本

然而,它似乎表明它应该工作。有什么问题吗?我可以禁用这些插件或试图使用它们的工具,因为我认为我不需要它们?

正如AlexanderVX所提到的,一个不干净的工作目录和一个不干净的rootfs目录,从以前的构建和安装动态版本的SDK,是我的问题。

我发现在配置期间使用'-nomake tests'选项允许SDK构建完成,但在针对SDK编译应用程序时,我有相同的链接器错误。

我把我的问题归结为拥有静态和动态链接库(例如libqlinuxfb)。libqlinuxfb.so)安装在rootfs的库目录下。然后链接器选择了动态版本而不是静态构建的库版本,因此'qt_static_plugin*'符号不存在。清除构建目录和已安装的rootfs解决了这个问题。

像AlexanderVX指出的那样,不干净的工作目录是我的问题。

git submodule foreach --recursive "git clean -dfx"

也可以用于清理,并且比

快得多。
make/jom clean

相关内容

  • 没有找到相关文章

最新更新