This is really annoying. For some reason, on MacOS X 10.11 (probably also on previous versions) there are gcc
and g++
commands (in /usr/bin
, they are not aliases or so) which, when executed with the -v
argument, give:
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/include/c++/4.2.1
Apple LLVM version 7.0.2 (clang-700.1.81)
Target: x86_64-apple-darwin15.2.0
Thread model: posix
So it looks like they actually execute the clang and clang++ compilers by apple. Now, I really need my computer to execute gcc and g++ when I invoke those commands, both from the terminal and through makefiles.
The reasons for this are two:
- I like to have my computer do what I ask it to do.
- Apparently clang++ compiles stuff using a different c++ standard library from g++, and this is causing me problems when I compile and link my stuff with
g++-5
(the ACTUAL g++, installed via homebrew) against CppUnit.
Does anybody know what is the best way to have gcc
and g++
actually call gcc and g++?