I am getting errors when trying to build nanomsg project in Windows 7:
cmake ..
-- Building for: NMake Makefiles
-- The C compiler identification is GNU 4.7.1
-- Check for working C compiler: C:/Program Files (x86)/CodeBlocks/MinGW/bin/gcc.exe
CMake Error: Generator: execution of make failed. Make command was: "nmake" "/NOLOGO" "cmTC_5d837\fast"
-- Check for working C compiler: C:/Program Files (x86)/CodeBlocks/MinGW/bin/gcc.exe -- broken
CMake Error at C:/Program Files (x86)/cmake-3.9.4-win64-x64/share/cmake-3.9/Modules/CMakeTestCCompiler.cmake:51 (message):
The C compiler "C:/Program Files (x86)/CodeBlocks/MinGW/bin/gcc.exe" is not
able to compile a simple test program.
It fails with the following output:
Change Dir: C:/Users/User/Documents/Internal/nanomsg-master/build/CMakeFiles/CMakeTmp
Run Build Command:"nmake" "/NOLOGO" "cmTC_5d837\fast"
Generator: execution of make failed. Make command was: "nmake" "/NOLOGO"
"cmTC_5d837\fast"
CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
CMakeLists.txt:29 (project)
-- Configuring incomplete, errors occurred!
See also "C:/Users/User/Documents/Internal/nanomsg-master/build/CMakeFiles/CMakeOutput.log".
See also "C:/Users/User/Documents/Internal/nanomsg-master/build/CMakeFiles/CMakeError.log".
I use gcc
compiler and make
from Mingw
toolchain and I can run succesfully gcc.exe
and mingw32-make.exe
on a simple example.
In the file CMakeCache.txt
the cache variables are set as follows:
//C compiler
CMAKE_C_COMPILER:FILEPATH=C:/Program Files (x86)/CodeBlocks/MinGW/bin/gcc.exe
//Program used to build from makefiles.
CMAKE_MAKE_PROGRAM:STRING=nmake
I think that the problem comes from CMAKE_MAKE_PROGRAM
variable it should take C:/Program Files (x86)/CodeBlocks/MinGW/bin/mingw32-make.exe
, however i dont understand from where it gets the value nmake
.
Even i replaced it manually I get the same problem.
My questions :
CMAKE_MAKE_PROGRAM
takes the value nmake
?CMake fills the cache file with the values it detects based what is in CMakeLists.txt
and whatever files it includes in combination with any -D
paramters supplied to cmake
.
On Windows CMake will default to Microsoft's nmake
tool. The way to override this is by passing parameter -G"MinGW Makefiles"
to cmake
, or in case you use MSYS shell -G"MSYS Makefiles"
.
But there is a faster build tool than make
called Ninja (get it from https://ninja-build.org/) which you can use by passing -GNinja
to cmake
.
Note: I see you're using the old MinGW that comes with Code::Blocks. There is a more up to date successor to MinGW called MinGW-w64, which supports both Windows 32-bit and 64-bit. A recent standalone build can be downloaded from https://winlibs.com/ and it also includes ninja.exe
.
P.S.: If you run into more issues building the nanomsg sources after following these tips, consider passing -DNN_TESTS:BOOL=OFF
to cmake
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With