Building QGIS - set path to Bison and flex? - c++11

I'm trying to follow (probably very good) step by step instructions for building QGIS in a Windows environment hence I've got some difficulties to understand where I shall set the paths for Bison and flex in CMAKE and where do I find the option BINDINGS_GLOBAL_INSTALL?
I've uploaded a print screen from my CMAKE Error message
The C compiler identification is unknown
The CXX compiler identification is unknown
CMake Error at CMakeLists.txt:10 (PROJECT):
No CMAKE_C_COMPILER could be found.
CMake Error at CMakeLists.txt:10 (PROJECT):
No CMAKE_CXX_COMPILER could be found.

Problem solved by changing the visual studio version in the configuration.
Hence, a new problem occurred with MSBuild.exe to get the value of VCTargetsPath:. I will ask in that in another question.

Related

MSYS2 (64 bit): The C compiler identification is unknown

I'm new to building in Windows. I'm building the following project: https://github.com/arkottke/strata.
The page suggests installing dependencies using MSYS2. I've installed MSYS2 and installed everything as instructed exactly, but I get the following when trying to build using cmake:
$ cmake .. -DCMAKE_BUILD_TYPE=Release
-- The C compiler identification is unknown
-- The CXX compiler identification is unknown
CMake Error at CMakeLists.txt:31 (project):
No CMAKE_C_COMPILER could be found.
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:31 (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/isb17182/strata/build/CMakeFiles/CMakeOutput.log".
See also "/home/isb17182/strata/build/CMakeFiles/CMakeError.log".
I've seen answers for the same problem on other building platforms, but these are too complicated for me to understand currently. If someone could provide a simple explanation of how to resolve this it would be much appreciated.
Thanks
This is what worked for me
Thanks to everyone who contributed.
Run
pacman -S base-devel gcc
Which will update GCC to latest and verify by
gcc --version
Be sure you're using the cmake of msys2 (as the project build instructions suggest you should install), not a regular Windows cmake installed elsewhere on the system.
which cmake
After this ere execute your command...build done ;)

CMake Compiler Identification Error

I'm having the following problem when trying to build a project using CMake:
-- The C compiler identification is unknown
-- The CXX compiler identification is unknown
CMake Error at CMakeLists.txt:2 (project):
I'm executing the following command: cmake . inside the CMake project folder.
The error also states that I shoulkd try to set the CMAKE_C_COMPILER and CMAKE_CXX_COMPILER enviroment variables to the compiler paths. And so did I.
I've set the variables to the following paths, respectively: C:\MinGW\bin\gcc.exe and C:\MinGW\bin\g++.exe.
The error kept happening.
My CMakeLists looks like this:
cmake_minimum_required(VERSION 2.8.9)
project (hello)
add_executable(hello helloworld.cpp)
I have no CMake knowledge at all so consider that it is possible that I've forgotten some basic stuff.
What am I missing?
I found out what I was doing wrong.
I was not choosing the correct generator, and the following fixed it:
cmake -G "MinGW Makefiles" ..
After selecting MinGW generator, everything worked just fine.

Cmake Error During Installation of dlib on Windows?

I am trying to install dlib-19.2 in Window 7.But during the building process of dlib I get these errors.
Configuring cmake ...
-- Building for: NMake Makefiles
-- The C compiler identification is unknown
-- The CXX compiler identification is unknown
CMake Error in CMakeLists.txt:
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 in CMakeLists.txt:
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:/dlib-19.2/tools/python/build/CMakeFiles/CMakeOutput.log".
See also "C:/dlib-19.2/tools/python/build/CMakeFiles/CMakeError.log".
error: cmake configuration failed!
Can anyone explain me the reason of the error and how to avoid it.Cmake GUI seems to work perfectly fine.
Had the same problem, installing Visual C++ 2015 Build Tools solved it for me:
http://landinghub.visualstudio.com/visual-cpp-build-tools

Qt Creator using MinGW compiler with CMake

I'm trying to use Qt Creator for C++ CMake project which doesn't use the Qt libraries.
I'm following the official guide, but it does not work at all. Here are my steps:
Add my MinGW bin directory to PATH.
Run QtCreator and setup CMake.
Open a a very basic CMakeLists.txt file.
Select "Ninja (Desktop)" as CMake generator.
Getting errors from CMake.
You may have noticed that step 4 is actually not mentioned at all in the official guide. I'm quite used to CMake and as such I'm asking myself:
Why doesn't the Qt Creator offer the normal "MinGW Makefiles" generator?
And finally the ultimate question:
How can I make the Qt Creator use a MinGW compiler through CMake?
Answered questions:
According to the official guide and as usual when you set PATH correctly, step 5 should not happen.
Why doesn't CMake find the compiler set in PATH?
It's the Ninja Generator that creates these errors, the same thing happens if you do it manually with CMake.
CMake Error: Error required internal CMake variable not set, cmake may be not be built correctly.
Missing variable is:
CMAKE_CXX_COMPILER_ENV_VAR
CMake Error: Error required internal CMake variable not set, cmake may be not be built correctly.
Missing variable is:
CMAKE_CXX_COMPILER
CMake Error: Could not find cmake module file: D:/Programming/C++/Test/SupportQt/build/CMakeFiles/3.0.2/CMakeCXXCompiler.cmake
CMake Error at CMakeLists.txt:1 (project):
No CMAKE_C_COMPILER could be found.
Tell CMake where to find the compiler by setting 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:1 (project):
No CMAKE_CXX_COMPILER could be found.
Tell CMake where to find the compiler by setting 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.
CMake Error: Error required internal CMake variable not set, cmake may be not be built correctly.
Missing variable is:
CMAKE_C_COMPILER_ENV_VAR
CMake Error: Error required internal CMake variable not set, cmake may be not be built correctly.
Missing variable is:
CMAKE_C_COMPILER
CMake Error: Could not find cmake module file: D:/Programming/C++/Test/SupportQt/build/CMakeFiles/3.0.2/CMakeCCompiler.cmake
CMake Error: CMake was unable to find a build program corresponding to "Ninja". CMAKE_MAKE_PROGRAM is not set. You probably need to select a different build tool.-- Configuring incomplete, errors occurred!
Looking at the configuration menu to see whether I have forgotten to setup something, I stumbled across the compiler setup page. I then of course added my compiler there as well, but it did nothing.
Why doesn't CMake use the compiler list when using CMake?
It does use the compiler list, IF you pick the right compiler in the kits selection.
As usually if you ask for help only to shortly after figure it out, I feel quite stupid now...
Why doesn't the Qt Creator use the compiler list when using CMake?
It does, but only if you set the Kit to use the right compiler!
Why doesn't CMake find the compiler set in PATH?
This is actually the problem of the Ninja Generator with CMake. The same thing happens if you use CMake directly.
Why doesn't the Qt Creator offer the normal "MinGW Makefiles" generator?
It does, but only if you picked a MinGW compiler in your Kit!
How can I make the Qt Creator use a MinGW compiler through CMake?
By setting everything up correctly and not relying too heavily on the official guide.

Boost installation on windows, libraries missing

I am trying to build boost. I followed the instructions here. I create a folder C:\Boost which contains include and libs and I add it to my enviroment path. However, when I tried to build another project with cMake I am getting:
CMake Error at C:/Program Files/CMake 2.8/share/cmake-2.8/Modules/FindBoost.cmake:1106 (message):
Unable to find the requested Boost libraries.
Boost version: 1.55.0
Boost include path: C:/Boost/include/boost-1_55
The following Boost libraries could not be found:
boost_system
boost_filesystem
boost_signals
No Boost libraries were found. You may need to set BOOST_LIBRARYDIR to the
directory containing Boost libraries or BOOST_ROOT to the location of
Boost.
Call Stack (most recent call first):
CMakeLists.txt:88 (find_package)
Any idea about those missing libs?
It's a bad thing to start an answer with a question, but I do it nevertheless:
First, am I right in assuming that you've set an environment variable BOOST_ROOT pointing to C:\Boost? (Simply adding it to the path might not be sufficient here.)
Second, which CMake generator are you running? Visual Studio, Makefile, ninja?
I've head a similar problem recently that was connected to the generator that I was actually using. More precisely, I was trying to create a Ninja project from within cmake-gui and got almost the same error message. However, I was able to create a Visual Studio project in cmake-gui project without problem.
When looking a little closer at the command output for the Ninja case I found the following two lines at the very beginning:
The C compiler identification is unknown
The CXX compiler identification is unknown
This hints at the actual problem. While it is clear which compiler will be in use for Visual Studio (9, 10, 11, ...), cmake cannot infer a default compiler for Ninja because it is a generic build system that runs with different compilers. In the end boost wasn't found because the compiler is unknown.
A simple solution was to open the Developer Command Prompt for the Visual Studio version that you want to run with. When you create the project in this "extended" command prompt CMake will be able to infer the correct compiler. Alternatively, you can set the CMAKE_CXX_COMPILER and CMAKE_C_COMPILER flags when running cmake.
cmake -G "Ninja" <path/to/CMakeLists.txt>
cmake -G "Ninja" <path/to/CMakeLists.txt> -DCMAKE_CXX_COMPILER="path/to/cxx/compiler" -CMAKE_C_COMPILER="path/to/c/compiler"

Resources