Created attachment 1452221 [details] This archive contains the source of a simple qt "hello world!" application Description of problem: Trying to cross-compile a Qt app using the prebuilt static MinGW version of Qt shipped in Fedora results in an error Version-Release number of selected component (if applicable): Version : 5.10.1 Release : 2.fc28 How reproducible: always Steps to Reproduce: 1. install mingw32-qt5-qtbase-static 2. unpack bug.tar.gz and cd into the directory 3. run mingw32-qmake-qt5 4. run mingw32-make Actual results: $ mingw32-make make -f Makefile.Release make[1]: Entering directory '/home/user/Downloads' i686-w64-mingw32-g++ -c -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions --param=ssp-buffer-size=4 -fno-keep-inline-dllexport -O2 -Wall -Wextra -mthreads -DUNICODE -DQT_STATIC -DQT_DESIGNER_STATIC -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_NEEDS_QMAIN -I. -I/usr/i686-w64-mingw32/sys-root/mingw/include/qt5 -I/usr/i686-w64-mingw32/sys-root/mingw/include/qt5/QtWidgets -I/usr/i686-w64-mingw32/sys-root/mingw/include/qt5/QtGui -I/usr/i686-w64-mingw32/sys-root/mingw/include/qt5/QtCore -Irelease -I/usr/i686-w64-mingw32/sys-root/mingw/share/qt5/mkspecs/mingw-w64-g++ -o release/main.o main.cpp i686-w64-mingw32-g++ -g -static -static-libstdc++ -static-libgcc -Wl,-subsystem,windows -mthreads -o release/hello.exe release/main.o -lmingw32 -L/usr/i686-w64-mingw32/sys-root/mingw/lib -lqt5main -lQt5Widgets -lQt5Gui -lgdi32 -lcomdlg32 -loleaut32 -limm32 -luxtheme -ljpeg -lpng -lharfbuzz -lglib-2.0 -lshlwapi -lintl -lpcre -lfreetype -lbz2 -lpng16 -lQt5Core -lz -lpcre2-16 -lversion -lole32 -luuid -lwinmm -lws2_32 -ladvapi32 -lshell32 -luser32 -lkernel32 -lnetapi32 -luserenv -liconv /usr/lib/gcc/i686-w64-mingw32/7.2.0/../../../../i686-w64-mingw32/bin/ld: cannot find -lfreetype /usr/lib/gcc/i686-w64-mingw32/7.2.0/../../../../i686-w64-mingw32/bin/ld: cannot find -lbz2 /usr/lib/gcc/i686-w64-mingw32/7.2.0/../../../../i686-w64-mingw32/bin/ld: cannot find -lpcre2-16 /usr/lib/gcc/i686-w64-mingw32/7.2.0/../../../../i686-w64-mingw32/bin/ld: cannot find -liconv collect2: error: ld returned 1 exit status make[1]: *** [Makefile.Release:63: release/hello.exe] Error 1 make[1]: Leaving directory '/home/user/Downloads' make: *** [Makefile:36: release] Error 2 Expected results: A windows executable release/hello.exe is created Additional info: This fixes the problem: $ pkcon install mingw32-freetype-static $ pkcon install mingw32-bzip2-static $ pkcon install mingw32-pcre2-static $ pkcon install mingw32-win-iconv-static
Full output of qmake and make before applying the fix: $ mingw32-qmake-qt5 /usr/i686-w64-mingw32/sys-root/mingw/share/qt5/mkspecs/features/toolchain.prf:159: Variable QMAKE_DEFAULT_INCDIRS is not defined. /usr/i686-w64-mingw32/sys-root/mingw/share/qt5/mkspecs/features/toolchain.prf:160: Variable QMAKE_DEFAULT_LIBDIRS is not defined. Info: creating stash file /home/user/Downloads/.qmake.stash /usr/i686-w64-mingw32/sys-root/mingw/share/qt5/mkspecs/features/toolchain.prf:159: Variable QMAKE_DEFAULT_INCDIRS is not defined. /usr/i686-w64-mingw32/sys-root/mingw/share/qt5/mkspecs/features/toolchain.prf:160: Variable QMAKE_DEFAULT_LIBDIRS is not defined. /usr/i686-w64-mingw32/sys-root/mingw/share/qt5/mkspecs/features/toolchain.prf:159: Variable QMAKE_DEFAULT_INCDIRS is not defined. /usr/i686-w64-mingw32/sys-root/mingw/share/qt5/mkspecs/features/toolchain.prf:160: Variable QMAKE_DEFAULT_LIBDIRS is not defined. $ mingw32-make make -f Makefile.Release make[1]: Entering directory '/home/user/Downloads' i686-w64-mingw32-g++ -c -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions --param=ssp-buffer-size=4 -fno-keep-inline-dllexport -O2 -Wall -Wextra -mthreads -DUNICODE -DQT_STATIC -DQT_DESIGNER_STATIC -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_NEEDS_QMAIN -I. -I/usr/i686-w64-mingw32/sys-root/mingw/include/qt5 -I/usr/i686-w64-mingw32/sys-root/mingw/include/qt5/QtWidgets -I/usr/i686-w64-mingw32/sys-root/mingw/include/qt5/QtGui -I/usr/i686-w64-mingw32/sys-root/mingw/include/qt5/QtCore -Irelease -I/usr/i686-w64-mingw32/sys-root/mingw/share/qt5/mkspecs/mingw-w64-g++ -o release/main.o main.cpp i686-w64-mingw32-g++ -g -static -static-libstdc++ -static-libgcc -Wl,-subsystem,windows -mthreads -o release/hello.exe release/main.o -lmingw32 -L/usr/i686-w64-mingw32/sys-root/mingw/lib -lqt5main -lQt5Widgets -lQt5Gui -lgdi32 -lcomdlg32 -loleaut32 -limm32 -luxtheme -ljpeg -lpng -lharfbuzz -lglib-2.0 -lshlwapi -lintl -lpcre -lfreetype -lbz2 -lpng16 -lQt5Core -lz -lpcre2-16 -lversion -lole32 -luuid -lwinmm -lws2_32 -ladvapi32 -lshell32 -luser32 -lkernel32 -lnetapi32 -luserenv -liconv /usr/lib/gcc/i686-w64-mingw32/7.2.0/../../../../i686-w64-mingw32/bin/ld: cannot find -lfreetype /usr/lib/gcc/i686-w64-mingw32/7.2.0/../../../../i686-w64-mingw32/bin/ld: cannot find -lbz2 /usr/lib/gcc/i686-w64-mingw32/7.2.0/../../../../i686-w64-mingw32/bin/ld: cannot find -lpcre2-16 /usr/lib/gcc/i686-w64-mingw32/7.2.0/../../../../i686-w64-mingw32/bin/ld: cannot find -liconv collect2: error: ld returned 1 exit status make[1]: *** [Makefile.Release:63: release/hello.exe] Error 1 make[1]: Leaving directory '/home/user/Downloads' make: *** [Makefile:36: release] Error 2 $ file release/hello.exe release/hello.exe: cannot open `release/hello.exe' (No such file or directory After applying the fix: $ mingw32-qmake-qt5 /usr/i686-w64-mingw32/sys-root/mingw/share/qt5/mkspecs/features/toolchain.prf:159: Variable QMAKE_DEFAULT_INCDIRS is not defined. /usr/i686-w64-mingw32/sys-root/mingw/share/qt5/mkspecs/features/toolchain.prf:160: Variable QMAKE_DEFAULT_LIBDIRS is not defined. Info: creating stash file /home/user/Downloads/.qmake.stash /usr/i686-w64-mingw32/sys-root/mingw/share/qt5/mkspecs/features/toolchain.prf:159: Variable QMAKE_DEFAULT_INCDIRS is not defined. /usr/i686-w64-mingw32/sys-root/mingw/share/qt5/mkspecs/features/toolchain.prf:160: Variable QMAKE_DEFAULT_LIBDIRS is not defined. /usr/i686-w64-mingw32/sys-root/mingw/share/qt5/mkspecs/features/toolchain.prf:159: Variable QMAKE_DEFAULT_INCDIRS is not defined. /usr/i686-w64-mingw32/sys-root/mingw/share/qt5/mkspecs/features/toolchain.prf:160: Variable QMAKE_DEFAULT_LIBDIRS is not defined. $ mingw32-make make -f Makefile.Release make[1]: Entering directory '/home/user/Downloads' i686-w64-mingw32-g++ -c -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions --param=ssp-buffer-size=4 -fno-keep-inline-dllexport -O2 -Wall -Wextra -mthreads -DUNICODE -DQT_STATIC -DQT_DESIGNER_STATIC -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_NEEDS_QMAIN -I. -I/usr/i686-w64-mingw32/sys-root/mingw/include/qt5 -I/usr/i686-w64-mingw32/sys-root/mingw/include/qt5/QtWidgets -I/usr/i686-w64-mingw32/sys-root/mingw/include/qt5/QtGui -I/usr/i686-w64-mingw32/sys-root/mingw/include/qt5/QtCore -Irelease -I/usr/i686-w64-mingw32/sys-root/mingw/share/qt5/mkspecs/mingw-w64-g++ -o release/main.o main.cpp i686-w64-mingw32-g++ -g -static -static-libstdc++ -static-libgcc -Wl,-subsystem,windows -mthreads -o release/hello.exe release/main.o -lmingw32 -L/usr/i686-w64-mingw32/sys-root/mingw/lib -lqt5main -lQt5Widgets -lQt5Gui -lgdi32 -lcomdlg32 -loleaut32 -limm32 -luxtheme -ljpeg -lpng -lharfbuzz -lglib-2.0 -lshlwapi -lintl -lpcre -lfreetype -lbz2 -lpng16 -lQt5Core -lz -lpcre2-16 -lversion -lole32 -luuid -lwinmm -lws2_32 -ladvapi32 -lshell32 -luser32 -lkernel32 -lnetapi32 -luserenv -liconv make[1]: Leaving directory '/home/user/Downloads' $ file release/hello.exe release/hello.exe: PE32 executable (GUI) Intel 80386, for MS Windows
In theory you could also be linking statically against various qt libraries and dynamically against other libraries. I'd say it is the developers reponsibility to know which version is desired and to ensure that the corresponding packages are installed.