Cross compile Qt for Windows with MinGW64
-
I am trying to accomplish a Linux to Windows cross build of QT with MinGW64 with the current source tarball (https://download.qt.io/official_releases/qt/6.2/6.2.2/single/qt-everywhere-src-6.2.2.tar.xz)
I have found some helpful documentation in https://github.com/qt/qtbase/blob/6.2.2/cmake/README.md, with this I am able to build QT for the host system. According to the doc I first need a host build of QT for the cross build to generate sources. Building QT for the host system works as described in the link.
However if I am them attempting the the cross build with CMake, i.e.
cmake <path-to-sources> -GNinja \ -DCMAKE_BUILD_TYPE=Release \ -DCMAKE_SYSTEM_NAME=Windows \ -DCMAKE_C_COMPILER=x86_64-w64-mingw32-gcc-posix \ -DCMAKE_CXX_COMPILER=x86_64-w64-mingw32-c++-posix \ -DQT_HOST_PATH=/path-to-host-build
I am running into an error:
ERROR: The OpenGL functionality tests failed! You might need to modify the include and library search paths by editing QMAKE_INCDIR_OPENGL[_ES2], QMAKE_LIBDIR_OPENGL[_ES2] and QMAKE_LIBS_OPENGL[_ES2] in the mkspec for your platform.
Any idea why this is happening in the cross build and not in the host build?
Or should I use the
configure
script instead? I did find blog post like this one: https://medium.com/@vladadgad/cross-compile-qt-for-windows-on-linux-platform-57e4b71ed1aa however the options passed to configure are not mentioned inconfigure --help
. Ideally I am looking for a pointer to the right documentation how to cross build with either theconfigure
script or withcmake
directly.Thanks for reading, any help is appreciated.
-
@ozaq
this thread might help:
https://forum.qt.io/topic/132307/qt6-cross-compile-for-windows