Refresher on gcc port and the executables

Ryan Schmidt ryandesign at macports.org
Wed May 22 05:17:19 PDT 2013


On May 22, 2013, at 05:25, Tabitha McNerney wrote:

> Its been some time since I looked more deeply at the GCC ports. On a new Mac recently I installed MacPorts and then specifically installed gcc47 into my port prefix path /opt/local
> 
> I looked today and realized there are several binaries (in /opt/local/bin), such as:
> 
> gcc-ranlib-mp-4.7
> gcc-nm-mp-4.7
> gcc-mp-4.7
> gcc-ar-mp-4.7
> g++-mp-4.7
> 
> and:
> 
> x86_64-apple-darwin12-gcc-ranlib-mp-4.7
> x86_64-apple-darwin12-gcc-nm-mp-4.7
> x86_64-apple-darwin12-gcc-mp-4.7
> x86_64-apple-darwin12-gcc-ar-mp-4.7
> x86_64-apple-darwin12-gcc-4.7.2
> x86_64-apple-darwin12-g++-mp-4.7
> 
> I forgot what the difference means in the above examples. If I want to compile some C or C++ code without any help from Apple's tools (for example the way I might do on a Linux system), would I simply use the top list (gcc* and g++*) and avoid the bottom list (x86*)?

Yes.


> I also have Xcode installed on this Mac and for some code to compile I do not want to use Apple's gcc bundled with Xcode. So given the above, do I need to use gcc_select and if so any suggestions on how best to do so? 

Note that Xcode 4.2 and later do not include any version of gcc. However if you install the command line tools (which you must do in order to use MacPorts) then /usr/bin/gcc does exist, as a symlink to llvm-gcc-4.2. I assume as of Xcode 4.7 it will change to a symlink to clang, since it has already been announced that Xcode 4.6 is the last version that will include llvm-gcc.

If you want "gcc" to be a MacPorts compiler instead, use "sudo port select gcc" (which was several years ago known as "gcc_select"). You can learn more about how to use "port select" by running "port help select".



More information about the macports-users mailing list