1

Recently I updated my Mac's XCode and Command Line tools to version 6.4 (I'm running on OSX Yosemite 10.10.5). After I did that change, to install a new package with MacPorts, I was forced to run a "port selfupdate". However, after I did that, something broke in my system. Particularly, the usual port select gcc does not display the apple compilers installed with XCode. It only displays:

Available versions for gcc: mp-gcc48 none (active) 

I have to say that, trying to solve a compilation problem (that's how I found out the issue), I uninstalled one or two mp-gcc versions. However, I remember that the apple versions should have been listed there.

To make sure the apple compilers are installed: running the command xcode-select --install displays the following:

xcode-select: error: command line tools are already installed, use "Software Update" to install updates

and xcode-select -p displays the following:

/Applications/Xcode.app/Contents/Developer

So, the compilers are there. My ~/.profile file contains the following line:

MacPorts Installer addition on 2013-05-13_at_00:53:37: adding an appropriate PATH variable for use with MacPorts. export PATH=/opt/local/bin:/opt/local/sbin:$PAT 

But, indeed, that's the usual change made my MacPorts.

Does anyone knows what is happening? I need to work with the apple compiler without destroying the MacPorts environment.

Thanks in advance!

EDIT: thanks for the nice answers, so indeed none is the system's (xcode) installation for macport. For the record, I tried to select the macports gcc and then none, to see if there was a broken link and indeed this happened:

sudo port select gcc mp-gcc48 Selecting 'mp-gcc48' for 'gcc' failed: symlink: /opt/local/etc/select/gcc/current -> mp-gcc48: file already exists 

After I manually deleted /opt/local/etc/select/gcc/current, the port select gcc command worked well and setting sudo port select gcc none worked well after that.

3
  • Is this the compiler you want to use for your projects or for compiling Macports ports themselves? Commented Aug 25, 2015 at 7:30
  • It is for usage with my projects. I want to leave the Macports environment as is. Commented Aug 25, 2015 at 8:29
  • I would recommend simply using CC=clang in your Makefiles (or whatever), or explicitly using /usr/bin/clang. Commented Aug 25, 2015 at 9:39

1 Answer 1

1

The port select gives you the option to select a MacPorts compiler for the command gcc, or to sudo port select gcc none, which then uses the system compiler.

I.e., the option you are looking for is now called "none". This makes sense, since MacPorts cannot know what the system compiler is, or even if one is installed. It may be clang or gcc depending on the version of XCode. Note that on newer versions of XCode/OSX, there is no gcc, only clang, and gcc/g++ are links to clang/clang++.

EDIT: This is now the same for all available "port groups". For example on my system the following configuration is active:

port select --summary Name Selected Options ==== ======== ======= clang none mp-clang-3.7 none cython cython34 cython27 cython34 none db none db46 db48 none gcc none mp-gcc47 mp-gcc49 mp-gcc5 none ipython ipython34 ipython27 ipython34 none llvm none mp-llvm-3.5 mp-llvm-3.7 none mysql none mysql56 none nosetests none nosetests27 nosetests34 none pip pip34 pip34 none python python34 python26-apple python27 python27-apple python34 none python2 python27 python26-apple python27 python27-apple none python3 none python34 none sphinx py34-sphinx py27-sphinx py34-sphinx none wxWidgets none wxWidgets-3.0 none 

For instance, if I want to switch back to the system default python, I say

sudo port select python none 

and for python3 (for which there is no system default), I say

sudo port select python3 none 
Sign up to request clarification or add additional context in comments.

6 Comments

This is different to how Macports does it with python, where the apple version is selectable explicitly. Installing clang via Macports doesn't give the option to select apple-clang either.
I just clarified my answer. Indeed, this is now the way it is done for all port groups, i.e., also python, clang, etc. You always port select <portgroup> none to select the system default. For python, it seems python27-apple is left for some reason. Don't know why.
I see python26-apple and python27-apple in your list (same for me), which is confusing...
Ah, yes, you are right. To be precise, there are python26-apple, python27-apple and none. So none falls back to the system default, which is /usr/bin/python, while python26-apple selects /usr/bin/python2.6 and python27-apple selects /usr/bin/python2.7 (both of which are symlinks to /System/Library/Frameworks/Python.framework/...
Agreed. That makes sense; Macports can handle multiple versions of a program provided by Apple.
|

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.