Как я могу собрать Qt с оптимизацией по времени соединения, используя mingw-w64? - PullRequest
1 голос
/ 14 мая 2019

Сборка Qt 5.12.3 с mingw-w64 с использованием g ++ 8.1.0 работает хорошо. Но как только я добавляю параметр -ltcg к параметрам configure, я получаю ошибки сборки.

Настройка вызова выглядит следующим образом:

../qt5/configure -prefix ../qt5Install -release -recheck-all -ltcg -confirm-license -opensource -platform win32-g++ -opengl desktop -nomake examples -nomake tests -system-freetype -I /c/Libraries/OpenCascade/3rdPartyMingw64/freetype-2.6.3-mingw-64/include -L/c/Libraries/OpenCascade/3rdPartyMingw64/freetype-2.6.3-mingw-64/bin -skip qtconnectivity -skip qtdeclarative -skip qtlocation -skip qtmultimedia -skip qtquickcontrols -skip qtquickcontrols2 -skip qtsensors -skip qtwebsockets -skip qtwinextras -skip qtwebchannel -skip qtwebengine

Кому-нибудь удалось собрать Qt с оптимизацией по времени соединения с использованием mingw-w64? В чем прикол?

Ошибки сборки здесь:

g++ -Wl,-s -shared -fno-keep-inline-dllexport -O3 -std=c++1z -fno-exceptions -flto -Wl,-subsystem,windows -Wl,--out-implib,C:/Libraries/qt/qt5Build/qtbase/lib/libQt5Gui.a -o ../../lib/Qt5Gui.dll @object_script.Qt5Gui.Release  -LC:/Libraries/OpenCascade/3rdPartyMingw64/freetype-2.6.3-mingw-64/bin -LC:/Libraries/qt/qt5Build/qtbase/lib C:/Libraries/qt/qt5Build/qtbase/lib/libQt5Core.a .obj/release/Qt5Gui_resource_res.o C:/Libraries/qt/qt5Build/qtbase/lib/libqtlibpng.a -LC:/Libraries/OpenCascade/3rdPartyMingw64/freetype-2.6.3-mingw-64/bin C:/Libraries/qt/qt5Build/qtbase/lib/libqtharfbuzz.a C:/mingw-w64-8.1/mingw64/x86_64-w64-mingw32/lib/libz.a -lgdi32 -lcomdlg32 -loleaut32 -limm32 -lwinmm -lws2_32 -lole32 -luuid -luser32 -ladvapi32 C:/mingw-w64-8.1/mingw64/x86_64-w64-mingw32/lib/libglu32.a C:/mingw-w64-8.1/mingw64/x86_64-w64-mingw32/lib/libopengl32.a C:/mingw-w64-8.1/mingw64/x86_64-w64-mingw32/lib/libgdi32.a C:/mingw-w64-8.1/mingw64/x86_64-w64-mingw32/lib/libuser32.a
.obj/release/qimage_compat.o (symbol from plugin):(.gnu.linkonce.t._ZTS12QPaintDevice+0x0): multiple definition of `typeinfo name for QPaintDevice'
.obj/release/qimage_ssse3.o:qimage_ssse3.cpp:(.rdata$_ZTS12QPaintDevice[_ZTS12QPaintDevice]+0x0): first defined here
.obj/release/qimage_compat.o (symbol from plugin):(.gnu.linkonce.t._ZTI12QPaintDevice+0x0): multiple definition of `typeinfo for QPaintDevice'
.obj/release/qimage_ssse3.o:qimage_ssse3.cpp:(.rdata$_ZTI12QPaintDevice[_ZTI12QPaintDevice]+0x0): first defined here
.obj/release/qimage_compat.o (symbol from plugin):(.gnu.linkonce.t._ZTS6QImage+0x0): multiple definition of `typeinfo name for QImage'
.obj/release/qimage_ssse3.o:qimage_ssse3.cpp:(.rdata$_ZTS6QImage[_ZTS6QImage]+0x0): first defined here

...

.obj/release/qimage.o (symbol from plugin):(.gnu.linkonce.t._ZTI18QRasterPaintEngine+0x0): multiple definition of `typeinfo for QRasterPaintEngine'
.obj/release/qdrawhelper_sse4.o:qdrawhelper_sse4.cpp:(.rdata$_ZTI18QRasterPaintEngine[_ZTI18QRasterPaintEngine]+0x0): first defined here
C:/Libraries/qt/qt5/qtbase/src/3rdparty/harfbuzz-ng/src/hb-shaper-list.hh:43:1: warning: '_hb_ot_shaper_shape_plan_data_create' violates the C++ One Definition Rule  [-Wodr]
 HB_SHAPER_IMPLEMENT (ot) /* <--- This is our main OpenType shaper. */
 ^
C:/Libraries/qt/qt5/qtbase/src/3rdparty/harfbuzz-ng/src/hb-ot-shape.cc:171:1: note: return value type mismatch
 _hb_ot_shaper_shape_plan_data_create (hb_shape_plan_t    *shape_plan,
 ^
C:/Libraries/qt/qt5/qtbase/src/3rdparty/harfbuzz-ng/src/hb-ot-shape-private.hh:37:8: note: type name 'hb_ot_shape_plan_t' should match type name 'hb_ot_shaper_shape_plan_data_t'
 struct hb_ot_shape_plan_t
        ^
C:/Libraries/qt/qt5/qtbase/src/3rdparty/harfbuzz-ng/src/hb-shaper-list.hh:43:1: note: the incompatible type is defined here
 HB_SHAPER_IMPLEMENT (ot) /* <--- This is our main OpenType shaper. */
 ^
C:/Libraries/qt/qt5/qtbase/src/3rdparty/harfbuzz-ng/src/hb-ot-shape.cc:171:1: note: '_hb_ot_shaper_shape_plan_data_create' was previously declared here
 _hb_ot_shaper_shape_plan_data_create (hb_shape_plan_t    *shape_plan,
 ^
C:/Libraries/qt/qt5/qtbase/src/3rdparty/harfbuzz-ng/src/hb-shaper-list.hh:43:1: warning: '_hb_ot_shaper_shape_plan_data_destroy' violates the C++ One Definition Rule  [-Wodr]
 HB_SHAPER_IMPLEMENT (ot) /* <--- This is our main OpenType shaper. */
 ^
C:/Libraries/qt/qt5/qtbase/src/3rdparty/harfbuzz-ng/src/hb-ot-shape.cc:200:1: note: type mismatch in parameter 1
 _hb_ot_shaper_shape_plan_data_destroy (hb_ot_shaper_shape_plan_data_t *plan)
 ^
C:/Libraries/qt/qt5/qtbase/src/3rdparty/harfbuzz-ng/src/hb-ot-shape-private.hh:37:8: note: type name 'hb_ot_shape_plan_t' should match type name 'hb_ot_shaper_shape_plan_data_t'
 struct hb_ot_shape_plan_t
        ^
C:/Libraries/qt/qt5/qtbase/src/3rdparty/harfbuzz-ng/src/hb-shaper-list.hh:43:1: note: the incompatible type is defined here
 HB_SHAPER_IMPLEMENT (ot) /* <--- This is our main OpenType shaper. */
 ^
C:/Libraries/qt/qt5/qtbase/src/3rdparty/harfbuzz-ng/src/hb-ot-shape.cc:200:1: note: '_hb_ot_shaper_shape_plan_data_destroy' was previously declared here
 _hb_ot_shaper_shape_plan_data_destroy (hb_ot_shaper_shape_plan_data_t *plan)
 ^
C:/Libraries/qt/qt5/qtbase/src/3rdparty/harfbuzz-ng/src/hb-shaper-list.hh:43:1: warning: '_hb_ot_shaper_face_data_destroy' violates the C++ One Definition Rule  [-Wodr]
 HB_SHAPER_IMPLEMENT (ot) /* <--- This is our main OpenType shaper. */
 ^
C:/Libraries/qt/qt5/qtbase/src/3rdparty/harfbuzz-ng/src/hb-ot-shape.cc:140:1: note: type mismatch in parameter 1
 _hb_ot_shaper_face_data_destroy (hb_ot_shaper_face_data_t *data)
 ^
C:/Libraries/qt/qt5/qtbase/src/3rdparty/harfbuzz-ng/src/hb-ot-layout-private.hh:154:8: note: type name 'hb_ot_layout_t' should match type name 'hb_ot_shaper_face_data_t'
 struct hb_ot_layout_t
        ^
C:/Libraries/qt/qt5/qtbase/src/3rdparty/harfbuzz-ng/src/hb-shaper-list.hh:43:1: note: the incompatible type is defined here
 HB_SHAPER_IMPLEMENT (ot) /* <--- This is our main OpenType shaper. */
 ^
C:/Libraries/qt/qt5/qtbase/src/3rdparty/harfbuzz-ng/src/hb-ot-shape.cc:140:1: note: '_hb_ot_shaper_face_data_destroy' was previously declared here
 _hb_ot_shaper_face_data_destroy (hb_ot_shaper_face_data_t *data)
 ^
collect2.exe: error: ld returned 1 exit status
mingw32-make[4]: *** [Makefile.Release:1219: ../../lib/Qt5Gui.dll] Error 1

1 Ответ

0 голосов
/ 20 мая 2019

Кажется, что я нашел способ собрать Qt с оптимизацией по времени компоновки: изменив файл mkspecs/win32-g++/qmake.conf, установив строку флагов компоновщика в

QMAKE_LFLAGS_LTCG = $$QMAKE_CFLAGS_LTCG -Wl,-allow-multiple-definition

делаетсборка Qt удалась с помощью mingw-w64.Я зарегистрирую отчет об ошибке Qt для этой проблемы оптимизации во время соединения.

Оптимизация во время соединения уменьшает средний размер библиотеки Qt здесь на 9%.Единственный недостаток, который я вижу, заключается в том, что библиотеки Qt5OpenGL.dll и Qt5Xml.dll слегка растут на 0,3% и 3,0%.

...