Switching the order of the GLIBS etc did not change anything. However I was able to solve this issue for the Mac OSX 10.10 and 10.8. It appears that the issue is related back to the -stdlib=libc++ in g++. So using the tip you gave previously
The default compiler for building ROOT on MacOS 10.10 is clang. The default standard library is libc++.
One cannot use clang with libc++ to build ROOT and then build some more libraries (that are meant to be used with the ROOT libraries) with GCC, as to my knowledge GCC does not support -stdlib=libc++.
Instead, either configure ROOT as --with-cc=gcc --with-cxx=g++ --with-ld=g++ plus you might need to also pass --with-gcc-toolchain=directory-where-gcc-is-installed
or, much simpler, use the binary compatible clang instead of GCC when building your code.
Any manipulation of the output of root-config --cflags to “make it compile” (especially the removal of -stdlib=libc++ or -std=c++11) will produce incompatible object files that will likely / hopefully cause linker errors.
Is there any consensus how to resolve this issue successfully now? I recently ran into this problem too:
g++: error: unrecognized command line option ‘-stdlib=libc++’
My makefile is like:
%%%%%%%%%
CXX=g++
HOME=/Users/…
ROOTINC=-I$(HOME)/include/
ROOTLIBS=root-config --glibs
all: try
try: try.cc
$(CXX) -o try try.cc $(ROOTINC) $(ROOTLIBS)
%%%%%%%%%
It works fine with root 5.43 on earlier version of OS X (now I’m on Yosemite 10.10.3). I tried newer version root 6 and updated Xcode, still has the same problem.