Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tiled failed to build due to 'crash in cl.exe' on windows with MSVC using qbs build steps. #3791

Closed
spacelg opened this issue Jul 26, 2023 · 4 comments
Labels
bug Broken behavior. qt issue Qt related issue.

Comments

@spacelg
Copy link

spacelg commented Jul 26, 2023

Hi All,

Environment:
VS 2022 + Windows Server 2022 Datacenter

Tiled failed to build due to 'crash in cl.exe' on windows with MSVC using qbs build steps. The issue is that qbs attempts to use 'cl /Bx cmd.exe' to attempt to get the implied command line arguments passed to cl. This is not the intended purpose of the /Bx flag. Qbs should be using the flags /Bd (for defines and includes) and /Be (for environment variables). The relevant buggy source code in qbs is here. But it's an underlying issue with the Tiled build steps. Could you please help look at this issue?

Steps to reproduce the behavior:

  1. git clone https://github.com/mapeditor/tiled F:\gitP\mapeditor\tiled
  2. Open a VS2022 x64 cmd && cd F:\gitP\mapeditor\tiled
  3. set PATH=F:\tools\qt5\qt\Tools\QtCreator\bin;%PATH%
  4. set PATH=F:\tools\qt5\qt\5_15_2\msvc2019_64\bin;%PATH%
  5. qbs build config:release

Expected behavior
Did not cause cl.exe to crash.

Actual behavior
Cause cl.exe to crash.

Error Message


** Visual Studio 2022 Developer Command Prompt v17.6.5
** Copyright (c) 2022 Microsoft Corporation


##[debug] Command #0 exited with code [0].
##[command] Command #1 (Output in "build.log"): cd F:\gitP\mapeditor\tiled
##[debug] Command #1 exited with code [0].
##[command] Command #2 (Output in "build.log"): set PATH=F:\tools\qt5\qt\Tools\QtCreator\bin;%PATH%
##[debug] Command #2 exited with code [0].
##[command] Command #3 (Output in "build.log"): set PATH=F:\tools\qt5\qt\5_15_2\msvc2019_64\bin;%PATH%
##[debug] Command #3 exited with code [0].
##[command] Command #4 (Output in "build.log"): qbs build config:release 2>&1
Build graph does not yet exist for configuration 'release'. Starting from scratch.
Resolving project for configuration release
Detecting Qt installations...
Found Qt at 'F:\tools\qt5\qt\5_15_2\msvc2019_64\bin\qmake.exe'.
Setting up Qt at 'F:\tools\qt5\qt\5_15_2\msvc2019_64\bin\qmake.exe'...
Qt was set up successfully.
WARNING: PYTHONHOME not set. The Python plugin will not be available.
ERROR: F:\gitP\mapeditor\tiled\src\libtiled\libtiled.qbs:3:1 Error while handling product 'libtiled':
F:\tools\qt5\qt\Tools\QtCreator\share\qtcreator\qbs\share\qbs\imports\qbs\Probes\MsvcProbe.qbs:52:16 Error: Could not run C:/Program Files/Microsoft Visual Studio/2022/Enterprise/VC/Tools/MSVC/14.36.32532/bin/HostX64/x64/cl.exe (Process crashed)
F:\gitP\mapeditor\tiled\src\qtpropertybrowser\qtpropertybrowser.qbs:1:1 Error while handling product 'qtpropertybrowser':
F:\tools\qt5\qt\Tools\QtCreator\share\qtcreator\qbs\share\qbs\imports\qbs\Probes\MsvcProbe.qbs:52:16 Error: Could not run C:/Program Files/Microsoft Visual Studio/2022/Enterprise/VC/Tools/MSVC/14.36.32532/bin/HostX64/x64/cl.exe (Process crashed)
F:\gitP\mapeditor\tiled\src\qtsingleapplication\qtsingleapplication.qbs:1:1 Error while handling product 'qtsingleapplication':
F:\tools\qt5\qt\Tools\QtCreator\share\qtcreator\qbs\share\qbs\imports\qbs\Probes\MsvcProbe.qbs:52:16 Error: Could not run C:/Program Files/Microsoft Visual Studio/2022/Enterprise/VC/Tools/MSVC/14.36.32532/bin/HostX64/x64/cl.exe (Process crashed)
F:\gitP\mapeditor\tiled\src\tiled\libtilededitor.qbs:5:1 Error while handling product 'libtilededitor':
F:\tools\qt5\qt\Tools\QtCreator\share\qtcreator\qbs\share\qbs\imports\qbs\Probes\MsvcProbe.qbs:52:16 Error: Could not run C:/Program Files/Microsoft Visual Studio/2022/Enterprise/VC/Tools/MSVC/14.36.32532/bin/HostX64/x64/cl.exe (Process crashed)
F:\gitP\mapeditor\tiled\translations\translations.qbs:1:1 Error while handling product 'translations':
F:\tools\qt5\qt\Tools\QtCreator\share\qtcreator\qbs\share\qbs\imports\qbs\Probes\MsvcProbe.qbs:52:16 Error: Could not run C:/Program Files/Microsoft Visual Studio/2022/Enterprise/VC/Tools/MSVC/14.36.32532/bin/HostX64/x64/cl.exe (Process crashed)
##[debug] Command #4 exited with code [1].
##[error] Detected error code [1].

@spacelg spacelg added the bug Broken behavior. label Jul 26, 2023
@bjorn
Copy link
Member

bjorn commented Jul 28, 2023

Hmm, is this a new issue with VS 2022? I actually have a CI build on AppVeyor using VS 2019 + Qt 6.4 which is working fine.

But it's an underlying issue with the Tiled build steps. Could you please help look at this issue?

Since you've already pointed out it's an issue in Qbs, what makes you say it's an issue with the Tiled build steps? Do you think it's possible to work this around in Tiled project files, rather than patching up Qbs?

Granted, I would not expect Qbs to actually break on VS 2022... somebody would surely have noticed by now?

@spacelg
Copy link
Author

spacelg commented Aug 1, 2023

Sorry for the late reply, not sure if this is a new issue in vs2022, currently our latest CI is VS2022, this issue only occurs in our PR runs, but the manual command line test is fine. In fact, we also reported a source issue to qbs https://bugreports.qt.io/browse/QBS-1743, We reported to Tiled and also informed that this problem will cause the build of Tiled to cause cl to crash.

@bjorn
Copy link
Member

bjorn commented Aug 1, 2023

@spacelg I tried to reproduce the issue in #3799, but there must be more to the problem you're facing since the AppVeyor build against VS 2022 worked fine. See https://ci.appveyor.com/project/bjorn/tiled/builds/47686323/job/qymqq63l1f0egxkm for the build log.

One difference is that rather than just opening VS2022 cmd and then running qbs build, I am explicitly having Qbs detect the available toolchains with qbs setup-toolchains --detect and then setting the default profile with qbs config defaultProfile MSVC2022-x64, before running qbs build. You may want to give that a try as well.

@bjorn bjorn added the qt issue Qt related issue. label Aug 2, 2023
@bjorn
Copy link
Member

bjorn commented Jan 12, 2024

Issue was reported fixed in Qbs 2.2.1. I've updated CI in #3873.

@bjorn bjorn closed this as completed Jan 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Broken behavior. qt issue Qt related issue.
Projects
None yet
Development

No branches or pull requests

2 participants