configure
在cmake-gui
我的 OS X 平台上运行时,出现以下错误:
The C compiler identification is GNU
The CXX compiler identification is GNU
Checking whether C compiler has -isysroot
Checking whether C compiler has -isysroot - yes
Checking whether C compiler supports OSX deployment target flag
Checking whether C compiler supports OSX deployment target flag - yes
Check for working C compiler: /usr/bin/gcc-4.0
Check for working C compiler: /usr/bin/gcc-4.0 -- broken
CMake Error at /Applications/CMake 2.8-2.app/Contents/share/cmake-2.8/Modules/CMakeTestCCompiler.cmake:52 (MESSAGE):
The C compiler "/usr/bin/gcc-4.0" is not able to compile a simple test
program.
It fails with the following output:
Change Dir: /Users/bill/Desktop/cmake_test/build/CMakeFiles/CMakeTmp
Run Build Command:/opt/local/bin/gmake "cmTryCompileExec/fast"
/opt/local/bin/gmake -f CMakeFiles/cmTryCompileExec.dir/build.make
CMakeFiles/cmTryCompileExec.dir/build
gmake[1]: Entering directory
`/Users/bill/Desktop/cmake_test/build/CMakeFiles/CMakeTmp'
"/Applications/CMake 2.8-2.app/Contents/bin/cmake" -E cmake_progress_report
/Users/bill/Desktop/cmake_test/build/CMakeFiles/CMakeTmp/CMakeFiles 1
Building C object CMakeFiles/cmTryCompileExec.dir/testCCompiler.c.o
/usr/bin/gcc-4.0 -isysroot -o
CMakeFiles/cmTryCompileExec.dir/testCCompiler.c.o -c
/Users/bill/Desktop/cmake_test/build/CMakeFiles/CMakeTmp/testCCompiler.c
i686-apple-darwin10-gcc-4.0.1:
CMakeFiles/cmTryCompileExec.dir/testCCompiler.c.o: No such file or
directory
<snip>
通过查看 Internet 上的论坛等,我确定这可能与我的 PATH 变量有关。这是我用于分析的 PATH 变量:
! echo $PATH
/Library/Frameworks/Python.framework/Versions/Current/bin:/Library/Frameworks/Python.framework/Versions/2.7/bin:/sw/bin:/sw/sbin:/Applications/MATLAB_R2012a.app/bin:/opt/local/bin:/opt/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/texbin:/usr/X11/bin:/usr/X11R6/bin
这个路径变量最近在我配置 Python 时发生了变化,我认为 GCC 问题一定是同时出现的。我的系统安装可能有什么问题导致这种情况发生?
更多细节。指定的构建程序CMAKE_MAKE_PROGRAM
是/opt/local/bin/gmake
.
我还发现这些错误仅在运行时Configure
抛出cmake-gui
。在命令行上(cmake ..
从构建文件夹运行),配置完成:
! cmake ..
-- The C compiler identification is GNU 4.0.1
-- The CXX compiler identification is GNU 4.2.1
-- Checking whether C compiler has -isysroot
-- Checking whether C compiler has -isysroot - yes
-- Checking whether C compiler supports OSX deployment target flag
-- Checking whether C compiler supports OSX deployment target flag - yes
-- Check for working C compiler: /usr/bin/gcc-4.0
-- Check for working C compiler: /usr/bin/gcc-4.0 -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Checking whether CXX compiler has -isysroot
-- Checking whether CXX compiler has -isysroot - yes
-- Checking whether CXX compiler supports OSX deployment target flag
-- Checking whether CXX compiler supports OSX deployment target flag - yes
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Configuring done
-- Generating done
但是,在使用某些库时编译并不总是成功 - 例如,请参见我在这里提出的这个问题。cmake
因此,我认为在此过程中可能仍会出现问题。