CLion Cannot run program "make" The system cannot find the file specified
Asked Answered
B

1

6

When opening a makefile project in CLion I get the error message:

Cannot run program "make" (in directory "D:\Werkstudent\XWF\XT_Einzelauswertung"): CreateProcess error=2, The system cannot find the file specified: CreateProcess error=2, The system cannot find the file specified
Make execution failed with exit code = 127
  • I'm using mingw64, installed with msys2 on Windows.
  • mingw-w64-x86_64-toolchain is installed.
  • In Build, Execution, Deployment -> Toolchains I have added MinGW with Environment C:\msys64\mingw64. Make, C Compiler and C++ Compiler are all correctly detected.
  • In Build, Execution, Deployment -> Build Tools -> Make I have set the path to make executable as C:\msys64\mingw64\bin\mingw32-make.exe.

Relevant debug log of CLion:

2020-11-23 10:01:57,997 [ 244797]   INFO - System.util.ExternalSystemUtil - External project [D:/Werkstudent/XWF/XT_Einzelauswertung] resolution task started
2020-11-23 10:01:57,997 [ 244797]  DEBUG - om.jetbrains.cidr.cpp.makefile - Makefile analysis started at: 10:01:57 id: analysis:aa0e0ae1-8957-4100-b93e-e389cbdb8646
2020-11-23 10:01:59,285 [ 246085]   INFO - om.jetbrains.cidr.cpp.makefile - MakefileResolverState: Starting make: make clean
2020-11-23 10:01:59,293 [ 246093]  DEBUG - om.jetbrains.cidr.cpp.makefile - Channel closed coroutine name = StandaloneCoroutine{Completed}@60fcd138
2020-11-23 10:01:59,295 [ 246095]  DEBUG - om.jetbrains.cidr.cpp.makefile - Makefile constructor message: com.jetbrains.cidr.cpp.makefile.project.resolver.messages.ConstructorAnalysisError(Make execution failed with exit code = 127)
2020-11-23 10:01:59,305 [ 246105]  DEBUG - om.jetbrains.cidr.cpp.makefile - Makefile analyzer message: com.jetbrains.cidr.cpp.makefile.project.resolver.messages.MakeExecutionError(Make execution failed with exit code = 127)
2020-11-23 10:01:59,315 [ 246115]   INFO - om.jetbrains.cidr.cpp.makefile - MakefileResolverState: Starting make: make --just-print --print-directory --keep-going all
2020-11-23 10:01:59,330 [ 246130]  DEBUG - om.jetbrains.cidr.cpp.makefile - Makefile constructor message: com.jetbrains.cidr.cpp.makefile.project.resolver.messages.CriticalConstructorAnalysisError(Cannot run program "make" (in directory "D:\Werkstudent\XWF\XT_Einzelauswertung"): CreateProcess error=2, The system cannot find the file specified)
2020-11-23 10:01:59,331 [ 246131]  DEBUG - om.jetbrains.cidr.cpp.makefile - Channel closed coroutine name = StandaloneCoroutine{Completed}@742f7782
2020-11-23 10:01:59,330 [ 246130]  DEBUG - om.jetbrains.cidr.cpp.makefile - Makefile analyzer message: com.jetbrains.cidr.cpp.makefile.project.resolver.messages.CriticalAnalysisFailure(Cannot run program "make" (in directory "D:\Werkstudent\XWF\XT_Einzelauswertung"): CreateProcess error=2, The system cannot find the file specified)
2020-11-23 10:01:59,331 [ 246131]  DEBUG - om.jetbrains.cidr.cpp.makefile - Makefile analyzer message: com.jetbrains.cidr.cpp.makefile.project.resolver.messages.MakeExecutionError(Make execution failed with exit code = 127)
2020-11-23 10:01:59,331 [ 246131]  DEBUG - om.jetbrains.cidr.cpp.makefile - Makefile constructor message: com.jetbrains.cidr.cpp.makefile.project.resolver.messages.ConstructorAnalysisError(Make execution failed with exit code = 127)
2020-11-23 10:01:59,361 [ 246161]   INFO - om.jetbrains.cidr.cpp.makefile - make exited with code 127
2020-11-23 10:01:59,361 [ 246161]  DEBUG - om.jetbrains.cidr.cpp.makefile - Makefile constructor message: com.jetbrains.cidr.cpp.makefile.project.resolver.messages.ConstructorAnalysisError(Make execution failed with exit code = 127)
2020-11-23 10:01:59,361 [ 246161]  DEBUG - om.jetbrains.cidr.cpp.makefile - Channel closed coroutine name = StandaloneCoroutine{Completed}@63439922
2020-11-23 10:01:59,371 [ 246171]  DEBUG - om.jetbrains.cidr.cpp.makefile - Makefile analyzer message: com.jetbrains.cidr.cpp.makefile.project.resolver.messages.MakeExecutionError(Make execution failed with exit code = 127)
2020-11-23 10:01:59,371 [ 246171]  DEBUG - om.jetbrains.cidr.cpp.makefile - Makefile constructor message: com.jetbrains.cidr.cpp.makefile.project.resolver.messages.ConstructorAnalysisError(Cannot run program "make" (in directory "D:\Werkstudent\XWF\XT_Einzelauswertung"): CreateProcess error=2, The system cannot find the file specified)
2020-11-23 10:01:59,381 [ 246181]  DEBUG - om.jetbrains.cidr.cpp.makefile - Makefile analyzer message: com.jetbrains.cidr.cpp.makefile.project.resolver.messages.TargetsAnalyzerError(Cannot run program "make" (in directory "D:\Werkstudent\XWF\XT_Einzelauswertung"): CreateProcess error=2, The system cannot find the file specified)
2020-11-23 10:01:59,382 [ 246182]  DEBUG - om.jetbrains.cidr.cpp.makefile - Channel closed coroutine name = StandaloneCoroutine{Completed}@a7d27cb
2020-11-23 10:01:59,382 [ 246182]  DEBUG - om.jetbrains.cidr.cpp.makefile - Makefile constructor message: com.jetbrains.cidr.cpp.makefile.project.resolver.messages.ConstructorAnalysisStatus(Makefile analysis finished. Success = false)
2020-11-23 10:01:59,383 [ 246183]  DEBUG - om.jetbrains.cidr.cpp.makefile - Makefile constructor message: com.jetbrains.cidr.cpp.makefile.project.resolver.messages.CriticalConstructorAnalysisError(No compilation commands found)
2020-11-23 10:01:59,386 [ 246186]  DEBUG - om.jetbrains.cidr.cpp.makefile - Channel closed coroutine name = StandaloneCoroutine{Completed}@258f8a01
2020-11-23 10:01:59,386 [ 246186]  DEBUG - om.jetbrains.cidr.cpp.makefile - Makefile constructor message: ModuleStructureMessage(moduleStructure=ModuleData: XT_Einzelauswertung)
2020-11-23 10:01:59,387 [ 246187]  DEBUG - om.jetbrains.cidr.cpp.makefile - Makefile analysis finished at: 10:01:59 id: analysis:aa0e0ae1-8957-4100-b93e-e389cbdb8646
result: failure
2020-11-23 10:01:59,387 [ 246187]  DEBUG - om.jetbrains.cidr.cpp.makefile - Channel closed coroutine name = StandaloneCoroutine{Completed}@66027050
2020-11-23 10:01:59,416 [ 246216]   INFO - System.util.ExternalSystemUtil - External project [D:/Werkstudent/XWF/XT_Einzelauswertung] resolution task executed in 1419 ms.
2020-11-23 10:01:59,778 [ 246578]   INFO - ge.ExternalProjectsDataStorage - Save external projects data in 20 ms

What am I doing wrong, why can't CLion find the make executable?

Britten answered 23/11, 2020 at 9:13 Comment(2)
The code = 127 means that executable module did not find the DLL(s). In your case it means that your folder with make is not in the path.Leif
But it has autodetected the full path for the make executable in Build, Execution, Deployment -> Toolchains as C:\msys64\mingw64\bin\mingw32-make.exe so it shouldn't matter.Britten
B
5

Ok found the solution.

@uta was in the comment kinda right. CLion could find the make executable, but make dependes on a bunch of other coreutils which it couldn't find.

So I had to add C:\msys64\mingw64\bin and C:\msys64\usr\bin to my windows PATH.

How did I figure it out? Executing mingw32-make in the mingw terminal worked fine.
So I executed mingw32-make clean in the terminal inside CLion, which gave me errors described. So the error messages wheren't from CLion, but from the make command itself.
After that I tried adding the both paths to PATH only inside CLion but I couldn't find an option for it. So ultimately I had to add it in the system environment variables. Don't know yet if this is messing sth other up because of clashes in the executable names.

Oh and now I'm getting errors in the "Configuring project" step probably because of parsing errors..

Britten answered 25/11, 2020 at 9:3 Comment(2)
Thanks ! And also worked for my with cygwin :)Ovary
I got a similar problem today. If someone use a wsl in windows and can make in command line. Then maybe u should add a WSL config at File->Settings->Build,Execution,Deployment->Toolchains. Press the + button, select WSL then config CMake, Make, C Compiler and C++ Compiler. (type which cmake, which make, which gcc, which g++ to know where it is). Finilly, don't forget to make WSL config defaultCaracal

© 2022 - 2024 — McMap. All rights reserved.