How to set C++ compiler outside Macports?

Ian Wadham iandw.au at gmail.com
Sat Jul 28 23:35:58 PDT 2012


On 29/07/2012, at 3:43 PM, Jeremy Huddleston Sequoia wrote:
> On Jul 28, 2012, at 21:35, Ian Wadham <iandw.au at gmail.com> wrote:
>> In my Mac OS X environment, /usr/bin/c++ is a symbolic link to
>> llvm-g++-4.2, but I need it to be to the same compiler as Macports
>> used to build kdelibs4.  Then I can compile and link my own code
>> correctly with that library and continue developing and testing my
>> source code for the next release of KDE.
> 
> Why are you using /usr/bin/c++?  Just use /usr/bin/clang++ (or 'xcrun clang++' if you didn't install the command line tools).

It's not that simple.  I never use a compiler directly, just CMake initially,
including all the KDE macros and dependencies, then "make" on later
runs.  CMake picks up /usr/bin/c++, by default, but could no doubt be
made to do something else.

>> For the moment, I have found that "brute force" linking of /usr/bin/c++
>> to clang works fine, but is there a safer way?  Is there, for example,
>> some way (e.g. a script or command) to extract from Macports the
>> compiler it used and make it a symbol in my own builds?
> 
> You can look at the build logs to see what compiler is used, but on anything recent will be using clang.

By default, Macports does not leave logs behind.  I was looking perhaps for
some Macports cache or config file where compiler assignments are kept
for each port or for ports in general, but have been unable to find any.

Is use of clang now official Macports policy?  Last I heard on this list, a
few months back, its use was experimental.

Cheers, Ian W.



More information about the macports-users mailing list