Mac os x /usr/bin/gcc file

2019-04-30 05:43发布

问题:

I'm using Mac OS X 10.9 (Mavericks). I recently had to compile code using CMake and OpenMP library. So at first I downloaded XCode Command line tools with xcode-select --install. Here's the problem : XCode uses clang compiler which doesn't bring OpenMP. So I got gcc-4.9 with brew package manager (GCC has the OpenMP library).

It works fine, but the command to use it is gcc-4.9 and CMake calls the cc command. So I searched, and found out that /usr/bin/cc was a symbolic link to /usr/bin/clang. I decided to change it to /usr/bin/gcc, but here's the problem : I don't know what this file is...

It looks like the clang command file : if I run it without any argument, I get the clang error instead of a gcc error :

$ gcc
clang: error: no input files
$ gcc-4.9
gcc-4.9: fatal error: no input files
compilation terminated.

But it isn't a symbolic link... Here's the result of a ls -l command :

-rwxr-xr-x   1 root   wheel     14224 23 oct 07:40 gcc

(seems like it was created when I did the Mavericks upgrade) And it's exactly the same thing for g++. Is it a sort of copy of clang, with a different name ? Why isn't Apple using a symbolic link ?

So if anyone here knows if I can delete these files to put a symbolic link instead without any problem (or a better solution), let me know !

Thanks :)