CMake "clang++ is not able compile a simple test program" (Fedora 20) - c++

So I tried to install clang + cmake to compile a simple C++ program and I'm getting the following error:
-- The C compiler identification is GNU 4.8.3
-- The CXX compiler identification is Clang 3.5.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /usr/local/bin/clang++
-- Check for working CXX compiler: /usr/local/bin/clang++ -- broken
CMake Error at /usr/share/cmake/Modules/CMakeTestCXXCompiler.cmake:54 (message):
The C++ compiler "/usr/local/bin/clang++" is not able to compile a simple
test program.
It fails with the following output:
Change Dir: /home/jtcwang/tmp/CMake/CMake/CMakeFiles/CMakeTmp
Run Build Command:/usr/bin/gmake "cmTryCompileExec697180971/fast"
/usr/bin/gmake -f CMakeFiles/cmTryCompileExec697180971.dir/build.make
CMakeFiles/cmTryCompileExec697180971.dir/build
gmake[1]: Entering directory
`/home/jtcwang/tmp/CMake/CMake/CMakeFiles/CMakeTmp'
/usr/bin/cmake -E cmake_progress_report
/home/jtcwang/tmp/CMake/CMake/CMakeFiles/CMakeTmp/CMakeFiles 1
Building CXX object
CMakeFiles/cmTryCompileExec697180971.dir/testCXXCompiler.cxx.o
/usr/local/bin/clang++ -o
CMakeFiles/cmTryCompileExec697180971.dir/testCXXCompiler.cxx.o -c
/home/jtcwang/tmp/CMake/CMake/CMakeFiles/CMakeTmp/testCXXCompiler.cxx
Linking CXX executable cmTryCompileExec697180971
/usr/bin/cmake -E cmake_link_script
CMakeFiles/cmTryCompileExec697180971.dir/link.txt --verbose=1
/usr/local/bin/clang++
CMakeFiles/cmTryCompileExec697180971.dir/testCXXCompiler.cxx.o -o
cmTryCompileExec697180971 -rdynamic
/usr/bin/ld: cannot find -lstdc++
clang: error: linker command failed with exit code 1 (use -v to see
invocation)
gmake[1]: Leaving directory
`/home/jtcwang/tmp/CMake/CMake/CMakeFiles/CMakeTmp'
gmake[1]: *** [cmTryCompileExec697180971] Error 1
gmake: *** [cmTryCompileExec697180971/fast] Error 2
It's not even compiling my program because it fails to compile a test program.
Looks like the important line is here:
/usr/bin/ld: cannot find -lstdc++
However, I have checked that libstdc++ is installed and up to date, so at this point I'm quite lost.
Other things I've tried:
Using prebuilt binaries instead of sudo yum install clang
remove and reinstall
Tried clang++ hello.cpp (hello world program). It says <iostreams> is not found. Is clang missing a standard library? EDIT: changing to <iostream> gives me the same linker error above.
I'm not familiar with the clang, cmake and C++ scene in general, so I'd appreciate any pointers. Thanks!

You need the development libraries and headers for C++ library, try
yum install libstdc++-devel

Your /home/gnu/bin/c++ seem to require additional flag to link things properly and CMake doesn't know about that.
To use /usr/bin/c++ as your compiler run cmake with -DCMAKE_CXX_COMPILER=/usr/bin/c++.
Also, CMAKE_PREFIX_PATH variable sets destination dir where your project' files should be installed. It has nothing to do with CMake installation prefix and CMake itself already know this.

Related

Conan Cross-build from Linux:x86_64 to Linux:armv7hf test_package build fails

I have a C++ library packaged with conan and it contains a test_package with a conanfile.py that uses the new conan 2.0 self.requries(self.tested_reference_str) and test_type = "explicit".
When not cross-building everything runs fine. I can build the library using conan build . and build and run the consumer test_package.
In case of cross-building, the main library can be built without issues. However, the build of the test_package fails with:
----Running------
> . "/work/tests/test_package/build/generators/conanbuild.sh" && cmake -G "Unix Makefiles" -DCMAKE_TOOLCHAIN_FILE="/work/tests/test_package/build/generators/conan_toolchain.cmake" -DCMAKE_POLICY_DEFAULT_CMP0091="NEW" -DCMAKE_BUILD_TYPE="Release" "/work/tests/test_package/."
-----------------
-- Using Conan toolchain: /work/tests/test_package/build/generators/conan_toolchain.cmake
-- The CXX compiler identification is GNU 11.3.0
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - failed
-- Check for working CXX compiler: /opt/poky/4.0.5/sysroots/x86_64-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi/arm-poky-linux-gnueabi-g++
-- Check for working CXX compiler: /opt/poky/4.0.5/sysroots/x86_64-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi/arm-poky-linux-gnueabi-g++ - broken
CMake Error at /opt/poky/4.0.5/sysroots/x86_64-pokysdk-linux/usr/share/cmake-3.22/Modules/CMakeTestCXXCompiler.cmake:62 (message):
The C++ compiler
"/opt/poky/4.0.5/sysroots/x86_64-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi/arm-poky-linux-gnueabi-g++"
is not able to compile a simple test program.
It fails with the following output:
Change Dir: /work/tests/test_package/build/Release/CMakeFiles/CMakeTmp
Run Build Command(s):/usr/bin/gmake -f Makefile cmTC_8ea64/fast && /usr/bin/gmake -f CMakeFiles/cmTC_8ea64.dir/build.make CMakeFiles/cmTC_8ea64.dir/build
gmake[1]: Entering directory '/work/tests/test_package/build/Release/CMakeFiles/CMakeTmp'
Building CXX object CMakeFiles/cmTC_8ea64.dir/testCXXCompiler.cxx.o
/opt/poky/4.0.5/sysroots/x86_64-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi/arm-poky-linux-gnueabi-g++ -O2 -pipe -g -feliminate-unused-debug-types -stdlib=libstdc++ -o CMakeFiles/cmTC_8ea64.dir/testCXXCompiler.cxx.o -c /work/tests/test_package/build/Release/CMakeFiles/CMakeTmp/testCXXCompiler.cxx
arm-poky-linux-gnueabi-g++: error: unrecognized command-line option ‘-stdlib=libstdc++’
gmake[1]: *** [CMakeFiles/cmTC_8ea64.dir/build.make:78: CMakeFiles/cmTC_8ea64.dir/testCXXCompiler.cxx.o] Error 1
gmake[1]: Leaving directory '/work/tests/test_package/build/Release/CMakeFiles/CMakeTmp'
gmake: *** [Makefile:127: cmTC_8ea64/fast] Error 2
CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
CMakeLists.txt:2 (project)
host profile:
[settings]
os=Linux
arch=armv7hf
compiler=clang
compiler.version=14
# Tried also with libc++
compiler.libcxx=libstdc++11
build_type=Release
build profile:
[settings]
os=Linux
arch=x86_64
compiler=gcc
compiler.version=11
# Without the following the error becomes:
# arm-poky-linux-gnueabi-g++: error: unrecognized command-line option ‘-stdlib=libc++’
compiler.libcxx=libstdc++11
build_type=Release
[env]
CC=gcc-11
CXX=g++-11
Any idea why cross compiling works for the library itself but the test_package fails?
Edit: I looked into conaninfo.txt, CMakeCache.txt, for both: the library generated files and the test_package generated files. Conan specifies the clang compiler in both cases (library build and test_package) but CMake uses anyway the GNU compiler for the test_package. It seems the CMAKE_CXX_COMPILER is not passed correctly to CMake in case of the test_package. A conan install inside the test_package folder also results in the wrong compiler (GNU) being used.

CMake on linux givs error cc1plus: error: too many filenames given

EDIT 1: verbose make output now included in error, see below as well
I'm currently trying to compile a C++ project with CMake from a different laptop than the one I had been working on before. When I run make after the CMake configuration is done (withouth errors) I get the following error:
$ make
/usr/bin/cmake -S/home/luc/coding/hiwi/peltier-control-panel -B/home/luc/coding/hiwi/peltier-control-panel/build --check-build-system CMakeFiles/Makefile.cmake 0
/usr/bin/cmake -E cmake_progress_start /home/luc/coding/hiwi/peltier-control-panel/build/CMakeFiles /home/luc/coding/hiwi/peltier-control-panel/build//CMakeFiles/progress.marks
make -f CMakeFiles/Makefile2 all
make[1]: Entering directory '/home/luc/coding/hiwi/peltier-control-panel/build'
make -f CMakeFiles/sio_client.dir/build.make CMakeFiles/sio_client.dir/depend
make[2]: Entering directory '/home/luc/coding/hiwi/peltier-control-panel/build'
cd /home/luc/coding/hiwi/peltier-control-panel/build && /usr/bin/cmake -E
cmake_depends "Unix Makefiles" /home/luc/coding/hiwi/peltier-control-panel
/home/luc/coding/hiwi/peltier-control-panel /home/luc/coding/hiwi/peltier-control-
panel/build /home/luc/coding/hiwi/peltier-control-panel/build /home/luc/coding/hiwi/peltier-control-
panel/build/CMakeFiles/sio_client.dir/DependInfo.cmake --color=
make[2]: Leaving directory '/home/luc/coding/hiwi/peltier-control-panel/build'
make -f CMakeFiles/sio_client.dir/build.make CMakeFiles/sio_client.dir/build
make[2]: Entering directory '/home/luc/coding/hiwi/peltier-control-panel/build'
[ 6%] Building CXX object CMakeFiles/sio_client.dir/lib/socket.io-client-cpp/src/sio_client.cpp.o
/usr/bin/c++ -DSIMULATION -I/home/luc/coding/hiwi/peltier-control-panel/include
-I/home/luc/coding/hiwi/peltier-control-panel/src
-I/home/luc/coding/hiwi/peltier-control-panel/lib
-I/home/luc/coding/hiwi/peltier-control-panel/lib/websocketpp
-I/home/luc/coding/hiwi/peltier-control-panel/lib/rapidjson/include
-I/home/luc/coding/hiwi/peltier-control-panel/lib/WiringPi/wiringPi
-Wall -Wextra -o3 -std=gnu++11 -MD -MT
CMakeFiles/sio_client.dir/lib/socket.io-client-cpp/src/sio_client.cpp.o
-MF CMakeFiles/sio_client.dir/lib/socket.io-client-cpp/src/sio_client.cpp.o.d
-o CMakeFiles/sio_client.dir/lib/socket.io-client-cpp/src/sio_client.cpp.o
-c /home/luc/coding/hiwi/peltier-control-panel/lib/socket.io-client-cpp/src/sio_client.cpp
cc1plus: error: too many filenames given; type ‘cc1plus --help’ for usage
cc1plus: fatal error: CMakeFiles/sio_client.dir/lib/socket.io-client-cpp/src/sio_client.cpp.d: No such file or directory
compilation terminated.
make[2]: *** [CMakeFiles/sio_client.dir/build.make:79: CMakeFiles/sio_client.dir/lib/socket.io-client-cpp/src/sio_client.cpp.o] Error 1
make[2]: Leaving directory '/home/luc/coding/hiwi/peltier-control-panel/build'
make[1]: *** [CMakeFiles/Makefile2:175: CMakeFiles/sio_client.dir/all] Error 2
make[1]: Leaving directory '/home/luc/coding/hiwi/peltier-control-panel/build'
make: *** [Makefile:94: all] Error 2
On the old laptop the code compiles without a problem (Ubuntu 16), so it must be independent of the code. On this laptop I have Arch installed, which means I have much newer versions of all of the installed compilers and programs. Boost libraries are requried in my project but it seems to fail even before it gets to the point where it starts compiling and linking that so I don't think it's really relevant. I'm including it only for the sake of completeness.
Ubuntu 16:
CMake: 3.15.4
Make: 4.1
g++/gcc: 5.4.0
libboost 1.68.0
Arch:
CMake: 3.21.2
Make: 4.2
g++/gcc: 11.1.0
libboost 1.76.0
I'm not sure this is the reason however, since the only issue I found on the internet that is similar to this has to do with the mingw installation path on Windows, which is certainly not the issue I seem to be facing.
CMake output:
cmake .. -DSIMULATION=TRUE
-- The C compiler identification is GNU 11.1.0
-- The CXX compiler identification is GNU 11.1.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - 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: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
Using simulated temperature data...
-- Found Boost: /usr/lib64/cmake/Boost-1.76.0/BoostConfig.cmake (found version "1.76.0") found components: system
-- Linking against boost shared libraries
-- location of boost libraries
-- Boost::system
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed
-- Check if compiler accepts -pthread
-- Check if compiler accepts -pthread - yes
-- Found Threads: TRUE
-- Linking SIMULATION
-- Configuring done
-- Generating done
-- Build files have been written to: /home/luc/coding/hiwi/peltier-control-panel/build
An interesting fact I have observed is that on the Arch laptop the checks for working C/CXX compilers are skipped whereas they aren't for the Ubuntu laptop. However, I am able to compile programs with gcc/g++ so they must in principle be working.
I've never encountered this problem before, and it's not something that a quick search seems to be able to resolve. I'm hoping someone may have had some experience with this at some point and could point me in the right direction. Any help at all would be greatly appreciated, however.
EDIT
#Stephen Newell thank you very much for your comment, I wasn't aware of this trick! (I'm still somewhat new to using make/cmake.)
Okay so I think I've narrowed it down to this: when running the same CMakeLists.txt on both systems they produce varying compilation commands:
Ubuntu 16:
/usr/bin/c++ -DSIMULATION
-I/home/luc/coding/hiwi/peltier-heater/include
-I/home/luc/coding/hiwi/peltier-heater/src
-I/home/luc/coding/hiwi/peltier-heater/lib -I/home/luc/coding/hiwi/peltier-heater/lib/websocketpp
-I/home/luc/coding/hiwi/peltier-heater/lib/rapidjson/include
-Wall -Wextra -o3 -std=gnu++11
-o CMakeFiles/PIDController.dir/src/PIDController.cpp.o
-c /home/luc/coding/hiwi/peltier-heater/src/PIDController.cpp
Arch:
/usr/bin/c++ -DSIMULATION
-I/home/luc/coding/hiwi/peltier-heater/include
-I/home/luc/coding/hiwi/peltier-heater/src
-I/home/luc/coding/hiwi/peltier-heater/lib
-I/home/luc/coding/hiwi/peltier-heater/lib/websocketpp
-I/home/luc/coding/hiwi/peltier-heater/lib/rapidjson/include
-Wall -Wextra -o3 -std=gnu++11
-MT CMakeFiles/PIDController.dir/src/PIDController.cpp.o
-MF CMakeFiles/PIDController.dir/src/PIDController.cpp.o.d
-o CMakeFiles/PIDController.dir/src/PIDController.cpp.o
-c /home/luc/coding/hiwi/peltier-heater/src/PIDController.cpp
Notice the -MF and -MT flags. If I pass the Ubuntu command in the build folder on my Arch system it compiles without error (though obviously it only does that specific step)
Is there any reason in particular why these flags are being generated on one system but not on the other? Can (and should) I turn them off? Or should I maybe change some configuration in my CMakeLists.txt to correct for this?

How to enable -mno-outline-atomics AArch64 flag?

I've been trying to cross compile an open source library for AArch64.
When I run an executable linking against this library on a Raspberry Pi 4 (running a 64-bit OS), I get an Illegal Instruction error.
I created a github issue and the library developer suggested I enable the -mno-outline-atomics compiler flag (more details on the github issue here). More details on the flag itself can be found here.
So I edited the aarch64 cmake toolchain file (found here) to include the following:
set(CMAKE_C_FLAGS "-march=armv8-a -mno-outline-atomics")
set(CMAKE_CXX_FLAGS "-march=armv8-a -mno-outline-atomics")
However, when I try to compile the library, I get the following error messages:
-- CMAKE_TOOLCHAIN_FILE = /home/cyrus/work/c-sdks/3rd_party_libs/ncnn/toolchains/aarch64-linux-gnu.toolchain.cmake
-- CMAKE_INSTALL_PREFIX = /home/cyrus/work/c-sdks/3rd_party_libs/ncnn/build_aarch64/install
-- The C compiler identification is GNU 7.5.0
-- The CXX compiler identification is GNU 7.5.0
-- Check for working C compiler: /usr/bin/aarch64-linux-gnu-gcc
-- Check for working C compiler: /usr/bin/aarch64-linux-gnu-gcc - broken
CMake Error at /usr/local/share/cmake-3.17/Modules/CMakeTestCCompiler.cmake:60 (message):
The C compiler
"/usr/bin/aarch64-linux-gnu-gcc"
is not able to compile a simple test program.
It fails with the following output:
Change Dir: /home/cyrus/work/c-sdks/3rd_party_libs/ncnn/build_aarch64/CMakeFiles/CMakeTmp
Run Build Command(s):/usr/bin/make cmTC_65def/fast && /usr/bin/make -f CMakeFiles/cmTC_65def.dir/build.make CMakeFiles/cmTC_65def.dir/build
make[1]: Entering directory '/home/cyrus/work/c-sdks/3rd_party_libs/ncnn/build_aarch64/CMakeFiles/CMakeTmp'
Building C object CMakeFiles/cmTC_65def.dir/testCCompiler.c.o
/usr/bin/aarch64-linux-gnu-gcc -march=armv8-a -mno-outline-atomics -o CMakeFiles/cmTC_65def.dir/testCCompiler.c.o -c /home/cyrus/work/c-sdks/3rd_party_libs/ncnn/build_aarch64/CMakeFiles/CMakeTmp/testCCompiler.c
aarch64-linux-gnu-gcc: error: unrecognized command line option ‘-mno-outline-atomics’; did you mean ‘-fno-inline-atomics’?
CMakeFiles/cmTC_65def.dir/build.make:82: recipe for target 'CMakeFiles/cmTC_65def.dir/testCCompiler.c.o' failed
make[1]: *** [CMakeFiles/cmTC_65def.dir/testCCompiler.c.o] Error 1
make[1]: Leaving directory '/home/cyrus/work/c-sdks/3rd_party_libs/ncnn/build_aarch64/CMakeFiles/CMakeTmp'
Makefile:138: recipe for target 'cmTC_65def/fast' failed
make: *** [cmTC_65def/fast] Error 2
Why is the compiler complaining about this: unrecognized command line option ‘-mno-outline-atomics’?
How can I properly enable the flag using CMake?
The outline-atomic feature was added with gcc 9.4.
-- The C compiler identification is GNU 7.5.0
-- The CXX compiler identification is GNU 7.5.0
Clearly, your compiler is too old and does not support it.

CMake can't find stdc++11 after Xcode 10 update

I have a CMake project using SFML which was working fine but after updating to Xcode 10, all of the compiler files that CMake looks for can't be found.
clang: warning: libstdc++ is deprecated; move to libc++
I'm not sure how to move to the different lib source.
I've tried using set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=libc++") to use the flag.
It also tells me: Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ -- broken. I can run the g++/c++ commands fine in the terminal. I assume they are being looked for in the same spot.
CMake file I'm trying to compile with. Its the SFML one:
SFML CMake
Full Error Message:
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ -- broken
CMake Error at /Applications/CMake.app/Contents/share/cmake-3.7/Modules/CMakeTestCXXCompiler.cmake:44 (message):
The C++ compiler
"/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++"
is not able to compile a simple test program.
It fails with the following output:
Change Dir: /Users/DSchana/Documents/Libraries/SFML/build/CMakeFiles/CMakeTmp
Run Build Command:"/usr/bin/make" "cmTC_af3d5/fast"
/Applications/Xcode.app/Contents/Developer/usr/bin/make -f
CMakeFiles/cmTC_af3d5.dir/build.make CMakeFiles/cmTC_af3d5.dir/build
Building CXX object CMakeFiles/cmTC_af3d5.dir/testCXXCompiler.cxx.o
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++
-arch x86_64 -isysroot
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.07.sdk
-mmacosx-version-min=10.7 -o
CMakeFiles/cmTC_af3d5.dir/testCXXCompiler.cxx.o -c
/Users/DSchana/Documents/Libraries/SFML/build/CMakeFiles/CMakeTmp/testCXXCompiler.cxx
warning: include path for stdlibc++ headers not found; pass '-std=libc++'
on the command line to use the libc++ standard library instead
[-Wstdlibcxx-not-found]
1 warning generated.
Linking CXX executable cmTC_af3d5
/Applications/CMake.app/Contents/bin/cmake -E cmake_link_script
CMakeFiles/cmTC_af3d5.dir/link.txt --verbose=1
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++
-arch x86_64 -isysroot
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.07.sdk
-mmacosx-version-min=10.7 -Wl,-search_paths_first
-Wl,-headerpad_max_install_names
CMakeFiles/cmTC_af3d5.dir/testCXXCompiler.cxx.o -o cmTC_af3d5
clang: warning: libstdc++ is deprecated; move to libc++ with a minimum
deployment target of OS X 10.9 [-Wdeprecated]
ld: library not found for -lstdc++
clang: error: linker command failed with exit code 1 (use -v to see
invocation)
make[1]: *** [cmTC_af3d5] Error 1
make: *** [cmTC_af3d5/fast] Error 2
CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
CMakeLists.txt:47 (project)
-- Configuring incomplete, errors occurred!
Ok. Turns out I just needed to add set(CMAKE_CXX_FLAGS "-stdlib=libc++") to my CMakeLists.txt

cmake error showing nonexistent folder on running in cygwin terminal

I am trying to compile a c++ library g2o in cygwin(in windows 8) using cmake . I created a build folder and when I try to do cmake in that folder it fails with the following error
$ cmake ../
-- The C compiler identification is GNU 4.8.3
-- The CXX compiler identification is GNU 4.8.3
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- broken
CMake Error at /usr/share/cmake-2.8.11.2/Modules/CMakeTestCCompiler.cmake:61 (message):
The C compiler "/usr/bin/cc" is not able to compile a simple test program.
It fails with the following output:
Change Dir: /cygdrive/b/g2o/trunk/build/CMakeFiles/CMakeTmp
Run Build Command:/cygdrive/c/Program\
Files/MATLAB/R2009a/bin/win64/gmake.exe "cmTryCompileExec3795381385/fast"
C:/Program Files/MATLAB/R2009a/bin/win64/gmake -f
CMakeFiles/cmTryCompileExec3795381385.dir/build.make
CMakeFiles/cmTryCompileExec3795381385.dir/build
gmake[1]: Entering directory `B:/g2o/trunk/build/CMakeFiles/CMakeTmp'
/usr/bin/cmake.exe -E cmake_progress_report "/cygdrive/b/g2o/trunk/build/CMakeFiles/CMakeTmp/CMakeFiles" 1
Building C object
CMakeFiles/cmTryCompileExec3795381385.dir/testCCompiler.c.o
/usr/bin/cc -o CMakeFiles/cmTryCompileExec3795381385.dir/testCCompiler.c.o
-c "/cygdrive/b/g2o/trunk/build/CMakeFiles/CMakeTmp/testCCompiler.c"
Linking C executable cmTryCompileExec3795381385.exe
/usr/bin/cmake.exe -E cmake_link_script
CMakeFiles/cmTryCompileExec3795381385.dir/link.txt --verbose=1
gmake[1]: Leaving directory `B:/g2o/trunk/build/CMakeFiles/CMakeTmp'
process_begin: CreateProcess(NULL, /usr/bin/cmake.exe -E cmake_link_script
CMakeFiles/cmTryCompileExec3795381385.dir/link.txt --verbose=1, ...)
failed.
make (e=2): The system cannot find the file specified.
gmake[1]: *** [cmTryCompileExec3795381385.exe] Error 2
gmake: *** [cmTryCompileExec3795381385/fast] Error 2
CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
CMakeLists.txt:4 (PROJECT)
-- Configuring incomplete, errors occurred!
The interesting thing here is I have cmake 3.0 installed in my machine and the error says cmake 2.8.11.2. I did a search in the pc and cannot find any folder by that name. The system path variable contains the path to correct cmake bin folder also.
I cannot figure out what could be the reason behind this error. Can it be an issue with the cygwin itself? What can I do to avoid this error?
One thing to note, Cygwin has its own copy of CMake, which is what your seeing as 2.8.11.2. That version has nothing to do with the one you have on your Windows machine. Have you tried to use the Windows installed version and not Cygwin?
I think the problem comes from not having all required compiler libraries installed in Cygwin. You could try creating a simple C++ file and try compiling it with gcc directly. If that fails, you've now found out why CMake is failing.
Unless there is a good reason to do so, you should probably consider NOT using Cygwin to run CMake inside Windows. CMake is very capable of producing Visual Studio project files.
The issue, at least for me, was the c compiler not accepting unix style paths.
The solution was to install gcc via cygwin. The packages I installed is gcc-base and gcc-cpp I believe.