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

mingw-w64-x86_64-cmake fails to start #23531

Open
5 of 6 tasks
umlaeute opened this issue Feb 27, 2025 · 6 comments
Open
5 of 6 tasks

mingw-w64-x86_64-cmake fails to start #23531

umlaeute opened this issue Feb 27, 2025 · 6 comments
Labels

Comments

@umlaeute
Copy link

umlaeute commented Feb 27, 2025

Description / Steps to reproduce the issue

  1. all this is done in an MINGW2 MinGW 64-bit shell
  2. Update mingw64 to the latest and greatest
    pacman -Suy
    (on my system this currently updates to filesystem 2025.02-23.1)
  3. install mingw-w64-x86_64-cmake
    pacman -S "${MINGW_PACKAGE_PREFIX}-cmake"
  4. run cmake
    $ cmake || echo $?
    127

Expected behavior

i expect to be greeted with a the Cmake banner:

Usage

  cmake [options] <path-to-source>
  cmake [options] <path-to-existing-build>
  cmake [options] -S <path-to-source> -B <path-to-build>

Specify a source directory to (re-)generate a build system for it in the
current working directory.  Specify an existing build directory to
re-generate its build system.

Run 'cmake --help' for more information.


Actual behavior

nothing is printed, and instead i get an error code 127 (afair this is "file not found").

it took me a while to narrow this down, as I already had the cmake package (without the ${MINGW_PACKAGE_PREFIX}-) installed, and ran cmake before updating.
this would then cache the path to the cmake binary as /usr/bin/cmake, and subsequent runs would use the binary from the cmake-package, which is working correctly.
starting up a new shell, would clear the cache (so cmake is now resolved to ${MINGW_PREFIX}/bin/cmake - e.g. /mingw64/bin/cmake), and things start to fail.

Verification

Windows Version

MSYS_NT-10.0-14393

MINGW environments affected

  • MINGW64
  • MINGW32
  • UCRT64
  • CLANG64
  • CLANGARM64

Are you willing to submit a PR?

if I new how to fix the problem, I probably would submit a PR (but I don't)

@umlaeute umlaeute added the bug label Feb 27, 2025
@umlaeute
Copy link
Author

i've also tested the MINGW32, UCRT64 and CLANG64 environments, and all fail.
I cannot test the CLANGARM64 environment on my hardware.

@MehdiChinoune
Copy link
Collaborator

Are you sure you used the corresponding shell, if yes then there is an issue in your OS.

@umlaeute
Copy link
Author

umlaeute commented Feb 27, 2025

i'm pretty sure, but how should I test/verify/...?

and why is /usr/bin/cmake working correctly?

the VM (based on Windows10 Enterprise 2016 LTSB) has been updated a couple of times, and I have not seen the issue before the last upgrade.
before the last upgrade (Windows version 1607, system build 14393.6897), I had the following versions of MinGW64 packages:

filesystem 2023.02.07-1 # pre-installed on the VM
cmake 3.29.2-1 # pre-installed on the VM
mingw-w64-x86_64-cmake 3.29.2-2 # fresh installation

everything works fine here (I just tested)

the recent update, was basically doing a Windows system update (still Win10; but now the system build says 14393.7785), a full upgrade of MinGW, installing Visual Studio 2022 (via chocolatey), and installing CMake-3.31.5(!) (via their download; lives in C:\Program Files\CMake\).

The upstream Cmake is in the PATH (that is: /c/Program Files/CMake/bin), but even if I remove it from the PATH the problem persists.

All the other Cmake's installed on the system appear to work fine:

origin version works? path
upstream 3.31.5 💚 /c/Program Files/CMake/bin/cmake
MSVC 2022 3.30.5-msvc23 💚 /c/Program Files/Microsoft Visual Studio/2022/Community/Common7/IDE/CommonExtensions/Microsoft/CMake/CMake/bin/cmake.exe
MSYS2 3.31.5 💚 /usr/bin/cmake
MinGW64 3.31.5 💥 /mingw64/bin/cmake.exe

@MehdiChinoune
Copy link
Collaborator

You said "MINGW2 MinGW 64-bit shell" that shell does not exist, are you sure you used MINGW64 not MSYS shell.

@umlaeute
Copy link
Author

indeed, that was a typo.
what I meant is the MSYS2 MinGW 64-bit shell icon on my desktop. sorry.

@Morilli
Copy link

Morilli commented Feb 27, 2025

You could try installing gdb (mingw-w64-x86_64-gdb) and run cmake via gdb to see what it outputs:

gdb -ex=r --args cmake

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants