I have got a problem with CMake 2.8.9. I use the GUI.
I try to make a makefile (ogre 1.8).As I have Windows 7 x64, I use CygWin with gcc.exe and g++.exe and make.exe (located in the bin directory).
When I try to "Configure", CMake logs the following error:
The C compiler identification is unknown
The CXX compiler identification is unknown
Check for working C compiler: G:/cygwin/bin/gcc.exe
Check for working C compiler: G:/cygwin/bin/gcc.exe -- broken
CMake Error at G:/Program Files/CMake 2.8/share/cmake-2.8/Modules/CMakeTestCCompiler.cmake:52 (MESSAGE):
The C compiler "G:/cygwin/bin/gcc.exe" is not able to compile a simple test program.
It fails with the following output:
Change Dir: H:/Ogre/gcc18/CMakeFiles/CMakeTmp
Run Build Command:G:/cygwin/bin/make.exe "cmTryCompileExec2682355191/fast"
/usr/bin/make -f CMakeFiles\cmTryCompileExec2682355191.dir\build.make
CMakeFiles/cmTryCompileExec2682355191.dir/build
D e r B e f e h l " m T r y C o m p i l e E x e c 2 6 8 2 3 5 5 1 9 1 . d i r " i s t e n t w e d e r f a l s c h g e s c h r i e b e n o d e r k o n n t e n i c h t g e f u n d e n w e r d e n .
makeMakefile:116: recipe for target `cmTryCompileExec2682355191/fast' failed
: *** [cmTryCompileExec2682355191/fast] Error 1
CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
CMakeLists.txt:44 (project)
Configuring incomplete, errors occurred!
Whereas D e r B e f e h l " m T r y C o m p i l e.......
means "The command "mTryCompile......" is either spelled wrong or could not be found
$ make -version
GNU Make 3.82.90
Built for i686-pc-cygwin
Copyright (C) 2010 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
gcc-Version 4.5.3 (GCC)
My cache looks like this:
//Path to a program.
CMAKE_AR:FILEPATH=G:/cygwin/bin/ar.exe
//Choose the type of build, options are: None(CMAKE_CXX_FLAGS or
// CMAKE_C_FLAGS used) Debug Release RelWithDebInfo MinSizeRel.
CMAKE_BUILD_TYPE:STRING=
//Enable/Disable color output during build.
CMAKE_COLOR_MAKEFILE:BOOL=ON
//CXX compiler.
CMAKE_CXX_COMPILER:FILEPATH=G:/cygwin/bin/g++.exe
//C compiler.
CMAKE_C_COMPILER:FILEPATH=G:/cygwin/bin/gcc.exe
//Flags used by the compiler during all build types.
CMAKE_C_FLAGS:STRING=
//Flags used by the compiler during debug builds.
CMAKE_C_FLAGS_DEBUG:STRING=
//Flags used by the compiler during release minsize builds.
CMAKE_C_FLAGS_MINSIZEREL:STRING=
//Flags used by the compiler during release builds (/MD /Ob1 /Oi
// /Ot /Oy /Gs will produce slightly less optimized but smaller
// files).
CMAKE_C_FLAGS_RELEASE:STRING=
//Flags used by the compiler during Release with Debug Info builds.
CMAKE_C_FLAGS_RELWITHDEBINFO:STRING=
//Flags used by the linker.
CMAKE_EXE_LINKER_FLAGS:STRING=' '
//Flags used by the linker during debug builds.
CMAKE_EXE_LINKER_FLAGS_DEBUG:STRING=
//Flags used by the linker during release minsize builds.
CMAKE_EXE_LINKER_FLAGS_MINSIZEREL:STRING=
//Flags used by the linker during release builds.
CMAKE_EXE_LINKER_FLAGS_RELEASE:STRING=
//Flags used by the linker during Release with Debug Info builds.
CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO:STRING=
//Install path prefix, prepended onto install directories.
CMAKE_INSTALL_PREFIX:PATH=C:/Program Files (x86)/OGRE
//Path to a program.
CMAKE_LINKER:FILEPATH=G:/cygwin/bin/ld.exe
//Path to a program.
CMAKE_MAKE_PROGRAM:FILEPATH=G:/cygwin/bin/make.exe
//Flags used by the linker during the creation of modules.
CMAKE_MODULE_LINKER_FLAGS:STRING=' '
//Flags used by the linker during debug builds.
CMAKE_MODULE_LINKER_FLAGS_DEBUG:STRING=
//Flags used by the linker during release minsize builds.
CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL:STRING=
//Flags used by the linker during release builds.
CMAKE_MODULE_LINKER_FLAGS_RELEASE:STRING=
//Flags used by the linker during Release with Debug Info builds.
CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO:STRING=
//Path to a program.
CMAKE_NM:FILEPATH=G:/cygwin/bin/nm.exe
//Path to a program.
CMAKE_OBJCOPY:FILEPATH=G:/cygwin/bin/objcopy.exe
//Path to a program.
CMAKE_OBJDUMP:FILEPATH=G:/cygwin/bin/objdump.exe
//Value Computed by CMake
CMAKE_PROJECT_NAME:STATIC=OGRE
//Path to a program.
CMAKE_RANLIB:FILEPATH=G:/cygwin/bin/ranlib.exe
//Path to a program.
CMAKE_SH:FILEPATH=G:/cygwin/bin/sh.exe
//Flags used by the linker during the creation of dll's.
CMAKE_SHARED_LINKER_FLAGS:STRING=' '
//Flags used by the linker during debug builds.
CMAKE_SHARED_LINKER_FLAGS_DEBUG:STRING=
//Flags used by the linker during release minsize builds.
CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL:STRING=
//Flags used by the linker during release builds.
CMAKE_SHARED_LINKER_FLAGS_RELEASE:STRING=
//Flags used by the linker during Release with Debug Info builds.
CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO:STRING=
//If set, runtime paths are not added when installing shared libraries,
// but are added when building.
CMAKE_SKIP_INSTALL_RPATH:BOOL=OFF
//If set, runtime paths are not added when using shared libraries.
CMAKE_SKIP_RPATH:BOOL=OFF
//Path to a program.
CMAKE_STRIP:FILEPATH=G:/cygwin/bin/strip.exe
//If true, cmake will use relative paths in makefiles and projects.
CMAKE_USE_RELATIVE_PATHS:BOOL=ON
//If this value is on, makefiles will be generated without the
// .SILENT directive, and all commands will be echoed to the console
// during the make. This is useful for debugging only. With Visual
// Studio IDE projects all commands are done without /nologo.
CMAKE_VERBOSE_MAKEFILE:BOOL=OFF
CYGWIN:BOOL=ON
//Value Computed by CMake
OGRE_BINARY_DIR:STATIC=H:/Ogre/gcc18
//Value Computed by CMake
OGRE_SOURCE_DIR:STATIC=H:/Ogre/ogre_src_v1-8-1/ogre_src_v1-8-1
Under Cygwin you cannot use your regular Windows CMake installation. You have to install the UNIX version of CMake using the Cygwin Setup program.
Related
Here is the content of CMakeFiles/CMakeOutput.log which is achieved when compiling a cpp project with qcc toolchain.
My question is how cmake find out the compiler identification is GNU other than LLVM(please pay attention to the last line of the log).
$ cat CMakeFiles/CMakeOutput.log
The target system is: QNX - 7.0.0 -
The host system is: Linux - 4.2.0-27-generic - x86_64
Compiling the C compiler identification source file "CMakeCCompilerId.c" succeeded.
Compiler: /usr/local/toolchains/qnx700/host/linux/x86_64/usr/bin/aarch64-unknown-nto-qnx7.0.0-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 "/data/john/demo/qnx/build_demo_cli_qnx/CMakeFiles/3.11.2/CompilerIdC/a.out"
I am trying to compile Assimp 5.0.1 for Windows 10 using CMake. The C/C++ compilers I have through MinGW are GCC and G++. If I understand the problem correctly, there is an issue with the MakeFile's whitespace somewhere. The /CMakeTmp/ directory is empty, and I am sure the answer is right in front of me somewhere:
Console Output:
-- The C compiler identification is GNU 9.2.0
-- The CXX compiler identification is GNU 9.2.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - failed
-- Check for working C compiler: C:/MinGW/bin/gcc.exe
-- Check for working C compiler: C:/MinGW/bin/gcc.exe - broken
CMake Error at C:/Program Files (x86)/CMake/share/cmake-3.20/Modules/CMakeTestCCompiler.cmake:66 (message):
The C compiler
"C:/MinGW/bin/gcc.exe"
is not able to compile a simple test program.
It fails with the following output:
Change Dir: Q:/programming/westy/src/lib/assimp-5.0.1/build/CMakeFiles/CMakeTmp
Run Build Command(s):make -f Makefile /nologo cmTC_a4ec5\fast && Makefile:37: *** missing separator. Stop.
CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
CMakeLists.txt:54 (PROJECT)
-- Configuring incomplete, errors occurred!
See also "Q:/programming/westy/src/lib/assimp-5.0.1/build/CMakeFiles/CMakeOutput.log".
See also "Q:/programming/westy/src/lib/assimp-5.0.1/build/CMakeFiles/CMakeError.log".
CMakeError.log:
Detecting C compiler ABI info failed to compile with the following output:
Change Dir: Q:/programming/westy/src/lib/assimp-5.0.1/build/CMakeFiles/CMakeTmp
Run Build Command(s):make -f Makefile /nologo cmTC_165dc\fast && Makefile:37: *** missing separator. Stop.
CMakeOutput.log:
Compiling the C compiler identification source file "CMakeCCompilerId.c" succeeded.
Compiler: C:/MinGW/bin/gcc.exe
Build flags:
Id flags:
The output was:
0
Compilation of the C compiler identification source "CMakeCCompilerId.c" produced "a.exe"
The C compiler identification is GNU, found in "Q:/programming/westy/src/lib/assimp-5.0.1/build/CMakeFiles/3.20.2/CompilerIdC/a.exe"
Compiling the CXX compiler identification source file "CMakeCXXCompilerId.cpp" succeeded.
Compiler: C:/MinGW/bin/g++.exe
Build flags:
Id flags:
The output was:
0
Compilation of the CXX compiler identification source "CMakeCXXCompilerId.cpp" produced "a.exe"
The CXX compiler identification is GNU, found in "Q:/programming/westy/src/lib/assimp-5.0.1/build/CMakeFiles/3.20.2/CompilerIdCXX/a.exe"
Which -G option did you use for cmake?
The /nologo parameter for make doesn't seem right, that looks like a Microsoft/MSVC parameter. If you didn't specify -G then CMake defaults to -G"NMake Makefiles" on Windows.
Make sure to use cmake flag -G"MinGW Makefiles" for mingw32-make or -G"MSYS Makefiles" if you use MSYS' make.
But to avoid all those make issues and improve speed -GNinja is the best solution, provided you have Ninja available (see https://ninja-build.org/).
Finally, you're still on MinGW GCC 9.2.0. Newer versions are available, see http://winlibs.com/ for standalone builds which also come with newer mingw32-make.
I have been using CodeBlocks with the Digital Mars D compiler and the LLVM Clang compiler for some time without any problems. Now I need to use the LDC D compiler and am having problems with the linker invocation.
I get the following output:
-------------- Build: Debug in test (compiler: LLVM D Compiler)---------------
ldc2.exe -g -I"C:\Program Files\LDC\ldc2-1.13.0-windows-x64\bin" -c hello.d -of=obj\Debug\hello.o
ldc2.exe -L-L"C:\Program Files\LDC\ldc2-1.13.0-windows-x64\lib" -of=bin\Debug\test.exe obj\Debug\hello.o
Error: unrecognized file extension o
Process terminated with status 1 (0 minute(s), 0 second(s))
0 error(s), 0 warning(s) (0 minute(s), 0 second(s))
The compile step seems to work fine, but specifying ldc2.exe as a linker clearly fails.
Similarly, using ldmd2.exe and lld-link.exe in CodeBlocks' linker specification produce similar errors.
Any suggestions?
Looks like Code::Blocks is using the .o extension for object files on Windows, while the linker driver in the compiler frontend is probably expecting object files to have the .obj extension, which is more common on Windows.
I'm not familiar with Code::Blocks or how it interfaces with D compilers, but you can try checking to see if it has a setting to control what extension is used for object files. This may be a bug (or, simply, lacking Windows support) in whatever code is responsible for building D compiler command lines in Code::Blocks.
I'm a the end with 16 hours of configure, installing, deleting, modifying and hit my keyboard many times....
I want to use restbed for plattform independent C++ programming, but I can't get build this stuff. I have Cygwin (download at 2017/04/24) installed (think for git or whatever creepy things), Code::Blocks with MinGW (16.01) and at least a seperate MinGW (also downloaded 2017/04/24) installation. Also I've Visual Studio 2012 Pro, 2015 and 2017 (long story) on a Windows 7 x64 Pro.
This is what I try and the results:
cloning recursivly with git in empty directory and following the instructions.
cmake -DBUILD_TESTS=YES -DBUILD_EXAMPLES=YES -DBUILD_SSL=NO -DBUILD_SHARED=YES ..
Uhh.. success. I seems it using the gcc/g++ from Cygwin.
-- The C compiler identification is GNU 5.4.0
-- The CXX compiler identification is GNU 5.4.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
:
:
-- Configuring done
-- Generating done
-- Build files have been written to: /cygdrive/d/Entwicklung/C++/restbed/restbed/build
Nice! Now follows:
make -j install
After 7% working, it gives a bunch of warnings and failed:
/cygdrive/{my_path_to}/restbed/restbed/dependency/asio/asio/include/asio/detail/config.hpp:755:5: warning: #warning Please define _WIN32_WINNT or _WIN32_WINDOWS appropriately. [-Wcpp]
# warning Please define _WIN32_WINNT or _WIN32_WINDOWS appropriately.
^
/cygdrive/{my_path_to}/restbed/restbed/dependency/asio/asio/include/asio/detail/config.hpp:756:5: warning: #warning For example, add -D_WIN32_WINNT=0x0501 to the compiler command line. [-Wcpp]
# warning For example, add -D_WIN32_WINNT=0x0501 to the compiler command line.
^
/cygdrive/{my_path_to}/restbed/restbed/dependency/asio/asio/include/asio/detail/config.hpp:757:5: warning: #warning Assuming _WIN32_WINNT=0x0501 (i.e. Windows XP target). [-Wcpp]
# warning Assuming _WIN32_WINNT=0x0501 (i.e. Windows XP target).
^
/cygdrive/{my_path_to}/restbed/restbed/dependency/asio/asio/include/asio/detail/config.hpp:781:5: error: #error You must add -D__USE_W32_SOCKETS to your compiler options.
I modifing config.hpp and add
#ifndef _WIN32_WINNT
#define _WIN32_WINNT 0x0501
#endif
The 'define bla' warnings dissapear, but now I should set '-D__USE_W32_SOCKETS'.
BUT WHERE?
After researching google I try to set a enviroment variable CPPFLAGS=-D__USE_W32_SOCKETS, but this change nothing!
OK, now I want give MinGW a chance, but how get I rid of this penetrant Cygwin, without deinstalling and get mess with other software?
Cool, should I set some enviroment variables....
Clean up the build-Directory and set CC and CXX as mentioned in cmake output.
SET CC=D:/MinGW/bin/gcc.exe
SET CXX=D:/MinGW/bin/g++.exe
Checking my PATH variable and adding ";D:\MinGW\mysys\1.0\bin;D:\MinGW\bin"
Now use cmake bla.. again...but... but... WHAT?
-- The C compiler identification is GNU 5.3.0
-- The CXX compiler identification is GNU 5.3.0
CMake Error at CMakeLists.txt:4 (project):
The CMAKE_C_COMPILER:
D:/MinGW/bin/gcc.exe
is not a full path and was not found in the PATH.
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:4 (project):
The CMAKE_CXX_COMPILER:
D:/MinGW/bin/g++.exe
is not a full path and was not found in the PATH.
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 "/cygdrive/{my_path_to}/restbed/restbed/build/CMakeFiles/CMakeOutput.log".
With Cygwin cmake says, I use gcc/g++ in version GNU 5.4.0. On the other hand, it detects the correct MinGW version as 5.3.0, but can't find it? Hu?
What can I do to get this library work under Windows 7?
EDIT BEGIN
To build makefiles for Code::Blocks, the -G parameter doesn't work. I try some combinations, but always say:
cmake -DBUILD_TESTS=YES -DBUILD_EXAMPLES=YES -DBUILD_SSL=NO -DBUILD_SHARED=YES -G "CodeBlocks" ..
CMake Error: Could not create named generator CodeBlocks
Generators
Unix Makefiles = Generates standard UNIX makefiles.
Ninja = Generates build.ninja files.
CodeBlocks - Ninja = Generates CodeBlocks project files.
CodeBlocks - Unix Makefiles = Generates CodeBlocks project files.
:
:
cmake -DBUILD_TESTS=YES -DBUILD_EXAMPLES=YES -DBUILD_SSL=NO -DBUILD_SHARED=YES -G "CodeBlocks - Ninja" ..
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.
CMake Error: CMAKE_C_COMPILER not set, after EnableLanguage
CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage
-- Configuring incomplete, errors occurred!
Now this (many censored words) thing want to know the cmake-make?
My fault.... don't think about, what I've installed.
"CodeBlocks - Unix Makefiles" works as expected for generating project file, but can't compile under Code::Blocks. I changed compiler for project in 'Build options' to Cygwin, but says:
Execution of '/usr/bin/make.exe -j8 -f "/cygdrive/d/{my_path_to}/restbed/restbed/build/Makefile" VERBOSE=1 all' in 'D:\{my_path_to}\restbed\restbed\build' failed.
...and nothing more. Think it has to do with "Unix Makefile" under Windows.
EDIT END
I'm out of knowledge what to do, what to set, to delete, to modify, configure, aaaargh.
My last hope is, that someone has the big hint, a good idea or a workaround.
Thanks in advance.
Restbed can build with Visual Studio 2015/2017, why not use the native toolchain for that platform?
My system is ubuntu 12.04, defaut gcc is 4.6. I installed gcc 4.7 and use apt-alternatives command switch gcc to gcc4.7. But when using cmake code like below. I still got the "Need at least GCC 4.7" error.
CHECK_C_SOURCE_COMPILES("#define GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__)
#if GCC_VERSION < 40700
#error Not GCC 4.7.0+
#endif
int main() { return 0; }" HAVE_GCC_47)
if (NOT HAVE_GCC_47)
message(FATAL_ERROR "Need at least GCC 4.7")
endif()
You should set the C and/or CXX compiler on the command line, so if you have a project in src, and make a build directory next to src, then the following invocation would ensure the compiler was used (this must be passed in a clean directory, not one with an existing cache:
cmake -DCMAKE_C_COMPILER:FILEPATH=/path/to/gcc -DCMAKE_CXX_COMPILER:FILEPATH=/path/to/g++ ../src
You can also set the environment variables CC and CXX in your shell/on the command line. They will be used, and are fairly standard in *nix environments. The page at http://www.cmake.org/Wiki/CMake_Useful_Variables is a useful reference for CMake variables too.