I need the freshest CMake installed on my OpenSuse in order to use an app. I'm trying to download it from the official site and follow the instructions: https://cmake.org/install/
However, I get the following errors:
aleksandr#linux-b0ak:~/Downloads/cmake-3.17.0-rc1> cmake .
-- The CXX compiler identification is unknown
CMake Error at CMakeLists.txt:7 (project):
No CMAKE_CXX_COMPILER could be found.
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 "/home/aleksandr/Downloads/cmake-3.17.0-rc1/CMakeFiles/CMakeOutput.log".
See also "/home/aleksandr/Downloads/cmake-3.17.0-rc1/CMakeFiles/CMakeError.log".
aleksandr#linux-b0ak:~/Downloads/cmake-3.17.0-rc1> ./bootstrap
---------------------------------------------
CMake 3.17.0-rc1, Copyright 2000-2020 Kitware, Inc. and Contributors
C compiler on this system is: cc
---------------------------------------------
Error when bootstrapping CMake:
Cannot find a C++ compiler that supports both C++11 and the specified C++ flags.
Please specify one using environment variable CXX.
The C++ flags are "".
They can be changed using the environment variable CXXFLAGS.
See cmake_bootstrap.log for compilers attempted.
---------------------------------------------
Log of errors: /home/aleksandr/Downloads/cmake-3.17.0-rc1/Bootstrap.cmk/cmake_bootstrap.log
Related
I am trying to install cilk++ according to this website and am at the steps in section "Cilk Plus Runtime". When I go to build, I get the following output:
$ cmake -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_INSTALL_PREFIX=./install ..
CMake Error at CMakeLists.txt:132 (message):
CXX compiler must support Cilk.
-- Configuring incomplete, errors occurred!
See also "/Users/anthonymcknight/Documents/cubing/bfs/lab4/cilk/cilkrts-0.1.2/build/CMakeFiles/CMakeOutput.log".
See also "/Users/anthonymcknight/Documents/cubing/bfs/lab4/cilk/cilkrts-0.1.2/build/CMakeFiles/CMakeError.log".
I thought clang and clang++ (which I checked with --version are indeed installed) would be sufficient. Do I need to update clang and clang++? There are no troubleshooting steps on the instructions website, so I'm not sure what I need to do to finally get cilk++ up and running on my laptop.
Thanks in advance,
Anthony
Expanding on my comment:
When you configure this Cilk Plus Runtime with CMake, CMake first verifies the compiler by attempting to compile a simple test program (see here). If the compilation fails, CMake prints the error you see:
CMake Error at CMakeLists.txt:132 (message):
CXX compiler must support Cilk.
On the Intel Cilk Plus runtime Github page (cilkrts), it has some compiler requirements listed for those trying to build this library:
You need the CMake tool and a C/C++ compiler that supports the Cilk language extensions. The requirements for each operating systems are:
Common: CMake 3.4.3 or later Make tools such as make
Linux: Tapir/LLVM compiler, or GCC* 4.9.2 or later (depracated), or Cilk-enabled branch of Clang*/LLVM* (http://cilkplus.github.io), or Intel(R) C++ Compiler v12.1 or later (depracated)
OS X: Tapir/LLVM compiler, or Cilk-enabled branch of Clang*/LLVM* (http://cilkplus.github.io), or Intel C++ Compiler v12.1 or later (depracated)
Since you are using Clang as your compiler, be sure it is a Cilk-enabled branch of Clang, as specified in the requirements. Or, you can try to use the Tapir/LLVM compiler.
I'm trying to build the Checked-C project which uses CMake, but when I go to generate the makefile CMake gives the following error.
~/checkedc/build$ cmake ../llvm
CMake Error at CMakeLists.txt:57 (project):
Generator
Unix Makefiles
does not support toolset specification, but toolset
host=x64
was specified.
-- Configuring incomplete, errors occurred!
I have CMake version 3.9.1 installed along with GNU Make 4.1, Clang 5, and GCC 7. Anyone able to tell me what this CMake error means?
That section of CMakeLists.txt looks like this:
57 project(LLVM
58 ${cmake_3_0_PROJ_VERSION}
59 ${cmake_3_0_LANGUAGES}
60 C CXX ASM)
I've tried setting C/CXX/ASM but get the same error:
~/checkedc/build$ cmake -DCMAKE_C_COMPILER="clang-5.0" -DCMAKE_CXX_COMPILER="clang-5.0" -DCMAKE_ASM_COMPILER="clang-5.0" ../llvm
CMake Error at CMakeLists.txt:57 (project):
Generator
Unix Makefiles
does not support toolset specification, but toolset
host=x64
was specified.
-- Configuring incomplete, errors occurred!
I'm on Kubuntu 17.10 64bit.
It means that somewhere CMake file the variable CMAKE_GENERATOR_TOOLSET is set to host=x64. This only makes sense for Visual Studio generator so CMake opts to throw an error in this case.
To fix it double check the setup for your OS and generator. If this doesn't help then you'll need to find where this variable is set and remove this line.
I have the same issue - how I fixed it in my case. Indeed, I had copied the setup for cmake from windows then ported to Linux. When you run the first time, it will create in the build directory a file called: CMakeCache.txt. This file keeps some variables set initially for Windows. I removed it, together with all the CMakeFiles directory and rerun the cmake command to generate the project. It was working perfectly, but I had to set the CMAKE_CXX_COMPILER and CMAKE_C_COMPILER variables to the cmake command: -DCMAKE_CXX_COMPILER=/usr/bin/g++ -DCMAKE_C_COMPILER=/usr/bin/gcc
Hope it is working for you too.
l am trying to build a java example for the td lib following the README(https://github.com/tdlib/td/tree/master/example/java)
I have got following mistackes. Please tell how can I fix it?
C:\Users\irina\td\jnibuild>cmake -DCMAKE_BUILD_TYPE=Debug -DTD_ENABLE_JNI=ON -DCMAKE_INSTALL_PREFIX:PATH=../example/java/td ..
-- Could NOT find ccache
-- Found OpenSSL: C:/OpenSSL-Win32/include optimized;C:/OpenSSL-Win32/lib/VC/ssleay32MD.lib;debug;C:/OpenSSL-Win32/lib/VC/ssleay32MDd.lib;optimized;C:/OpenSSL-Win32/lib/VC/libeay32MD.lib;debug;C:/OpenSSL-Win32/lib/VC/libeay32MDd.lib
-- Could NOT find ZLIB (missing: ZLIB_LIBRARY ZLIB_INCLUDE_DIR)
-- Could NOT find ZLIB (missing: ZLIB_LIBRARY ZLIB_INCLUDE_DIR)
CMake Warning at CMakeLists.txt:256 (message):
Not found zlib: skip TDLib, tdactor, tdnet, tddb
CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
Please set them or make sure they are set and tested correctly in the CMake files:
ZLIB_LIBRARY
linked by target "tdutils" in directory C:/Users/irina/td/tdutils
-- Configuring incomplete, errors occurred!
See also "C:/Users/irina/td/jnibuild/CMakeFiles/CMakeOutput.log".
See also "C:/Users/irina/td/jnibuild/CMakeFiles/CMakeError.log".
ZLIB for Windows is a part of the GnuWin32 project (I'm not sure whether it is allowed to give links on SO). As I see, the CMakeLists.txt uses find_package to lookup the ZLIB library:
if (NOT ZLIB_FOUND)
find_package(ZLIB)
endif()
if (NOT ZLIB_FOUND)
message(WARNING "Not found zlib: skip TDLib, tdactor, tdnet, tddb")
return()
endif()
How the find_package command works is well described in the official documentation:
The command has two modes by which it searches for packages: “Module” mode and
“Config” mode. Module mode is available when the command is invoked with the
above reduced signature. CMake searches for a file called Find<package>.cmake
in the CMAKE_MODULE_PATH followed by the CMake installation. If the file is
found, it is read and processed by CMake. It is responsible for finding the
package, checking the version, and producing any needed messages. Many find-
modules provide limited or no support for versioning; check the module
documentation. If no module is found and the MODULE option is not given the
command proceeds to Config mode.
I've had a look into FindZLIB.cmake on my Windows machine. The module uses the following path: ZLIB_ROOT and the following registry keys:
"[HKEY_LOCAL_MACHINE\SOFTWARE\GnuWin32\Zlib;InstallPath]"
"$ENV{PROGRAMFILES}/zlib
So, as I understand, if you install GnuWin32 using the installer, the HKLM key will be written down into the registry and CMake will be able to find the path to ZLIB. If you wish to use just the zip-archive, the ZLIB_ROOT parameter must be correctly specified when you run CMake:
cmake -DZLIB_ROOT=<PATH-to-your-unpacked-zlib> -D.....
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
Edit: the accepted answer does not solve my problem yet but it answered the question I've asked - if you can help me with my actual problem described below you might answer this question.
I have a CMake-project which makes use of a framework which needs a variable to be set (namely https://github.com/queezythegreat/arduino-cmake, which needs ARDUINO_SDK_PATH)
Strangely after I set that variable on the command line it first has a value but it looks like it disappears after a while.
I'm running
cmake -DARDUINO_SDK_PATH=/path/to/sdk ..
.. and get an error message which tells me that it's not set. Printing out the value at the top of my CMakeLists.txt and deep inside this framework where the variable is being checked gives me something like this:
>>> ARDUINO_SDK_PATH (beginning): '/home/me/project/arduino-1.8.2'
>>> ARDUINO_SDK_PATH (before check): '/home/me/project/arduino-1.8.2'
-- The C compiler identification is GNU 6.2.0
-- The CXX compiler identification is GNU 6.2.0
-- Check for working C compiler: /usr/bin/avr-gcc
>>> ARDUINO_SDK_PATH (before check): ''
CMake Error at /home/me/project/arduino-cmake/cmake/ArduinoToolchain.cmake:84 (message):
Could not find Arduino SDK (set ARDUINO_SDK_PATH)!
Call Stack (most recent call first):
/home/me/project/build/CMakeFiles/3.6.2/CMakeSystem.cmake:6 (include)
/home/me/project/build/CMakeFiles/CMakeTmp/CMakeLists.txt:3 (project)
CMake Error: Internal CMake error, TryCompile configure of cmake failed
-- Configuring incomplete, errors occurred!
See also "/home/me/project/build/CMakeFiles/CMakeOutput.log".
So it looks like ARDUINO_SDK_PATH looses it's value somehow. I didn't find an actual command where it get's assigned any value so I don't know how to proceed.. I can now of course add code to my CMake project everywhere to print out the value of ARDUINO_SDK_PATH but I wonder if there's a builtin way to trace variable values.
I tried cmake --trace .. and cmake --trace-expand .. but the output doesn't seem helpful..
System: Fedora 25 with CMake 3.6.2
Update
Thanks to Florian I've added variable_watch(ARDUINO_SDK_PATH) as my first line in CMakeLists.txt and now my variable trace lines (message()) look like this:
CMake Debug Log at arduino-cmake/cmake/ArduinoToolchain.cmake:41 (MESSAGE):
Variable "ARDUINO_SDK_PATH" was accessed using READ_ACCESS with value
"/home/me/project/arduino-1.8.2".
Call Stack (most recent call first):
/usr/share/cmake/Modules/CMakeDetermineSystem.cmake:98 (include)
CMakeLists.txt:10 (project)
>>> ARDUINO_SDK_PATH (before check): /home/me/project/arduino-1.8.2
I have about 30 messages like this but there follow a couple of trace lines without the value and without the trace message.
So it looks like the variable ARDUINO_SDK_PATH gets replaced by a new one which is empty and which is not traced any more..
Reproduce
In order to make this behavior reproducible I've uploaded the code: https://github.com/frans-fuerst/trinket_led
Note: the provided CMakeLists.txt does not contain useful code yet - it just reproduces the error.
You need to download the Arduino-SDK, extract it and provide the path on the command line:
tar xvf ~/Downloads/arduino-1.8.2-linux64.tar.xz
git clone https://github.com/frans-fuerst/trinket_led
cd trinket_led
git submodules update --init
mkdir build
cd build
cmake -DARDUINO_SDK_PATH=/path/to/arduino-1.8.2 ..
Note: there is a find_path command in ArduinoToolchain.cmake which looks suspicious. But you can remove it with the same result..
CMakeFiles/CMakeOutput.log
The target system is: Arduino - -
The host system is: Linux - 4.10.12-200.fc25.x86_64+debug - x86_64
Compiling the C compiler identification source file "CMakeCCompilerId.c" succeeded.
Compiler: /usr/bin/avr-gcc
Build flags:
Id flags:
The output was:
0
Compilation of the C compiler identification source "CMakeCCompilerId.c" produced "a.out"
The C compiler identification is GNU, found in "/home/frans/_HOME/1704_trinket_led/build/CMakeFiles/3.6.2/CompilerIdC/a.out"
Compiling the CXX compiler identification source file "CMakeCXXCompilerId.cpp" succeeded.
Compiler: /usr/bin/avr-g++
Build flags:
Id flags:
The output was:
0
Compilation of the CXX compiler identification source "CMakeCXXCompilerId.cpp" produced "a.out"
The CXX compiler identification is GNU, found in "/home/frans/_HOME/1704_trinket_led/build/CMakeFiles/3.6.2/CompilerIdCXX/a.out"
Just put a variable_watch(ARDUINO_SDK_PATH) at the top of your CMakeLists.txt.
References
variable_watch()
What's the CMake syntax to set and use variables?