MSVC WSL2 Cross-compile returns errors
-
When trying to cross-compile for Linux in Visual Studio, build fails (error and log provided below).
Provide your code where you believe the issue is, it should be compilable:
No code, default Qt Widgets project generated by Qt Visual Studio Tools
Provide the minimal amount of code that allows to replicate the issue or work on a solution
No code, default Qt Widgets project generated by Qt Visual Studio Tools
Answer these questions:
• Which Qt version are you using?
Qt version 6.10.1 (both on Windows (msvc_2022_64) and Ubuntu 24.04 WSL2 instance (gcc_64))
• Which version of QtCreator are you using?
Not using QtCreator, using Visual Studio 2022 17.14.25 + Qt Visual Studio Tools 3.4.1
• Which platform?
Windows+WSL2(Ubuntu 24.04)
• How did you install it?
Official online installerError:
Error (active) E2919 command-line error: specified directory via --current_directory option isn't a QtWidgetsApplication1 C:\Users\GiyaYet\Documents\Projects\CPP\QtWidgetsApplication1\QtWidgetsApplication1\QtWidgetsApplication1.cpp 1 directory: /AutoPCHC:\Users\GiyaYet\Documents\Projects\CPP\QtWidgetsApplication1 \.vs\QtWidgetsApplication1\v17\ipch\AutoPCH\596dd7bd6c7a2361 Error Host command failed. QtWidgetsApplication1 C:\Users\GiyaYet\AppData\Local\QtMsBuild\qt_vars.targets 119Line 119 on qt_vars.targets:
<HostExec Command="$(Cmd)" RedirectStdOut="props.txt" WorkingDirectory="@(WorkDir->'%(HostPath)')" Outputs="@(QMakeProps)" RemoteTarget="$(ResolvedRemoteTarget)" RemoteProjectDir="$(_ResolvedRemoteProjectDir)" />Build log:
1>------ Build started: Project: QtWidgetsApplication1, Configuration: ReleaseLinux x64 ------ 1> Qt/MSBuild: 3.4.1.0 1>Invoking 'mkdir -p $(dirname /mnt/c/Users/GiyaYet/Documents/Projects/CPP/QtWidgetsApplication1/QtWidgetsApplication1/obj/x64/ReleaseLinux/qt/qmake/props.txt); mkdir -p /mnt/c/Users/GiyaYet/Documents/Projects/CPP/QtWidgetsApplication1/QtWidgetsApplication1/obj/x64/ReleaseLinux/qt/qmake; cd /mnt/c/Users/GiyaYet/Documents/Projects/CPP/QtWidgetsApplication1/QtWidgetsApplication1/obj/x64/ReleaseLinux/qt/qmake; ("//wsl.localhost/Ubuntu-24.04/home/giyayet/Qt/6.10.1/gcc_64/bin/qmake" -query) 1> props.txt', working directory: '/mnt/c/Users/GiyaYet/Documents/Projects/CPP/QtWidgetsApplication1/QtWidgetsApplication1' 1> 1>C:\Users\GiyaYet\AppData\Local\QtMsBuild\qt_vars.targets(119,5): error : Host command failed. 1>Done building project "QtWidgetsApplication1.vcxproj" -- FAILED. ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========P.S. I found a topic with a similar error in International section: here , but it didn't get any replies. I hope that won't be the case for this post.
-
Hi and welcome to devnet,
Something is not clear in your setup, do you have a proper cross-compilation setup ?
This usually means a Qt version for the host OS and a second cross-compiled Qt for your target.
It seems you have two distinct installation. One on your Windows machine and one in your WLS.