¿Cómo ejecuto gcc en la línea de comandos después de instalar Xcode 4.2 en Mac OS X 10.6?

It would appear that installing Xcode 4.2 on my Mac OS X 10.6 machine has effectively remoto gcc. In place of the binaries, there are now symlinks like so:

/usr/bin drarok$ ls -la | grep gcc
lrwxr-xr-x     1 root   wheel        32 13 Oct 14:27 cc -> ../llvm-gcc-4.2/bin/llvm-gcc-4.2
lrwxr-xr-x     1 root   wheel        12 13 Oct 14:24 gcc -> llvm-gcc-4.2
lrwxr-xr-x     1 root   wheel        12 12 Sep 16:15 gcc-4.2 -> /usr/bin/gcc
...

So "gcc-4.2", despite looking like gcc of old, results in an llvm binary being executing.

Is there still a way to run gcc on my Mac?

Nota: Soy no looking to configure my Xcode to use gcc - this has been covered in other SO questions. I have some command-line tools that must be built with reales. gcc. My Cocoa projects all work with llvm.

preguntado el 08 de noviembre de 11 a las 13:11

1 Respuestas

I understand your pain. I still have gcc installed somehow:

[/usr/bin]:;ls -la | egrep gcc
lrwxr-xr-x     1 root   wheel          32 Oct 15 00:33 cc -> ../llvm-gcc-4.2/bin/llvm-gcc-4.2
lrwxr-xr-x     1 root   wheel          12 Oct 15 00:30 gcc -> llvm-gcc-4.2
-rwxr-xr-x     1 root   wheel       97392 Oct 24  2010 gcc-4.0
-rwxr-xr-x     1 root   wheel      166128 Feb 11  2011 gcc-4.2
lrwxr-xr-x     1 root   wheel          28 Oct 15 00:30 gcov-4.2 -> ../llvm-gcc-4.2/bin/gcov-4.2
-rwxr-xr-x     1 root   wheel      369696 Oct 24  2010 i686-apple-darwin10-gcc-4.0.1
-rwxr-xr-x     1 root   wheel      816560 Feb 11  2011 i686-apple-darwin10-gcc-4.2.1
lrwxr-xr-x     1 root   admin          52 Oct 15 00:30 i686-apple-darwin10-llvm-g++-4.2 -> ../llvm-gcc-4.2/bin/i686-apple-darwin10-llvm-g++-4.2
lrwxr-xr-x     1 root   admin          52 Oct 15 00:30 i686-apple-darwin10-llvm-gcc-4.2 -> ../llvm-gcc-4.2/bin/i686-apple-darwin10-llvm-gcc-4.2
lrwxr-xr-x     1 root   admin          32 Oct 15 00:30 llvm-cpp-4.2 -> ../llvm-gcc-4.2/bin/llvm-cpp-4.2
lrwxr-xr-x     1 root   admin          32 Oct 15 00:30 llvm-g++ -> ../llvm-gcc-4.2/bin/llvm-g++-4.2
lrwxr-xr-x     1 root   admin          32 Oct 15 00:30 llvm-g++-4.2 -> ../llvm-gcc-4.2/bin/llvm-g++-4.2
lrwxr-xr-x     1 root   admin          32 Oct 15 00:30 llvm-gcc -> ../llvm-gcc-4.2/bin/llvm-gcc-4.2
lrwxr-xr-x     1 root   admin          32 Oct 15 00:30 llvm-gcc-4.2 -> ../llvm-gcc-4.2/bin/llvm-gcc-4.2
-rwxr-xr-x     1 root   wheel      373792 Oct 24  2010 powerpc-apple-darwin10-gcc-4.0.1
-rwxr-xr-x     1 root   wheel      820496 Feb 11  2011 powerpc-apple-darwin10-gcc-4.2.1
[/usr/bin]:;./gcc-4.2 -v
Using built-in specs.
Target: i686-apple-darwin10
Configured with: /var/tmp/gcc/gcc-5666.3~123/src/configure --disable-checking --enable-werror --prefix=/usr --mandir=/share/man --enable-languages=c,objc,c++,obj-c++ --program-transform-name=/^[cg][^.-]*$/s/$/-4.2/ --with-slibdir=/usr/lib --build=i686-apple-darwin10 --program-prefix=i686-apple-darwin10- --host=x86_64-apple-darwin10 --target=i686-apple-darwin10 --with-gxx-include-dir=/include/c++/4.2.1
Thread model: posix
gcc version 4.2.1 (Apple Inc. build 5666) (dot 3)

But this may be because I also have XCode 3 tools installed?

In any event, check out this very fancy Open Source project:

https://github.com/kennethreitz/osx-gcc-installer

Which I found in this related question: GCC sin Xcode en OS X

contestado el 23 de mayo de 17 a las 13:05

Spot on, that installer gave me i686-apple-darwin10-gcc-4.2.1 (GCC) 4.2.1 (Apple Inc. build 5666) (dot 3). Just recompiled and ran an iOS project to double-check Xcode was happy, too. - Drarok

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.