OSX下破碎的CMake和gcc [英] Broken CMake and gcc under OSX

查看:322
本文介绍了OSX下破碎的CMake和gcc的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

cmake的桂我的OSX平台上,我碰到下面的错误发生的历史运行配置

When running configure in cmake-gui on my OSX platform, I get the following error occuring:

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>

从看互联网上的论坛等,我已经建立,这可能是与我的PATH变量的事情。这里是我的PATH变量分析:

From looking at forums etc on the internet, I have established that this could be to do with my PATH variable. Here is my PATH variable for analysis:

! 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,我认为,海湾合作委员会问题,必须以相同的时间顺序来如雨后春笋般涌现。可能是什么问题我的系统安装了这是发生?

This path variable has recently changed when I configured Python, and I think that the gcc problems must have sprung up at the same sort of time. What could be wrong with my system installation for this to be occurring?

更多的细节。通过 CMAKE_MAKE_PROGRAM 指定的构建计划是的/ opt / local / bin目录/使用gmake

Some more details. The build program specified by CMAKE_MAKE_PROGRAM is /opt/local/bin/gmake.

我也发现了 cmake的桂运行时配置,这些错误仅抛出。在命令行(运行 cmake的.. 从build文件夹),在配置完成罚款:

I have also discovered that these errors are only thrown when running Configure in cmake-gui. On the command line (running cmake .. from a build folder), the configuration completes fine:

! 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

然而,编译并不总是使用一些库时全成 - 例如参见<一个href=\"http://stackoverflow.com/questions/16449887/boost-problems-when-compiling-point-cloud-library\">this问题我在这里问。因此,我认为有些事情可能仍然在 cmake的过程中走错了。

However, compilation is not always successfull when using some libraries - see for example this question I have asked here. I therefore think something might still be going wrong in the cmake process.

推荐答案

你的问题的一些观察,这可能会导致您的解决方案...

Some observations about your question, which may lead you to a solution...

您正在使用CMake的2.8.2,这是相当古老,据CMake的版本去。与2.8.11尝试还是看即将到来的2.8.12发布候选如果问题仍然存在。如果不出意外,也许你会得到一个更好的错误消息。

You are using CMake 2.8.2, which is fairly old, as far as CMake versions go. Try with 2.8.11 or a release candidate of the upcoming 2.8.12 to see if the problem still exists. If nothing else, perhaps you'll get a better error message.

看到这个问题,答案及链接查看有关保证的命令行环境,并通过Mac上的其他手段发动GUI应用程序之间是一致的路径值的各种方法:<一href=\"http://serverfault.com/questions/16355/how-to-set-global-path-on-os-x/277034\">http://serverfault.com/questions/16355/how-to-set-global-path-on-os-x/277034

See this question and answer and its links to see about the various ways of guaranteeing consistent PATH values between command line environments and gui apps launched via other means on the Mac: http://serverfault.com/questions/16355/how-to-set-global-path-on-os-x/277034

如您在您的终端看,除非你从终端以开放的命令来启动它CMake的GU​​I不一定继承相同的路径值。

The CMake gui does not necessarily inherit the same PATH value as you see in your Terminal, unless you launch it from the Terminal with an open command.

其他两件事情我在这里蹦出来:GCC 4.0是C编译器,但G ++ 4.2是C ++编译器。为什么这些不同?

Two other things pop out at me here: gcc 4.0 is the C compiler, but g++ 4.2 is the C++ compiler. Why are those different?

此外,CMAKE_MAKE_PROGRAM点到/ opt / local / bin目录/ gmake命令。那是在这两个构建树木真的吗? (命令行之一,在GUI呢?)这似乎奇怪,我认为CMake的便拿起从/ usr / bin中的C和C ++编译器,但使用gmake从的/ opt / local / bin目录...

Also, CMAKE_MAKE_PROGRAM points to /opt/local/bin/gmake. Is that true in both of your build trees? (The command line one and the gui one?) It seems curious to me that CMake would pick up the C and C++ compilers from /usr/bin, but gmake from /opt/local/bin...

是您的命令行环境,精心设置了从这些路径使用完全相同这些工具?还是这也是不期而至吗?

Is your command line environment carefully set up to use exactly these tools from these paths? Or is this also unexpected to you?

您不提您所使用的所有的X code工具的版本。也许补充说,您的问题将有助于更好的答案弹出到别人的大脑。

You don't mention what version of the Xcode tools you are using at all. Perhaps adding that to your question will help a better answer pop into someone's brain.

最后一个观察:你在你的PATH了很多东西。尽量减少使用路径值在构建环境将大有帮助你避免这样的问题。我衷心建议剥离下来到最低限度你需要,至少在软件构建环境。

One last observation: you have a lot of stuff in your PATH. Minimizing the PATH value you use in your build environments will go a long way to helping you avoid problems like this. I heartily recommend stripping that down to the bare minimum you need, at least for a software building environment.

对不起,不回答的答案,但有一点似乎评论有点过度了一个堆栈溢出评论...: - )

Sorry for the non-answer answer, but this much commentary seemed a bit excessive for a Stack Overflow comment... :-)

这篇关于OSX下破碎的CMake和gcc的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆