How to set C++ compiler outside Macports?

Jeremy Huddleston Sequoia jeremyhu at macports.org
Sat Jul 28 22:43:33 PDT 2012


On Jul 28, 2012, at 21:35, Ian Wadham <iandw.au at gmail.com> wrote:

> 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:
> https://trac.macports.org/ticket/34605?replyto=1#comment
> 
> 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.

Why are you using /usr/bin/c++?  Just use /usr/bin/clang++ (or 'xcrun clang++' if you didn't install the command line tools).

> 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.


> Thanks in advance, Ian W.


--Jeremy


More information about the macports-users mailing list