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

CMake generating MSYS instead of MinGW Makefiles when building glfw (0.44.0) for rust #157

Open
ghost opened this issue Jul 25, 2022 · 1 comment

Comments

@ghost
Copy link

ghost commented Jul 25, 2022

I have MinGWx64 installed on windows (as I'm more familiar with GCC) and rustup set up almost perfectly with the stable-x86_64-pc-windows-gnu toolchain set as default. It hasn't failed in anything until now, that I tried to build glfw version 0.44.0. I checked the rust analyzer server logs for any issues and came across this :

[ERROR rust_analyzer::lsp_utils] rust-analyzer failed to run build scripts

error: failed to run custom build command for `glfw-sys v3.3.5`

Caused by:
  process didn't exit successfully: `c:\Users\Rodrigo\Desktop\lel\test\target\debug\build\glfw-sys-738132ac5372cba1\build-script-build` (exit code: 101)
  --- stdout
  CMAKE_TOOLCHAIN_FILE_x86_64-pc-windows-gnu = None
  CMAKE_TOOLCHAIN_FILE_x86_64_pc_windows_gnu = None
  HOST_CMAKE_TOOLCHAIN_FILE = None
  CMAKE_TOOLCHAIN_FILE = None
  CMAKE_GENERATOR_x86_64-pc-windows-gnu = None
  CMAKE_GENERATOR_x86_64_pc_windows_gnu = None
  HOST_CMAKE_GENERATOR = None
  CMAKE_GENERATOR = None
  CMAKE_PREFIX_PATH_x86_64-pc-windows-gnu = None
  CMAKE_PREFIX_PATH_x86_64_pc_windows_gnu = None
  HOST_CMAKE_PREFIX_PATH = None
  CMAKE_PREFIX_PATH = None
  CMAKE_x86_64-pc-windows-gnu = None
  CMAKE_x86_64_pc_windows_gnu = None
  HOST_CMAKE = None
  CMAKE = None
  running: "cmake" "C:\\Users\\Rodrigo\\.cargo\\registry\\src\\github.com-1ecc6299db9ec823\\glfw-sys-3.3.5\\." "-G" "MSYS Makefiles" "-DGLFW_BUILD_EXAMPLES=OFF" "-DGLFW_BUILD_TESTS=OFF" "-DGLFW_BUILD_DOCS=OFF" "-DCMAKE_INSTALL_LIBDIR=lib" "-DCMAKE_INSTALL_PREFIX=c:\\Users\\Rodrigo\\Desktop\\lel\\test\\target\\debug\\build\\glfw-sys-18f492c6bd01a2d2\\out" "-DCMAKE_C_FLAGS= -ffunction-sections -fdata-sections -m64" "-DCMAKE_CXX_FLAGS= -ffunction-sections -fdata-sections -m64" "-DCMAKE_ASM_FLAGS= -ffunction-sections -fdata-sections -m64" "-DCMAKE_BUILD_TYPE=Debug"
  -- Using Win32 for window creation
  -- Configuring done
  -- Generating done
  -- Build files have been written to: C:/Users/Rodrigo/Desktop/lel/test/target/debug/build/glfw-sys-18f492c6bd01a2d2/out/build
  running: "cmake" "--build" "." "--target" "install" "--config" "Debug" "--parallel" "16"

  --- stderr
  process_begin: CreateProcess(NULL, sh.exe -c "/C/Program Files/CMake/bin/cmake.exe -S/C/Users/Rodrigo/.cargo/registry/src/github.com-1ecc6299db9ec823/glfw-sys-3.3.5 -B/C/Users/Rodrigo/Desktop/lel/test/target/debug/build/glfw-sys-18f492c6bd01a2d2/out/build --check-build-system CMakeFiles/Makefile.cmake 0", ...) failed.
  make (e=2): The system cannot find the file specified.
  mingw32-make: *** [Makefile:216: cmake_check_build_system] Error 2
  thread 'main' panicked at '
  command did not execute successfully, got: exit code: 2

  build script failed, must exit now', C:\Users\Rodrigo\.cargo\registry\src\github.com-1ecc6299db9ec823\cmake-0.1.48\src\lib.rs:975:5
  stack backtrace:
     0: rust_begin_unwind
               at /rustc/7b46aa594c4bdc507fbd904b6777ca30c37a9209/library\std\src/panicking.rs:584:5
     1: core::panicking::panic_fmt
               at /rustc/7b46aa594c4bdc507fbd904b6777ca30c37a9209/library\core\src/panicking.rs:142:14
     2: cmake::fail
               at C:\Users\Rodrigo\.cargo\registry\src\github.com-1ecc6299db9ec823\cmake-0.1.48\src\lib.rs:975:5
     3: cmake::run
               at C:\Users\Rodrigo\.cargo\registry\src\github.com-1ecc6299db9ec823\cmake-0.1.48\src\lib.rs:953:9
     4: cmake::Config::build
               at C:\Users\Rodrigo\.cargo\registry\src\github.com-1ecc6299db9ec823\cmake-0.1.48\src\lib.rs:832:9
     5: build_script_build::main
               at .\build.rs:5:15
     6: core::ops::function::FnOnce::call_once
               at /rustc/7b46aa594c4bdc507fbd904b6777ca30c37a9209\library\core\src\ops/function.rs:248:5
  note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

I read it carefully, and noticed something that I thought it was going to be it. For some reason, as in here:

running: "cmake" "C:\\Users\\Rodrigo\\.cargo\\registry\\src\\github.com-1ecc6299db9ec823\\glfw-sys-3.3.5\\." "-G" "MSYS Makefiles" "-DGLFW_BUILD_EXAMPLES=OFF" "-DGLFW_BUILD_TESTS=OFF" "-DGLFW_BUILD_DOCS=OFF" "-DCMAKE_INSTALL_LIBDIR=lib" "-DCMAKE_INSTALL_PREFIX=c:\\Users\\Rodrigo\\Desktop\\lel\\test\\target\\debug\\build\\glfw-sys-18f492c6bd01a2d2\\out" "-DCMAKE_C_FLAGS= -ffunction-sections -fdata-sections -m64" "-DCMAKE_CXX_FLAGS= -ffunction-sections -fdata-sections -m64" "-DCMAKE_ASM_FLAGS= -ffunction-sections -fdata-sections -m64" "-DCMAKE_BUILD_TYPE=Debug"

It is generating MSYS Makefiles instead of MinGW Makefiles.

I don't know if this depends on some local config or on the glfw package's own build files. Either way, if anyone has any other explanation to why does this happen or whatever advice to help me fix it it would be greatly appreciated. Thanks in advance.

EDIT : (To clarify, I don't even have MSVC nor Visual Studio installed, just MinGWx64 and VSCode for now)

@racka98
Copy link

racka98 commented Dec 22, 2022

Did you solve this?

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

No branches or pull requests

1 participant