2

I need to compile ROOT with gcc/g++. I am having difficulty with the objective C libraries.

If I link a true g++ (installed with brew) to the command gg++ and the same for gcc -> ggcc - I can start to compile with

$ cmake ../ -DCMAKE_CXX_COMPILER=gg++ -DCMAKE_C_COMPILER=ggcc <the rest of my options>

The compilation gets about 70% done before it gives me an error that "Option '-O' takes an integer argument". I tracked this down. In 'root/core/macosx/CMakeLists.txt', there is a line

set_source_files_properties(${sources} COMPILE_FLAGS "-ObjC++ -std=c++11")

So g++ is not recognizing the Objective C flag. I've changed this line to

set_source_files_properties(${sources} COMPILE_FLAGS "-x objective-c++-header -lobjc -std=c++11")

Which is the g++ equivalent. I've also tried -x objective-c++. This attempt fails at around 70% with hundreds of errors. It basically looks like the compiler does not understand the Objective C++.

Has anyone had success in compiling ROOT from source with g++ on OSX (not clang)?

PS - As a side note, I believe g++ in /usr/bin on OSX is actually a link to clang - verified on my machine by typing g++ --version. This is why I installed g++ from brew and linked it to gg++.


  • ROOT Version: Github Master branch, commit # 2762a32
  • Platform: OSX
  • Compiler: GCC 8.1.0
slm
  • 363,520
  • 117
  • 767
  • 871
ahagen
  • 121
  • 1
  • why not install it with brew, assuming this root is your root: https://formulae.brew.sh/formula/root – thrig Jul 30 '18 at 20:19
  • Long story short - I'd like to use GEANT4 compiled with gcc because GEANT4 compiled with clang can't use a radioactive decay library I need. I have to install all the libraries that GEANT4 needs, compiled with gcc in that case. HepMC is one of those libraries, which uses ROOT. I get errors when I link ROOT (from brew/compiled with clang) to HepMC while compiling HepMC with gcc. That root, from brew, does work by itself though. Thanks! – ahagen Jul 30 '18 at 20:22

0 Answers0