How to set C++ compiler outside Macports?

Ian Wadham at
Sat Jul 28 21:35:58 PDT 2012

I think I have got to the bottom of the problem I have been having
when I tried to compile and build some of my own source code, but
linking to the kdelibs4 @4.8.2_0 library from Macports.  See:

The question now is "What is the best thing to do about it?".  The
Macports logs tell me that kdelibs4 has been compiled with clang.

KDE embeds this knowledge in some CMake macros it generates.

In a Linux installation, that is fine because you will use the same
compiler both for building KDE and for doing your own development.
There is not a lot of choice.

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.

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?

Thanks in advance, Ian W.

More information about the macports-users mailing list