Friday, January 26, 2024

[SOLVED] Error "C:/msys64/ucrt64/bin/cc.exe" is not able to compile a simple test program

Issue

I'm attempting to use CMake to build an open source C++ project (https://github.com/google-deepmind/mujoco_mpc/tree/main), but I encountered an error.

[cmake] Not searching for unused variables given on the command line.
[cmake] -- The C compiler identification is GNU 13.1.0
[cmake] -- The CXX compiler identification is GNU 13.1.0
[cmake] -- Detecting C compiler ABI info
[cmake] -- Detecting C compiler ABI info - failed
[cmake] -- Check for working C compiler: C:/msys64/ucrt64/bin/cc.exe
[cmake] -- Check for working C compiler: C:/msys64/ucrt64/bin/cc.exe - broken
[cmake] CMake Error at C:/Program Files/CMake/share/cmake-3.27/Modules/CMakeTestCCompiler.cmake:67 (message):
[cmake]   The C compiler
[cmake] 
[cmake]     "C:/msys64/ucrt64/bin/cc.exe"
[cmake] 
[cmake]   is not able to compile a simple test program.
[cmake] 
[cmake]   It fails with the following output:
[cmake] 
[cmake]     Change Dir: 'C:/Users/PC/Code/mujoco_mpc-main/mujoco_mpc-main/build/CMakeFiles/CMakeScratch/TryCompile-z9zhya'
[cmake]     
[cmake]     Run Build Command(s): C:/msys64/usr/bin/ninja.exe -v cmTC_599f8
[cmake]     [1/2] C:\msys64\ucrt64\bin\cc.exe    -o CMakeFiles/cmTC_599f8.dir/testCCompiler.c.obj -c 'C:/Users/PC/Code/mujoco_mpc-main/mujoco_mpc-main/build/CMakeFiles/CMakeScratch/TryCompile-z9zhya/testCCompiler.c'
[cmake]     FAILED: CMakeFiles/cmTC_599f8.dir/testCCompiler.c.obj 
[cmake]     C:\msys64\ucrt64\bin\cc.exe    -o CMakeFiles/cmTC_599f8.dir/testCCompiler.c.obj -c 'C:/Users/PC/Code/mujoco_mpc-main/mujoco_mpc-main/build/CMakeFiles/CMakeScratch/TryCompile-z9zhya/testCCompiler.c'
[cmake]     /bin/sh: line 1: C:msys64ucrt64bincc.exe: command not found
[cmake]     ninja: build stopped: subcommand failed.

It states that "C:/msys64/ucrt64/bin/cc.exe" is unable to compile a basic test program. I've tried various solutions I found on the internet, but I'm still unable to resolve the issue. Any assistance would be greatly appreciated.

This is my enviroment variables:


C:\Users\PC>cc --version
cc (Rev7, Built by MSYS2 project) 13.1.0
Copyright (C) 2023 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.


C:\Users\PC>where cc
C:\msys64\ucrt64\bin\cc.exe

C:\Users\PC>echo %PATH%
C:\Program Files\Git\cmd;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Program Files\Git\cmd;C:\Users\PC\AppData\Roaming\nvm;C:\Program Files\nodejs;C:\msys64\ucrt64\bin;C:\Program Files\CMake\bin;C:\msys64\usr\bin;C:\msys64\mingw64\bin;C:\msys64\mingw64\bin\msys2_shell.cmd -c;C:\Users\PC\AppData\Local\Microsoft\WindowsApps;C:\Users\PC\AppData\Local\Programs\Microsoft VS Code\bin;C:\Users\PC\AppData\Roaming\npm;C:\Users\PC\AppData\Roaming\nvm;C:\Program Files\nodejs

Solution

I have successfully configured it with Ninja of Mingw64. I still don't understand why it had issues with Ninja of Urs. But in the end, everything is fine now



Answered By - 19020051 Phạm Trung Nghĩa
Answer Checked By - Katrina (WPSolving Volunteer)