Building ZeroMQ on Windows 10 with Visual Studio and / or CMake fails - cmake

I am trying to set up a Co-simulation between Matlab / Simulink and an external application using the ZeroMQ library. The example I would like to build upon is described here. Therefore I need a compiled version (.dll) of the libzmq library's source code, which I downloaded from here. To my understanding the header zmq.hpp (from here) can be used directly without further compilation.
Unfortunately, I cannot manage to build the libzmq library, which is where any help would be very much appreciated! The available solutions suggested in some other questions did not work for me (see below).
I am using Windows 10, Visual Studio 2017 Community Edition and CMake 3.18.4.
As I am quite new to the topic it is definitely possible that I made some mistake during the different attempts I made. That is why I will describe in the following what I already tried that DID NOT WORK:
Going the same way as described in the example (section "Installing ZeroMQ") by opening the Native Tool Command Prompt from Visual Studio (admin mode), navigating to the build folder of libzmq and execute the provided build batch script resulted in the following error
C:\Users\MY_PATH\ZeroMQ\Work\libzmq-master_VS_native_tool\builds\deprecated-msvc\build>build.bat
Start Time: 18.11.2020 14:04:36,82
Building ..\vs201\libzmq.sln
Platform=x86
Configuration=DynDebug
*** ERROR, build terminated early, see: build_ni.log
Stop Time: 18.11.2020 14:04:37,01
Start Time: 18.11.2020 14:04:36,82
with the build_ni.log containing
Microsoft (R)-Build-Engine, Version 15.9.21+g9802d43bc3 fr .NET Framework
Copyright (C) Microsoft Corporation. Alle rights reserved.
MSBUILD : error MSB1009: Project file does not exist.
Switch: ..\vs201\libzmq.sln
The same problem has been encoutered here
Build zeromq on Windows 10 with CMake,
where the author writes that the Visual Studio solutions within libzmq have been deprecated because they are too difficult to maintain. The author managed to build the libzmq library from source using CMake.
2. I also tried to build the library with CMake Version 3.18.4 by using the GUI. In the Configurations I specified Visual Studio 15 2017 as generator and the default platform (Win32). Here is a screenshot of the resulting CMake cache variables:
CMake cache variables
I post all of them because I am new to CMake and not sure which of them might possibly be responsible for following errors. The resulting output from CMake indicates that there seems to be a problem with sodium and / or libsodium, although I have no clue here if this is needed whatsoever. Here is the output:
The C compiler identification is MSVC 19.16.27044.0
The CXX compiler identification is MSVC 19.16.27044.0
Detecting C compiler ABI info
Detecting C compiler ABI info - done
Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/BuildTools/VC/Tools/MSVC/14.16.27023/bin/Hostx86/x86/cl.exe - skipped
Detecting C compile features
Detecting C compile features - done
Detecting CXX compiler ABI info
Detecting CXX compiler ABI info - done
Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/BuildTools/VC/Tools/MSVC/14.16.27023/bin/Hostx86/x86/cl.exe - skipped
Detecting CXX compile features
Detecting CXX compile features - done
Looking for pthread.h
Looking for pthread.h - not found
Found Threads: TRUE
Detected ZMQ Version - 4.3.4
Could NOT find PkgConfig (missing: PKG_CONFIG_EXECUTABLE)
Not building draft classes and methods
Using builtin sha1
**CMake Warning (dev) at C:/Program Files/CMake/share/cmake-3.18/Modules/FindPackageHandleStandardArgs.cmake:273 (message):
The package name passed to `find_package_handle_standard_args` (sodium)
does not match the name of the calling package (Sodium). This can lead to
problems in calling code that expects `find_package` result variables
(e.g., `_FOUND`) to follow a certain pattern.
Call Stack (most recent call first):
builds/cmake/Modules/FindSodium.cmake:42 (find_package_handle_standard_args)
CMakeLists.txt:265 (find_package)
This warning is for project developers. Use -Wno-dev to suppress it.
Could NOT find sodium (missing: SODIUM_LIBRARIES SODIUM_INCLUDE_DIRS)
CMake Warning at CMakeLists.txt:275 (message):
libsodium not installed, instead using builtin tweetnacl, you may want to
install libsodium and run cmake again**
Using tweetnacl for CURVE security
Detected _WIN32_WINNT from CMAKE_SYSTEM_VERSION: 0x0A00
Using polling method in I/O threads: epoll
Including wepoll
Using polling method in zmq_poll(er)_* API: poll
Using 64 bytes alignment for lock-free data structures
Looking for include file windows.h
Looking for include file windows.h - found
Looking for include files winsock2.h, afunix.h
Looking for include files winsock2.h, afunix.h - found
Looking for include file condition_variable
Looking for include file condition_variable - found
Using condition_variable_t implementation: stl11
Looking for WSAStartup
Looking for WSAStartup - found
Looking for UuidCreateSequential
Looking for UuidCreateSequential - found
Looking for GetAdaptersAddresses
Looking for GetAdaptersAddresses - found
Looking for fopen in ws2
Looking for fopen in ws2 - not found
Performing Test HAVE_FLAG_/W3
Performing Test HAVE_FLAG_/W3 - Success
Checking whether noexcept is supported
Performing Test ZMQ_HAVE_NOEXCEPT
Performing Test ZMQ_HAVE_NOEXCEPT - Success
Could NOT find AsciiDoc (missing: ASCIIDOC_EXECUTABLE)
**CMake Warning (dev) at tests/CMakeLists.txt:306 (message):
Test 'test_bind_stream_fuzzer' is not known to CTest.
This warning is for project developers. Use -Wno-dev to suppress it.
CMake Warning (dev) at tests/CMakeLists.txt:306 (message):
Test 'test_bind_ws_fuzzer' is not known to CTest.
This warning is for project developers. Use -Wno-dev to suppress it.
CMake Warning (dev) at tests/CMakeLists.txt:306 (message):
Test 'test_connect_stream_fuzzer' is not known to CTest.
This warning is for project developers. Use -Wno-dev to suppress it.
CMake Warning (dev) at tests/CMakeLists.txt:306 (message):
Test 'test_connect_ws_fuzzer' is not known to CTest.
This warning is for project developers. Use -Wno-dev to suppress it.
CMake Warning (dev) at tests/CMakeLists.txt:306 (message):
Test 'test_socket_options_fuzzer' is not known to CTest.
This warning is for project developers. Use -Wno-dev to suppress it.**
Configuring done
After generating the Build folder I opened the resulting ZeroMQ.sln in Visual Studio 2017 (with admin rights) and performed the following steps:
In the solution explorer (including ALL_BUILD, ZERO_CHECK, libzmq ...) I set the folder "libzmq" as startup project
Start the "Local Windows Debugger"
Here is the output from Visual Studio (I replaced the actual path to the ZeroMQ folder with "MY_PATH"):
1>------ Build started: Project: ZERO_CHECK, Configuration: Debug Win32 ------
1>Checking Build System
2>------ Build started: Project: libzmq, Configuration: Debug Win32 ------
2>Generating NSIS.template.in
2>Building Custom Rule C:/Users/MY_PATH/ZeroMQ/libzmq/CMakeLists.txt
2>precompiled.cpp
2>sha1.c
2>tweetnacl.c
2>wepoll.c
2>address.cpp
2>channel.cpp
2>client.cpp
2>clock.cpp
2>ctx.cpp
2>curve_mechanism_base.cpp
2>curve_client.cpp
2>curve_server.cpp
2>dealer.cpp
2>devpoll.cpp
2>dgram.cpp
2>dist.cpp
2>endpoint.cpp
2>epoll.cpp
2>err.cpp
2>fq.cpp
2>io_object.cpp
2>io_thread.cpp
2>ip.cpp
2>ipc_address.cpp
2>ipc_connecter.cpp
2>ipc_listener.cpp
2>kqueue.cpp
2>lb.cpp
2>mailbox.cpp
2>mailbox_safe.cpp
2>mechanism.cpp
2>mechanism_base.cpp
2>metadata.cpp
2>msg.cpp
2>mtrie.cpp
2>norm_engine.cpp
2>object.cpp
2>options.cpp
2>own.cpp
2>null_mechanism.cpp
2>pair.cpp
2>peer.cpp
2>pgm_receiver.cpp
2>pgm_sender.cpp
2>pgm_socket.cpp
2>pipe.cpp
2>plain_client.cpp
2>plain_server.cpp
2>poll.cpp
2>poller_base.cpp
2>polling_util.cpp
2>pollset.cpp
2>proxy.cpp
2>pub.cpp
2>pull.cpp
2>push.cpp
2>random.cpp
2>raw_encoder.cpp
2>raw_decoder.cpp
2>raw_engine.cpp
2>reaper.cpp
2>rep.cpp
2>req.cpp
2>router.cpp
2>select.cpp
2>server.cpp
2>session_base.cpp
2>signaler.cpp
2>socket_base.cpp
2>socks.cpp
2>socks_connecter.cpp
2>stream.cpp
2>stream_engine_base.cpp
2>sub.cpp
2>tcp.cpp
2>tcp_address.cpp
2>tcp_connecter.cpp
2>tcp_listener.cpp
2>thread.cpp
2>trie.cpp
2>radix_tree.cpp
2>v1_decoder.cpp
2>v1_encoder.cpp
2>v2_decoder.cpp
2>v2_encoder.cpp
2>v3_1_encoder.cpp
2>xpub.cpp
2>xsub.cpp
2>zmq.cpp
2>zmq_utils.cpp
2>decoder_allocators.cpp
2>socket_poller.cpp
2>timers.cpp
2>radio.cpp
2>dish.cpp
2>udp_engine.cpp
2>udp_address.cpp
2>scatter.cpp
2>gather.cpp
2>ip_resolver.cpp
2>zap_client.cpp
2>zmtp_engine.cpp
2>stream_connecter_base.cpp
2>stream_listener_base.cpp
2> Creating library C:/Users/MY_PATH/ZeroMQ/libzmq/Build/lib/Debug/libzmq-v141-mt-gd-4_3_4.lib and object C:/Users/MY_PATH/ZeroMQ/libzmq/Build/lib/Debug/libzmq-v141-mt-gd-4_3_4.exp
2>libzmq.vcxproj -> C:\Users\MY_PATH\ZeroMQ\libzmq\Build\bin\Debug\libzmq-v141-mt-gd-4_3_4.dll
========== Build: 2 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========
At the end I received the following error from Visual Studio:
Error message from Visual Studio
It says:
Unable to start program
'C:\Users\MY_PATH\ZeroMQ\libzmq\Build\lib\Debug\libzmq-v141-mt-gd-4_3_4.dll'.
C:\Users\MY_PATH\ZeroMQ\libzmq\Build\lib\Debug\libzmq-v141-mt-gd-4_3_4.dll is not a valid Win32 application
This leads me to the assumption that the attempt to correctly build the ZeroMQ library failed.
The last thing I tried was a suggestion from a comment in Build zeromq on Windows 10 with CMake:
"VS2015 Toolbar -> Open -> CMake -> ZMQ folder
Toolbar -> CMake -> Cache -> Generate -> ZeroMQ
Toolbar -> CMake -> Install -> ZeroMQ
You can find builds in /Users/UserName/CMakeBuilds/..."
When I tried this I received some warnings and an error that you can find here, from which I don't know what to do with it. Basically it refers to lines 275 and 306 of CMakeLists.txtand says that libsodium is not installed and the error says:
Cannot open compiler intermediate file 'c\users\MY_USER\cmakebuilds\6d974590-78c5-853d-bf52-b3f968050d60\build\x64-Debug (default)\precompiled.pch': Permission denied
multiple rules generate precompiled.hpp. builds involving this target will not be correct; continuing anyway [-w dupbuild=warn]
Following the steps from the accepted answer in this post
Getting ZeroMQ up and running on Windows 10
also results in errors and no build folder is added to the user's CMakeBuilds subfolder.

Related

Cannot install Theano libgpuarray on Windows 10

This question is for Python2.7 with Keras as a front end. I have Microsoft Visual Studio 2017 and I believe I have all the tools it needs. I followed the instructions on install CUDA. I believe it is version 10, and I think it is installed correctly. I followed the tutorial video and got a similar result at the end for the sample test. I have now moved on to installing libgpuarray. I have completed the following steps and got this error:
C:\Windows\system32>cd C:\Users\Never\Downloads\libgpuarray
C:\Users\Never\Downloads\libgpuarray>cd Build
C:\Users\Never\Downloads\libgpuarray\Build>cmake .. -DCMAKE_BUILD_TYPE=Release
-- Building for: Visual Studio 15 2017
-- The C compiler identification is MSVC 19.16.27034.0
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.16.27023/bin/Hostx86/x86/cl.exe
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.16.27023/bin/Hostx86/x86/cl.exe -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
CMake Deprecation Warning at CMakeLists.txt:26 (cmake_policy):
The OLD behavior for policy CMP0063 will be removed from a future version
of CMake.
The cmake-policies(7) manual explains that the OLD behaviors of all
policies are deprecated and that a policy should be set to OLD only under
specific short-term circumstances. Projects should be ported to the NEW
behavior and not rely on setting a policy to OLD.
-- Looking for strlcat
-- Looking for strlcat - not found
-- Looking for mkstemp
-- Looking for mkstemp - not found
-- Found PkgConfig: C:/MinGW_w64/bin/pkg-config.exe (found version "0.25")
-- Checking for one of the modules 'check'
Tests disabled because Check was not found
-- Configuring done
-- Generating done
CMake Warning:
Manually-specified variables were not used by the project:
CMAKE_BUILD_TYPE
-- Build files have been written to: C:/Users/Never/Downloads/libgpuarray/Build
I tried running C:\Users\Never\Downloads\libgpuarray\Build>make next but it returned:
'make' is not recognized as an internal or external command,operable program or batch file.
There is a make script in the folder above so I tried using it, with this result:
C:\Users\Never\Downloads\libgpuarray\Build>C:\Users\Never\Downloads\libgpuarray\make.bat
C:\Users\Never\Downloads\libgpuarray\Build>REM This helps repetitive builds on windows
C:\Users\Never\Downloads\libgpuarray\Build>REM It needs the compiler you want to use to be available in the shell
C:\Users\Never\Downloads\libgpuarray\Build>REM and it will build a release version
C:\Users\Never\Downloads\libgpuarray\Build>del bld
Could Not Find C:\Users\Never\Downloads\libgpuarray\Build\bld
C:\Users\Never\Downloads\libgpuarray\Build>mkdir bld
C:\Users\Never\Downloads\libgpuarray\Build>cd bld
C:\Users\Never\Downloads\libgpuarray\Build\bld>cmake .. -G "NMake Makefiles" -DCMAKE_BUILD_TYPE=Release
CMake Error: Error: generator : NMake Makefiles
Does not match the generator used previously: Visual Studio 15 2017
Either remove the CMakeCache.txt file and CMakeFiles directory or choose a different binary directory.
C:\Users\Never\Downloads\libgpuarray\Build\bld>cmake --build . --config Release
Error: could not load cache
C:\Users\Never\Downloads\libgpuarray\Build\bld>cd ..
I am not 100% sure what to do next. I don't want to tinker and break things further, any assistance would be appreciated, thank you.
It looks like you are following the Linux instructions in the tutorial you linked. You should probably take a look at the Windows-specific instructions, considering you are building on Windows with Visual Studio.
It sounds like you may have corrupted your CMake cache a bit by running the make.bat file, so it's probably best to delete your Build folder and start over:
C:\Users\Never\Downloads\libgpuarray>mkdir Build && cd Build
C:\Users\Never\Downloads\libgpuarray\Build>cmake ..
From there, just follow the Windows-specific guidelines from the tutorial:
It will generate a Visual Studio solution file for the version installed. To build the project open this file (.sln) and run the “Build All” command after selecting the appropriate build type.

CMake generation problem with Visual Studio 2017

Using cmake from command line, I got:
"== Building Windows-Release =="
-- Building for: Visual Studio 15 2017
-- The C compiler identification is unknown
-- The CXX compiler identification is unknown
CMake Error at CMakeLists.txt:2 (project):
No CMAKE_C_COMPILER could be found.
CMake Error at CMakeLists.txt:2 (project):
No CMAKE_CXX_COMPILER could be found.
Where CMakeError.log contain:
Compiling the C compiler identification source file "CMakeCCompilerId.c" failed.
Compiler:
Build flags:
Id flags:
The output was:
1
Microsoft (R) Build Engine version 15.9.21+g9802d43bc3 for .NET Framework
Copyright (C) Microsoft Corporation. All rights reserved.
Build started 31/12/2018 12:54:05.
Project "C:\myproj\CMakeFiles\3.13.1\CompilerIdC\CompilerIdC.vcxproj" on node 1 (default targets).
PrepareForBuild:
Creating directory "Debug\".
Creating directory "Debug\CompilerIdC.tlog\".
InitializeBuildStatus:
Creating "Debug\CompilerIdC.tlog\unsuccessfulbuild" because "AlwaysCreate" was specified.
ClCompile:
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\CL.exe /c /nologo /W0 /WX- /Od /Oy- /D _MBCS /Gm- /EHsc /RTC1 /MDd /GS /fp:precise /Zc:wchar_t /Zc:forScope /Zc:inline /Fo"Debug\\" /Fd"Debug\vc140.pdb" /Gd /TC /analyze- /errorReport:queue CMakeCCompilerId.c
CMakeCCompilerId.c
c1 : fatal error C1083: Cannot open source file: 'CMakeCCompilerId.c': No such file or directory [C:\myproj\CMakeFiles\3.13.1\CompilerIdC\CompilerIdC.vcxproj]
Done Building Project "C:\myproj\CMakeFiles\3.13.1\CompilerIdC\CompilerIdC.vcxproj" (default targets) -- FAILED.
Build FAILED.
"C:\myproj\CMakeFiles\3.13.1\CompilerIdC\CompilerIdC.vcxproj" (default target) (1) ->
(ClCompile target) ->
c1 : fatal error C1083: Cannot open source file: 'CMakeCCompilerId.c': No such file or directory [C:\myproj\CMakeFiles\3.13.1\CompilerIdC\CompilerIdC.vcxproj]
0 Warning(s)
1 Error(s)
Time Elapsed 00:00:00.43
...
I tried repairing the installation of Visual Studio, and renstalling CMake, but nothing seems to work it. Also looked at similar thread here, but nothing was helpful.
I met the exact same question with you. After a very very long struggle, I finally find the solution for me. I am not sure whether that is the same problem you met, but I still want to write and recode this strange problem.
Firstly, I also reinstall cmake, repair the VS and add many components in it and fixed(brake) many PATH environments, but all of them don't work, and I bet the problem is not because of these problems.
As the two messages:
The C compiler identification is unknown
The CXX compiler identification is unknown
They do not exactly mean the cmake don't detect the VS compiler, it just means that the cmake's use it to build its demo but fail. And from the errorlog, I even can believe your VS has already installed success and work well. The only problem is that the compiler can't open the 'CMakeCCompilerId.c' file.
I don't know whether have your check the .c file is exactly in the project location, but it is in there very well in my computer (otherwise, it means that the cmake failed to create this file, and maybe you need to open it as an administration)
I am very confused about why the compiler can't read that and try to directly open the .vcxproj file in VS and change many settings but still get the same error, like below.
After some try, I move the project to the desktop and reopen it, then it builds success! So as the whole cmake project. I am also be shocked by that.
After some compare and research, I found error reason in me, I am using the git in windows-wsl to clone the project to my windows file system(it has a little risk to break the file permission in wsl), it works well in normal, but as a cmake cross-compilation, I guess it may use some linux-like way to operate files and therefore meet some file permission problem.
So, the final solution to me is using the git in cmd or download the whole project in the browser instead of using the git in wsl. (Truly a little funny-. and may differ with your situation)
Hope these can help you.
The reason for my problem turned out to be that case sensitivity was turned on in the current directory.
Turn off case sensitivity or switch to another directory.

Conan CMake and Embarcadero integration

I am trying to make Conan with CMake run with Embarcadero Tokyo 10.2.3 compiler. I can do CMake with Embarcadero following it's tutorial. But issue seems to happen with Conan. So I do the conan install. Then I do cmake .. -DCMAKE_CXX_COMPILER="bcc32c.exe" -DCMAKE_C_COMPILER="bcc32c.exe" -DCMAKE_VERBOSE_MAKEFILE=1 -G Ninja. I get the error
Incorrect 'Visual Studio'. Toolset specifies compiler as 'MSVC' but CMake
detected 'Embarcadero'
The default conan profile shows compiler=Visual Studio which I believe is where the issue originates from. But dont know how to change it to Embarcadero (does not recognize) or if changing the default profile is the way to go. My CMakeLists.txt file looks like this (mostly default)
project(Timer)
cmake_minimum_required(VERSION 3.11)
include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
conan_basic_setup()
add_executable(timer timer.cpp)
target_link_libraries(timer ${CONAN_LIBS})
The full cmake output is below:
-- The C compiler identification is Embarcadero 7.30.36015
-- The CXX compiler identification is Embarcadero 7.30.36015
-- Check for working C compiler: C:/Program Files (x86)/Embarcadero/Studio/19.0/bin/bcc32c.exe
-- Check for working C compiler: C:/Program Files (x86)/Embarcadero/Studio/19.0/bin/bcc32c.exe -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: C:/Program Files (x86)/Embarcadero/Studio/19.0/bin/bcc32c.exe
-- Check for working CXX compiler: C:/Program Files (x86)/Embarcadero/Studio/19.0/bin/bcc32c.exe -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Current conanbuildinfo.cmake directory: C:/Mathew Joy/Source/mytimer/build
CMake Error at build/conanbuildinfo.cmake:579 (message):
**Incorrect 'Visual Studio'. Toolset specifies compiler as 'MSVC' but CMake
detected 'Embarcadero'**
Call Stack (most recent call first):
build/conanbuildinfo.cmake:237 (conan_check_compiler)
CMakeLists.txt:5 (conan_basic_setup)
You need to customize the default settings.yml file which can be found in <userhome>/.conan/settings.yml
This file has defined some of the most popular compilers, you might add something like:
compiler:
sun-cc:
...
gcc:
version: ["4.1", "4.4", "4.5", "4.6", "4.7", "4.8", "4.9",
Visual Studio:
runtime: [MD, MT, MTd, MDd]
version: ["8", "9", "10", "11", "12", "14", "15"]
...
Embarcadero:
version: ["V1", "V2"...]
This file can be shared and synchronized with the team and used in CI machines with the conan config install command.
Then you can add the values for convenience to your default profile, instead of the Visual Studio values.
It is likely that most of the logic that the built-in build helpers, like CMake are providing, would be limited for this compiler, as it doesn't recognize it. You can run your logic to call the build system directly if that is the case:
def build(self):
self.run("cmake . -G ....")
self.run("cmake --build . --config Release")
If you want to correctly build and create packages for different configurations, then you should parameterize the above using the settings and options, as necessary.
All of this assume that you will be creating and depending on your own packages, as the existing packages in the public conan-center repository will be for the popular compilers, so the binaries will be incompatible, and the recipes most likely won't implement building from sources with Embarcadero.
Visual Studio 2019 C++ is much better than Embarcadero. I have used both Tokyo and the Rio version, and there is no comparison. In addition you can download the Managed C++, which is called C++ CLR (not CLI), which will allow you to integrate .NET forms/consoles with native C++ applications.
Visual Studio 2019 C++ works well when creating Xamarin IOS libraries, which can easily be integrated with C# for Xamarin Forms. Xamarin Forms works for both Android and IOS (Xamarin).
In July 2019, Embarcadero finally added 64 bit Mac OS operating system, and MAC has been 64 bit since 2008.
That should tell you something right there.

CMake Error : execution of make failed on Windows

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 :
How CMake fills the Cache variables ?
Why CMAKE_MAKE_PROGRAM takes the value nmake ?
Why changing manually this variable didn t solve the problem ?
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

How to build a DCMTK project file with CMake?

I am trying to build a DCMTK project file using the CMake gui, so I can use it in Qt. Unfortunately, I still get a few errors. I've read many related topics (e.g. How to use Dcmtk in Qt?), but I cannot find a solution to solve my errors:
Output CMakeError.log:
Compiling the CXX compiler identification source file "CMakeCXXCompilerId.cpp" failed.
Compiler:
Build flags:
Id flags:
The output was:
The system cannot find the file specified
Output CMakeOutput.log:
The system is: Windows - 6.1.7601 - AMD64
It turned out to be a probem in the rc version of CMake. I installed the stable version like you told me and the problem disappeared. Thank you!