Installing rootv6.04/08 on Mac OSX 10.10 with gcc/g++ and NOT clang

Hello ROOTers,

I am trying to install ROOT (v6.04/08) on my Mac (running OSX Yosemite 10.10.5) in order to run some analysis software written by a collaborator.

I have installed both ROOT (v06.04/08) and gcc (v5.2) via Macports, where the gcc --version output is below:

gcc (MacPorts gcc5 5.2.0_0) 5.2.0 Copyright (C) 2015 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

However, when I try running his makefile I run into the following error:

g++ -O3 `root-config --cflags` -Wno-write-strings -Wno-deprecated -c -I/Users/laffoley/Applications/actar_analysis_IPNO/inc/ -IlibMFM -o /Users/laffoley/Applications/actar_analysis_IPNO/lib/MVisu.o -g /Users/laffoley/Applications/actar_analysis_IPNO/src/MVisu.cpp g++: error: unrecognized command line option '-stdlib=libc++' make: *** [/Users/laffoley/Applications/actar_analysis_IPNO/lib/MVisu.o] Error 1
where the output of root-config --cflags is:

-pthread -stdlib=libc++ -std=c++11 -m64 -I/opt/local/libexec/root6/include/root

I did some digging around and found others with similar issues (see [url]G++: unrecognized ‘-stdlib=libc++’ [osx10.10, root6] where the problem is the fact that Macports compiles ROOT with clang rather than gcc. Rather than messing with the output of root-config --cflags (as advised) I decided to download the ROOT binaries for v06.04/08 and ran:

in order to compile it with gcc/g++ rather than clang/clang++. I also discovered that I needed to make sure that the cocoa flag was disabled as it ONLY works with clang. So, I made sure to edit the configure file from:

enable_cxx11=yes enable_cxx14=no enable_libcxx=no enable_cocoa= enable_afs=no ...
to

enable_cxx11=yes enable_cxx14=no enable_libcxx=no enable_cocoa=no enable_afs=no ...
and reran the configure file. This worked perfectly fine, but when trying to make ROOT I now run into the following problem:

root-6.04.08/sql/sqlite/inc/TSQLiteServer.h /Users/laffoley/Desktop/root-6.04.08/sql/sqlite/inc/TSQLiteStatement.h /Users/laffoley/Desktop/root-6.04.08/sql/sqlite/inc/LinkDef.h g++ -m64 -std=c++11 -pipe -Wshadow -W -Wall -Woverloaded-virtual -fsigned-char -fno-common -Iinclude -pthread -I/opt/local/include -MMD -MP -I. -o sql/sqlite/src/G__SQLite.o -c sql/sqlite/src/G__SQLite.cxx g++ -dynamiclib -single_module -Wl,-dead_strip_dylibs -install_name @rpath/libRSQLite.so -O2 -DNDEBUG -m64 -mmacosx-version-min=10.10 -o lib/libRSQLite.so sql/sqlite/src/TSQLiteResult.o sql/sqlite/src/TSQLiteRow.o sql/sqlite/src/TSQLiteServer.o sql/sqlite/src/TSQLiteStatement.o sql/sqlite/src/G__SQLite.o -ldl -Llib -lCore -Llib -lNet -lRIO -L/opt/local/lib -lsqlite3 ==> lib/libRSQLite.so done g++ -O2 -DNDEBUG -m64 -std=c++11 -pipe -Wshadow -W -Wall -Woverloaded-virtual -fsigned-char -fno-common -Iinclude -pthread -MMD -MP -o net/bonjour/src/TBonjourBrowser.o -c /Users/laffoley/Desktop/root-6.04.08/net/bonjour/src/TBonjourBrowser.cxx In file included from /usr/include/os/object.h:27:0, from /usr/include/dispatch/dispatch.h:48, from /usr/include/dns_sd.h:129, from include/TBonjourBrowser.h:48, from /Users/laffoley/Desktop/root-6.04.08/net/bonjour/src/TBonjourBrowser.cxx:33: /usr/include/os/base.h:113:20: error: missing binary operator before token "(" #if __has_extension(attribute_overloadable) ^ /usr/include/os/base.h:119:54: error: missing binary operator before token "(" #if __has_feature(objc_fixed_enum) || __has_extension(cxx_strong_enums) ^ In file included from /usr/include/dispatch/dispatch.h:51:0, from /usr/include/dns_sd.h:129, from include/TBonjourBrowser.h:48, from /Users/laffoley/Desktop/root-6.04.08/net/bonjour/src/TBonjourBrowser.cxx:33: /usr/include/dispatch/object.h:325:20: error: missing binary operator before token "(" #if __has_extension(c_generic_selections) ^ /usr/include/dispatch/object.h:363:20: error: missing binary operator before token "(" #if __has_extension(c_generic_selections) ^ /usr/include/dispatch/object.h:391:20: error: missing binary operator before token "(" #if __has_extension(c_generic_selections) ^ /usr/include/dispatch/object.h:423:20: error: missing binary operator before token "(" #if __has_extension(c_generic_selections) ^ /usr/include/dispatch/object.h:143:15: error: expected unqualified-id before '^' token typedef void (^dispatch_block_t)(void); ^ /usr/include/dispatch/object.h:143:15: error: expected ')' before '^' token /usr/include/dispatch/object.h:362:3: error: 'dispatch_block_t' has not been declared dispatch_block_t notification_block); ^ make: *** [net/bonjour/src/TBonjourBrowser.o] Error 1

My question is: am I running down a hopeless path? Is trying to install ROOT on a Mac machine without using clang fruitless? Or is there some way to have ROOT working so that I can try getting my analysis code to work (which is no guarantee once this process is completed).

Thanks in advance for all your help!
Alex

[quote]My question is: am I running down a hopeless path? Is trying to install ROOT on a Mac machine without using clang fruitless? Or is there some way to have ROOT working so that I can try getting my analysis code to work (which is no guarantee once this process is completed).
[/quote]
We are not currently supporting non-native compilers for MacOSX. It is already rather difficult to follow Apple with all the changes they do continuously that mixing with GCC will not be easy.
Having said that I would give a try with CMake. We certainly cannot continue the development for that classic configure/make
You can try to configure with CMake with the compiler full path

-DCMAKE_CC_COMPILER=`which gcc` \
-DCMAKE_CXX_COMPILER=`which g++`

on a clean area, and see what fails…