[Gate-users] Workaround for compiling Gate on OS X 10.8 Mountain Lion

Marc Chamberland MarcChamberland at cmail.carleton.ca
Wed Sep 5 02:50:59 CEST 2012

Hi Gate Users!

Always one to bite the bullet, I eagerly downloaded Gate v6.2 and tried to compile it on OS X 10.8 Mountain Lion with the default compiler on the system (llvm-gcc 4.2).

However, I ran into the problems described in this previous message: http://article.gmane.org/gmane.comp.science.opengate.user/1923/

The compilation failed with some of these errors:

Entering source/arf ...
Compiling GateARFTableMgr.cc ...
In file included from src/GateARFTableMgr.cc:13:
In file included from ../arf/include/GateARFTableMgrMessenger.hh:27:
../general/include/GateUIcmdWithAVector.hh:124:22: error: no matching
constructor for initialization of 'std::ostringstream' (aka
  std::ostringstream os(st,100);
                     ^  ~~~~~~
/usr/include/c++/4.2.1/sstream:436:7: note: candidate constructor not
viable: no known conversion from 'int' to 'ios_base::openmode' (aka
'std::_Ios_Openmode') for 2nd argument
      basic_ostringstream(const __string_type& __str,

However, I have a workaround for those who experience these issues. I was able to compile and run Gate v6.2 successfully by recompiling Geant4 9.5.p01 and Gate v6.2 with the regular "flavour" of gcc and not the llvm one included in Mountain Lion.

I simply installed gcc 4.2 using Macports (macports.org; search for the port called apple-gcc42) and added the following line to the very beginning of the two CMakeLists.txt files found in the Geant4 and Gate folders, respectively:

SET(CMAKE_CXX_COMPILER "/opt/local/bin/g++-apple-4.2")

With this line, cmake will use the compiler prescribed above (change to the appropriate location on your system).

I have validated my Gate installation with the benchmarks and everything seems to work fine.

I hope this helps!


Marc Chamberland, MSc
PhD candidate
Department of Physics
Carleton University
Ottawa (ON)

More information about the Gate-users mailing list