1

I am trying to install a set of executables on to a computer running Windows 10, and after having downloaded their sources, I need to compile them using cmake. I downloaded the latest version of cmake, and (after setting the proper working directory) have been trying to run the following commands on the Windows Command prompt in order to install the executables:

mkdir build
cd build
cmake ../
make

However, the cmake commands consistently yield the following error, and fail to generate any sort of make file that the make command can utilize:

-- The C compiler identification is unknown
-- The CXX compiler identification is unknown
CMake Error at CMakeLists.txt:2 (project):
  The CMAKE_C_COMPILER:

    cl

  is not a full path and was not found in the PATH.

  To use the NMake generator with Visual C++, cmake must be run from a shell
  that can use the compiler cl from the command line.  This environment is
  unable to invoke the cl compiler.  To fix this problem, run cmake from the
  Visual Studio Command Prompt (vcvarsall.bat).

  Tell CMake where to find the compiler by setting either the environment
  variable "CC" or the CMake cache entry CMAKE_C_COMPILER to the full path to
  the compiler, or to the compiler name if it is in the PATH.


CMake Error at CMakeLists.txt:2 (project):
  The CMAKE_CXX_COMPILER:

    cl

  is not a full path and was not found in the PATH.

  To use the NMake generator with Visual C++, cmake must be run from a shell
  that can use the compiler cl from the command line.  This environment is
  unable to invoke the cl compiler.  To fix this problem, run cmake from the
  Visual Studio Command Prompt (vcvarsall.bat).

  Tell CMake where to find the compiler by setting either the environment
  variable "CXX" or the CMake cache entry CMAKE_CXX_COMPILER to the full path
  to the compiler, or to the compiler name if it is in the PATH.


-- Configuring incomplete, errors occurred!
See also "C:/Users/Hannah/Documents/nupack3.2.0/build/CMakeFiles/CMakeOutput.log".
See also "C:/Users/Hannah/Documents/nupack3.2.0/build/CMakeFiles/CMakeError.log".

I have tried numerous solutions for cmake to work, and none of them have worked. I have tried to add the bin of my cmake folder to my PATH environmental variable, I have tried to reinstall my copy of cmake, and tried to use the CMake GUI in order to generate the make file (Running CMake on Windows), and even downloading Visual Studio (How to set cmake CXX variable on windows), but because I don't have enough experience with using either the CMake GUI or Visual Studio, or because there is something else going wrong, nothing seems to work at all, the cmake ../ yields the exact same error.

Could anybody offer me some alternate solutions for how to make this command work?

Bob McBobson
  • 743
  • 1
  • 9
  • 29
  • ***on the Windows Command prompt*** I would use a Visual Studio command prompt for the version of Visual Studio that you are using. Or at least execute the vcvarsall.bat in the command prompt. With that said you don't use `make` with Visual Studio. – drescherjm Jun 29 '17 at 15:29
  • What generator did you use in CMake? What compiler are you using? – drescherjm Jun 29 '17 at 15:30
  • ***I have tried to add the bin of my cmake folder to my PATH environmental variable*** I have CMake bin in my path on windows. I use CMake daily with Visual Studio on a 1/2 dozen different PCs. – drescherjm Jun 29 '17 at 15:32
  • @drescherjm I am not sure which generator I am using. I assume I am using NMake since that is the default. I also must admit, I don't know which compiler I am using. How can I found out which ones are being used? – Bob McBobson Jun 29 '17 at 15:33
  • What compilers do you have installed? The simplest way to get this working is to delete your build folder. Create it again and use `cmake-gui ../` instead of cmake in the build commands. Then in the GUI select the generator for the version of Visual Studio you have installed. Be careful to select the correct version (match the year). Then configure and generate in CMake-gui. After this click Open Project. And build the ALL_BUILD target from Visual Studio. Do this in the Visual Studio command prompt for whatever version of Visual Studio you have installed. – drescherjm Jun 29 '17 at 15:41
  • I don't have time right now but perhaps later (few hours - I am at work) I will have time to build this in Windows 10 to verify the task is possible. – drescherjm Jun 29 '17 at 15:44
  • Can you post a download link for the package you are trying to build? Is it on github? – drescherjm Jun 29 '17 at 15:45
  • @drescherjm I cannot give you a direct link, but the package is from a site called NUPACK, and I am using version 3.2.0. – Bob McBobson Jun 29 '17 at 15:47
  • @drescherjm If you want to download the package, you must first register on the site itself. – Bob McBobson Jun 29 '17 at 15:47
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/147959/discussion-between-bob-mcbobson-and-drescherjm). – Bob McBobson Jun 29 '17 at 15:51

2 Answers2

3

after having downloaded their binaries, I need to compile them using cmake

That makes no sense. Either you downloaded sources and need to compile them, or you downloaded binaries and nothing else needs to be compiled.

If it turns out you need to compile, you will have to install a compiler (such as Visual Studio). Once VS is installed, CMake should have no trouble finding it (when using a VS generator).

Your error message however seems to indicate use of the NMake generator, which needs to be run from a command prompt correctly configured for building. When you install Visual Studio, you should have shortcuts to development command prompts in your start menu. Launch the correct one for your platform and run CMake from there.

Angew is no longer proud of SO
  • 167,307
  • 17
  • 350
  • 455
  • Sorry about the confusion in terminology, I'm pretty new to these kinds of processes. I meant to say that I have downloaded the sources and need to compile them. I will correct my text now – Bob McBobson Jun 29 '17 at 15:20
  • Also, I have been running NMake generator in the command prompt many times, but it still will not work. I also tried using other generators too (https://stackoverflow.com/questions/4101456/running-cmake-on-windows) but it makes no difference – Bob McBobson Jun 29 '17 at 15:22
1

Please note that I solved the problem by adding this to my PATH environment variable where I have Visual Studio 2019 installed:

C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.20.27508\bin\Hostx64\x64
user8128167
  • 6,929
  • 6
  • 66
  • 79