我正在尝试使用cmake在cygwin(在windows8中)编译一个c++库g2o。我创建了一个build文件夹,当我尝试在该文件夹中执行cmake时,失败并显示以下错误
$ 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!
有趣的是,我在机器上安装了cmake 3.0,错误显示为cmake 2.8.11.2。我在pc中进行了搜索,但找不到任何使用该名称的文件夹。系统path变量还包含正确的cmake bin文件夹的路径。
我不知道这个错误背后的原因是什么。这会是cygwin本身的问题吗?我可以做些什么来避免这个错误?
发布于 2014-07-18 19:37:41
有一件事需要注意,Cygwin有它自己的CMake副本,这就是你看到的2.8.11.2。该版本与您的Windows计算机上的版本没有任何关系。您是否尝试过使用Windows安装的版本,而不是Cygwin?
我认为问题来自于Cygwin中没有安装所有必需的编译器库。您可以尝试创建一个简单的C++文件,并尝试使用gcc直接编译它。如果失败了,那么您现在已经了解了CMake失败的原因。
除非有充分的理由这样做,否则您可能应该考虑不使用Cygwin在Windows中运行CMake。CMake非常有能力生成Visual Studio项目文件。
https://stackoverflow.com/questions/24823295
复制相似问题