CMAKE_MAKE_PROGRAM not found
Asked Answered
F

17

93

I have reached the end of my rope with CMake; it has so much potential, but I cannot seem to make it find the basic system tools (i.e. make) in order to function.

SYMPTOMS

CMake and the CMake GUI produce the following (after deleting the CMakeCache.txt file):

Processing top-level CMakelists.txt for project swb
CMake Error: CMake was unable to find a build program corresponding to "MinGW Makefiles".
CMAKE_MAKE_PROGRAM is not set.  You probably need to select a different build tool.

I am focusing on finding make in this question, however, I've also had many of the same issues with CMake failing to find libraries and other utility files (linker, nm, ar, etc.). The techniques I list below seem to enable CMake to find these files when running under Linux.

SYSTEM

Windows 7 (64-bit); multiple versions of MinGW (32-bit/64-bit); Cmake 2.8.4; NONSTANDARD install location for MinGW (c:/MinGW-32 ).

THINGS I HAVE TRIED

  1. CMakelists.txt contains SET( CMAKE_MAKE_PROGRAM c:/MinGW-32/bin/make.exe FORCE ) within the first 10 lines of the file.

  2. Previous versions of CMakelists.txt contained:

    find_program(CMAKE_MAKE_PROGRAM
      NAMES make
            make.exe
      DOC "Find a suitable make program for building under Windows/MinGW"
      HINTS c:/MinGW-32/bin )  
    
  3. Set CMAKE_MAKE_PROGRAM in a cmd.exe environment variable prior to running either CMake or CMake-GUI.

  4. Use of a "toolchain" file which identifies CMAKE_MAKE_PROGRAM as well as CMAKE_C_COMPILER, etc.

ONE THING THAT HAS WORKED

CMake will successfully create build files IF I use the GUI to populate the CMAKE_MAKE_PROGRAM variable ("C:/MinGW-32/bin/make.exe").

QUESTION(S)

I can get CMake to work if I identify the name of the make program via the GUI. How does one enable CMake to find my make program without user intervention with the Windows 7 (64-bit) / MinGW combination?

Frutescent answered 26/5, 2011 at 16:7 Comment(1)
W
44

I have two suggestions:

  1. Do you have make in your %PATH% environment variable? On my system, I need to add %MINGW_DIR%\bin to %PATH%.

  2. Do you have make installed? Depending on your mingw installation, it can be a separate package.

  3. Last resort: Can you pass the full path to make on the commandline? cmake -D"CMAKE_MAKE_PROGRAM:PATH=C:/MinGW-32/bin/make.exe" ..\Source

Willner answered 26/5, 2011 at 20:4 Comment(3)
Thanks for the suggestions! I already had %MINGW_DIR%\bin in my path, and make.exe is definitely in the %MINGW_DIR%\bin directory. Any other ideas!?Frutescent
@westie314: Is make in your path? If you open up a command line and type "make --version" what is displayed?Callup
Does CMake search for 'make' or for 'mingw32-make'? If the latter, that one has to be in the path as well.Chrisy
M
24

In the GUI, select the "Advanced" checkbox. It should now show several entries below. Rename your mingw32-make.exe file to make.exe (you can just make a copy) and set the CMAKE_MAKE_PROGRAM filepath variable to the location of said file.

Merola answered 1/11, 2012 at 6:52 Comment(3)
This should be accepted answer. It worked for me: Check 'Advanced', then the CMAKE_MAKE_PROGRAM variable appears. Simply change the NOT_FOUND_SOMETHING into your C:/MinGW/bin/make.exe or whatever path it is.Ethno
My GUI does not any settings show CMAKE_MAKE_PROGRAM. Any ideas?Trilley
You can create the entry manually, by clicking "Add Entry" and filling out the fields as follows: Name - CMAKE_MAKE_PROGRAM, Type - FILEPATH, Value - X:/Path/To/Make. Or from the command line by adding -DCMAKE_MAKE_PROGRAM=X:/Path/To/Make. Hope it helpsZapata
A
21

On ubuntu, i think I was missing the compiler. Fixed with:

sudo apt install build-essential
Anisette answered 3/7, 2019 at 10:31 Comment(1)
does not solve the problem.Cosma
M
17

I’ve just solved the same problem. I had MinGW with GCC and G++ installed but not make. This command helped me:

mingw-get.exe install mingw32-make

After running it, clear CMake cache (delete the CMakeCache.txt file in the CMake's working directory) and run CMake again.

Mukerji answered 26/9, 2013 at 12:48 Comment(2)
In the MinGW basic setup, include mingw32-base to get make.Idyllic
Or if you're using Cygwin, you need to also install make. Find apt-cyg and use apt-cyg install make.Pastorship
J
9

Previous answers suggested (re)installing or configuring CMake, they all did not help.

Previously MinGW's compilation of Make used the filename mingw32-make.exe and now it is make.exe. Most suggested ways to configure CMake to use the other file dont work.

Just copy make.exe and rename the copy mingw32-make.exe.

Jane answered 17/4, 2015 at 8:58 Comment(0)
K
7

I have tried to install the missing packages. Installing the toolchain and restarting CLion solved all in my case:

pacman -S mingw-w64-x86_64-cmake mingw-w64-x86_64-extra-cmake-modules
pacman -S mingw-w64-x86_64-make
pacman -S mingw-w64-x86_64-gdb
pacman -S mingw-w64-x86_64-toolchain
Klina answered 18/7, 2016 at 10:29 Comment(1)
This works perfectly for newer versions of MinGW, where mingw32-make doesn't exist any more.Darlenadarlene
G
3

Recently i had the same problem (Compiling OpenCV with CMake and Qt/MinGW on WIN764)

And I think I solve this including on my environment variable PATH (through Control Panel\All Control Panel Items\System\Advanced Sytem Settings) with the %MINGW_DIR%\bin and %CMAKE_DIR%/bin

Furthermore, I installed cmake2.8 on an easy directory (without blanks on it)

Garfield answered 15/3, 2012 at 2:8 Comment(0)
H
3

I had the exact same problem when I tried to compile OpenCV with Qt Creator (MinGW) to build the .a static library files.

For those that installed Qt 5.2.1 for Windows 32-bit (MinGW 4.8, OpenGL, 634 MB), this problem can be fixed if you add the following to the system's environment variable Path:

C:\Qt\Qt5.2.0\Tools\mingw48_32\bin
Hoax answered 13/3, 2014 at 12:31 Comment(0)
S
1

I had the same problem. Installed mingw using the installer provided at http://tdm-gcc.tdragon.net/ . It adds the correct environment variables to path when installing mingw (No need to edit the path variable manually). That did the trick for me.

Salvation answered 25/12, 2012 at 9:48 Comment(0)
E
1

Well, if it is useful, I have had several problems with cmake, including this one. They all disappeared when I fix the global variable (in my case the MinGW Codeblocks) PATH in the system. When the codeblocks install is not in default, and for some unknow reason, this global variable does not point to the right place. Check if the path of Codeblocks or MinGW are correct:

Right click on "My Computer"> Properties> Advanced Properties or Advanced> Environment Variables> to Change the PATH variable

It worked for me;)

Epilepsy answered 2/9, 2013 at 14:58 Comment(0)
W
1

I had the same problem and specified CMAKE_MAKE_PROGRAM in a toolchain file, cmake didn't find it. Then I tried adding -D CMAKE_MAKE_PROGRAM=... in the command-line, then it worked. Then I tried changing the generator from "MinGW Makefiles" to "Unix Makefiles" and removed the -D CMAKE_MAKE_PROGRAM from the command-line, and then it worked also!

So for some reason when the generator is set to "MinGW Makefiles" then the CMAKE_MAKE_PROGRAM setting in the toolchain file is not effective, but for the "Unix Makefiles" generator it is.

Wilden answered 1/10, 2014 at 16:18 Comment(1)
It seems that in addition make.exe needs to be in the PATH environment variable.Wilden
A
1

It seems everybody has different solution. I solved my problem like:

When I install 64bit mingw it installed itself to : "C:\Program Files\mingw-w64\x86_64-5.1.0-posix-seh-rt_v4-rev0\mingw64\bin"

Eventhough mingw-make.exe was under the path above, one invalid charecter or long path name confused CMake. I try to add path to environment path, try to give CMAKE as paramater it didn't work for me .

Finally I moved complex path of mingw-w64 to "C:/mingw64", than set the environment path, restarted CMake. Problem solved for me .

Amoakuh answered 26/7, 2015 at 8:24 Comment(0)
I
0

I had the same problem which is solved using the following:

Try to rename all the folders to not to be more than 8 characters and without spaces.

Impose answered 5/9, 2013 at 14:44 Comment(0)
C
0

It also happens when I just want to compile opencv2.3.2 with mingw32 (in tdm-gcc suites). Often when I install the tdm-gcc, I would like to rename the mingw32-make.exe to make.exe. And I thinks this could be the question. If cmake is asked to generated a MinGW Makefiles, It would try to find ming32-make.exe instead of make.exe. So I copy the make.exe to mingw32-make.exe and reconfigure in Cmake-gui. Finally it works! So I'd like to advise to find whether you have mingw32-make.exe or not to solve this question.

Campbellbannerman answered 1/11, 2013 at 12:1 Comment(0)
U
0

I tried to use CMake to build GammaRay for Qt on Windows with mingw. So, I had the Qt installed. And I had the same problem as other users here.

The approach that worked for me is launching cmake-gui from Qt build prompt (a shortcut created by Qt installer in "Start Menu\All programs\Qt{QT_VERSION}" folder).

Upright answered 29/12, 2014 at 11:1 Comment(0)
R
0

I had to add the follow lines to my windows path to fix this. CMAKE should set the correct paths on install otherwise as long as you check the box. This is likely to be a different solution depending on the myriad of versions that are possible to install.

C:\msys64\mingw32\bin
C:\msys64\mingw64\bin
Restraint answered 17/1, 2019 at 16:15 Comment(0)
W
0
    # RUN curl -sSL https://install.python-poetry.org | python -
RUN pip install "poetry==1.6.1"
RUN poetry config virtualenvs.create false
RUN poetry config installer.max-workers 10
RUN conda install -c conda-forge dlib
RUN conda install gcc gxx_linux-64
RUN conda install anaconda::make
Wentworth answered 13/2 at 20:2 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.