Description of problem: I can't link at Qt5 Widgets application statically. I get the dreaded "qwindows.dll missing" error. CONFIG+=static If I add Q_IMPORT_PLUGIN(QWindowsIntegrationPlugin) in my main, I get a compile error: release/main.o: In function `ZN45StaticQWindowsIntegrationPluginPluginInstanceC4Ev': /git/ecenctool/main.cpp:10: undefined reference to `qt_static_plugin_QWindowsIntegrationPlugin()' This does not help: win32-g++: LIBS += -lQt5PlatformSupport I'm using /usr/i686-w64-mingw32/bin/qt5/qmake Version-Release number of selected component (if applicable): mingw32-qt5-qtbase-static-5.4.1-2.fc22.noarch How reproducible: Link a Qt5 Widgets app statically, execute it on windows. Steps to Reproduce: 1. Use a Qt5 example 2. add CONFIG+=static, add Q_IMPORT_PLUGIN(QWindowsIntegrationPlugin) to main 3. qmake && make, copy to windows, double click Actual results: qwindows.dll is missing Expected results: Application executes. Additional info: I think libqwindows.a is missing from the -static rpm.
I've prepared a test build @ http://koji.fedoraproject.org/koji/taskinfo?taskID=10861088 Could you please try to install this test build. Adding LIBS += -lqwindows to your .pro file should be enough to get the qwindows plugin linked in statically
Looks better, but now DllMain pops up. Can you fix this one? x86_64-w64-mingw32-g++ -g -static -static-libgcc -static-libstdc++ -static -Wl,-subsystem,windows -mthreads -o release/ECEncTool.exe release/main.o release/ecmainwindow.o release/ecencrypt.o release/moc_ecmainwindow.o release/moc_ecencrypt.o -lmingw32 -lqt5main -lQt5PlatformSupport -lqwindows -L/home/vasquez/git/libsodium-win64/lib -lsodium -lQt5Widgets -lQt5Gui -lcomdlg32 -loleaut32 -limm32 -ljpeg -lpng -lharfbuzz -lglib-2.0 -lintl -lwinmm -lQt5Xml -lQt5Core -lole32 -luuid -lws2_32 -ladvapi32 -lshell32 -lkernel32 -lz -lpcre16 -lEGL -lGLESv2 -ld3d9 -ldxguid -lgdi32 -luser32 /usr/x86_64-w64-mingw32/sys-root/mingw/lib/../lib/libGLESv2.a(main.o):(.text+0x131): multiple definition of `DllMain' /usr/x86_64-w64-mingw32/sys-root/mingw/lib/../lib/libEGL.a(main.o):(.text+0x117): first defined here collect2: error: ld returned 1 exit status
Okay, that's a completely separate issue in the mingw-angleproject package but I'll look into it
Thanks. I can open another bug if you want.
This bug report is sufficient for now
Anything I can help with here? I'd love to built the application statically.
I was also hit by this bug. I'm running the Fedora 23 docker image. Is there a test build for Fedora 23 that I can try out? I'll report back with my findings. Thanks for all the great mingw packaging!
@Erik, Do you still have the .spec with the proposed fix? If so I can build an RPM and test out the fix for my use case. Or if you just let me know generally what the fix was, I'll try to recreate it myself.
mingw-qt5-qtxmlpatterns-5.5.1-1.fc23 mingw-qt5-qtwinextras-5.5.1-1.fc23 mingw-qt5-qtwebsockets-5.5.1-1.fc23 mingw-qt5-qtwebkit-5.5.1-1.fc23 mingw-qt5-qttranslations-5.5.1-1.fc23 mingw-qt5-qttools-5.5.1-1.fc23 mingw-qt5-qtsvg-5.5.1-1.fc23 mingw-qt5-qtsensors-5.5.1-1.fc23 mingw-qt5-qtscript-5.5.1-1.fc23 mingw-qt5-qtquick1-5.5.1-1.fc23 mingw-qt5-qtmultimedia-5.5.1-1.fc23 mingw-qt5-qtlocation-5.5.1-1.fc23 mingw-qt5-qtimageformats-5.5.1-1.fc23 mingw-qt5-qtgraphicaleffects-5.5.1-1.fc23 mingw-qt5-qtdeclarative-5.5.1-1.fc23 mingw-qt5-qtbase-5.5.1-1.fc23 mingw-qt5-qtactiveqt-5.5.1-1.fc23 has been submitted as an update to Fedora 23. https://bodhi.fedoraproject.org/updates/FEDORA-2015-bc03865b2e
mingw-angleproject-0-0.13.git.30d6c2.20141113.fc23, mingw-qt5-qtactiveqt-5.5.1-1.fc23, mingw-qt5-qtbase-5.5.1-2.fc23, mingw-qt5-qtdeclarative-5.5.1-1.fc23, mingw-qt5-qtgraphicaleffects-5.5.1-1.fc23, mingw-qt5-qtimageformats-5.5.1-1.fc23, mingw-qt5-qtlocation-5.5.1-1.fc23, mingw-qt5-qtmultimedia-5.5.1-1.fc23, mingw-qt5-qtquick1-5.5.1-1.fc23, mingw-qt5-qtscript-5.5.1-1.fc23, mingw-qt5-qtsensors-5.5.1-1.fc23, mingw-qt5-qtsvg-5.5.1-1.fc23, mingw-qt5-qttools-5.5.1-1.fc23, mingw-qt5-qttranslations-5.5.1-1.fc23, mingw-qt5-qtwebkit-5.5.1-1.fc23, mingw-qt5-qtwebsockets-5.5.1-1.fc23, mingw-qt5-qtwinextras-5.5.1-1.fc23, mingw-qt5-qtxmlpatterns-5.5.1-1.fc23 has been pushed to the Fedora 23 testing repository. If problems still persist, please make note of it in this bug report. See https://fedoraproject.org/wiki/QA:Updates_Testing for instructions on how to install test updates. You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2015-bc03865b2e
mingw-angleproject-0-0.13.git.30d6c2.20141113.fc23, mingw-qt5-qtactiveqt-5.5.1-1.fc23, mingw-qt5-qtbase-5.5.1-2.fc23, mingw-qt5-qtdeclarative-5.5.1-1.fc23, mingw-qt5-qtgraphicaleffects-5.5.1-1.fc23, mingw-qt5-qtimageformats-5.5.1-1.fc23, mingw-qt5-qtlocation-5.5.1-1.fc23, mingw-qt5-qtmultimedia-5.5.1-1.fc23, mingw-qt5-qtquick1-5.5.1-1.fc23, mingw-qt5-qtscript-5.5.1-1.fc23, mingw-qt5-qtsensors-5.5.1-1.fc23, mingw-qt5-qtsvg-5.5.1-1.fc23, mingw-qt5-qttools-5.5.1-1.fc23, mingw-qt5-qttranslations-5.5.1-1.fc23, mingw-qt5-qtwebkit-5.5.1-1.fc23, mingw-qt5-qtwebsockets-5.5.1-1.fc23, mingw-qt5-qtwinextras-5.5.1-1.fc23, mingw-qt5-qtxmlpatterns-5.5.1-1.fc23 has been pushed to the Fedora 23 stable repository. If problems still persist, please make note of it in this bug report.
Better late than never: I confirm it works now as expected, bug is fixed.
I'm still getting the same "could not find or load the Qt platform plugin 'windows'" error. @andreas.mac - Do you maybe have a minimal example that you could share that you've had success with? This is the Dockerfile I used to create a container for the build: FROM fedora:23 RUN dnf install -y \ ccache \ make \ mingw32-gcc-c++ \ mingw32-qt5-qtbase-static \ mingw32-winpthreads-static \ upx \ && dnf clean all ENV PATH=/usr/lib64/ccache:/usr/i686-w64-mingw32/bin/qt5:${PATH}
I think the important stuff is in the pro file. I use this: TEMPLATE = app CONFIG += static DEFINE += static ... win32-g++: LIBS += -lQt5PlatformSupport -lqwindows #win32-g++: QTPLUGIN += Qt5WindowsIntegration win32-g++: QMAKE_LFLAGS += -static -static-libgcc -static-libstdc++ win32-g++: QMAKE_CFLAGS += -DQT_STATICPLUGIN ... In the main.c: .... #include <QtPlugin> Q_IMPORT_PLUGIN(QWindowsIntegrationPlugin) .... I have pretty much everything from mingw64-*-static-* installed also. HTH
Thanks! Now I too can confirm that the new mingw32-qt5-*-static packages are able to build applications with the qwindows plugin statically linked. For the record, I only needed this in my .pro file: --- snip --- CONFIG += static # The documented method of using "QTPLUGIN += qwindows" is broken. The # workaround is to use: LIBS += -lqwindows --- snip --- And this in my main.cpp: --- snip --- #include <QtPlugin> Q_IMPORT_PLUGIN(QWindowsIntegrationPlugin) --- snip --- Everything else was not necessary for me.