[英]Installing scikit: gcc-4.2 not found, using Clang instead
When trying to install scikit on my Mac (OS X Lion) I stumbled upon this error: 当我试图在我的Mac(OS X Lion)上安装scikit时,我偶然发现了这个错误:
gcc-4.2 not found, using clang instead.
找不到gcc-4.2,而是用clang代替。
I searched how to fix this and it seems that the environment variable CC is not correctly set. 我搜索了如何解决这个问题, 似乎没有正确设置环境变量CC。 My question now is, how can I change this and to what do I have to change this?
我现在的问题是,我怎样才能改变这个以及我有什么要改变它? In my
/usr/lib/
I do see the g++, gcc, llvm-g++-4.2 and llvm-gcc-4.2 executables. 在我的
/usr/lib/
我确实看到了g ++,gcc,llvm-g ++ - 4.2和llvm-gcc-4.2可执行文件。 Also when I check env
I don't see the CC variable. 当我检查
env
我没有看到CC变量。 Even when I try to export CC=gcc I don't see it with the env
command. 即使我尝试导出CC = gcc,我也没有用
env
命令看到它。
There are multiple ways of doing this: 有多种方法可以做到这一点:
If you are using make
to compile the sources, use the following command: 如果使用
make
编译源代码,请使用以下命令:
make CC=/path/to/gcc CXX=path/to/g++ make CC=/path/to/gcc CXX=path/to/g++ install etc.
You could permanently change your default compilers by: 您可以通过以下方式永久更改默认编译器:
cd /usr/bin rm cc c++ gcc g++ ln -s gcc-4.2 cc ln -s gcc-4.2 gcc ln -s c++-4.2 c++ ln -s g++-4.2 g++
You should also give clang
a try, though - it's not bad at all, and in many cases is known to produce equivalent or better-optimized programs than gcc
. 你应该尝试一下
clang
- 虽然它并不坏,并且在许多情况下已知产生与gcc
相当或更好的程序。
If scikits is explicitly looking for gcc-4.2, it sounds like it's hardcoded in the setup procedure (bad idea imo). 如果scikits 明确地寻找gcc-4.2,听起来它在设置过程中是硬编码的(坏主意imo)。
I would then just go for the symlink solution; 然后我会选择符号链接解决方案; a bit different than my comment or Ramneek's answer, but pretty much the same:
与我的评论或Ramneek的答案略有不同,但几乎相同:
sudo ln -s /usr/bin/llvm-gcc-4.2 /usr/bin/gcc-4.2
gcc
and such shouldn't be in /usr/lib/
, but (also) in /usr/bin/
. gcc
等不应该在/usr/lib/
,而且(也)在/usr/bin/
。 The ones in /usr/lib/
are subdirectories, the ones in /usr/bin/
are the executables. /usr/lib/
中的子目录是子目录, /usr/bin/
中的子目录是可执行文件。
It may very well be that you have the libraries in those subdirectories, but not the actual executables and header files. 很可能你在这些子目录中有库,但不是实际的可执行文件和头文件。
Have you installed the command-line tools during your XCode installation? 您是否在XCode安装期间安装了命令行工具?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.