Cross-Compiling Qt Application with WSL and Visual Studio 2019 results in ERROR running qmake
-
Hi everyone,
since a while I am struggling with getting the cross-compilation running in Visual Studio 2019.
I want to cross-compile Qt applications on my windwos host system (with Qt5.14.2 being installed) for Linux systems using the windows integrated WSL2.
On the internet, some guides can be found e.g.: Qt Blog - Cross-Compiling embedded QtQuickApplication in Visual Studio.
So I have followed the steps, which I will briefly describe now:
-> modifying the VS2019 installtion and add "Linux development with C++" and "Desktop development with C++" was already installed.
-> setup WSL2 with Ubuntu 22.04
-> install all the required tools and compiler with:sudo apt install -y build-essential qtcreator qtbase5-dev qt5-qmake
-> running Qt VS Tools and add Qt installation with Host "Linux WSL", compiler set to "g++" and path:
/usr/lib/x86_64-linux-gnu/qt5
-> created a plain QtConsoleApplication project and added the Qt_WSL version in addtition to the Qt WIndows version for both, release and debug
-> VS2019 directly shows, that it canno open source file "QtCore/QCoreApplication". So it seems like, there is some linking missing. When trying to build the application to get some more information, the following error with qmake appears (I have manually replaced the username by "User"):>QtConsoleApplication1.vcxproj : error : ERROR running qmake >QtConsoleApplication1.vcxproj : error : qmake: (/usr/lib/x86_64-linux-gnu/qt5/bin/qmake) >QtConsoleApplication1.vcxproj : error : qmake: $PWD=C:\Users\"User"\Documents\QtConsoleApplication1\obj\x64\Debug_WSL\qmake\temp >QtConsoleApplication1.vcxproj : error : qmake: WARNING: Unable to generate output for: /mnt/c/Users/"User"/Documents/QtConsoleApplication1/obj/x64/Debug_WSL/qmake/temp/Makefile [TEMPLATE vcapp] >QtConsoleApplication1.vcxproj : error : qmake: QIODevice::write: device not open >QtConsoleApplication1.vcxproj : error : qmake: Error creating .vcxproj file
Then I have also tried to create a QtConsoleApplication only using the Qt_WSL version in the Qt Console Application Wizard, but I receive the following error from VS2019:
To me, both errors indicate, that there is something wrong with the linking, e.g. that the second error tries to resolve a path that mixes the windows and linux path structur "C:\usr\lib...."
But I dont know, how to fix this problem and I appreciate any kind of help :)