aMC@NLO compilation issues on MAC OS X (only up to v2.1.1)

Created by marco zaro
Keywords:
compiler fastjet cuttools MAC MACOS
Last updated by:
marco zaro

NOTE: from v.2.1.2 this FAQ does not apply any longer, as aMC@NLO can now be compiled with gfortran and the mac c++ compiler (clang) without having to install and select the gnu c(++) compiler

Many users have reported compilation problems occurring when aMC@NLO is compiled on a computer with MAC OS X or after an update of the MAC OS X operating system.

The problem may look related to FastJet, as some errors like

>>>>>Undefined symbols for architecture x86_64:
>>>>> "std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::compare(char const*) const",
>>>>> referenced from:
>>>>> fjcore::ClusterSequence::print_jets_for_root(std::__1::vector<fjcore::PseudoJet, std::__1::allocator<fjcore::PseudoJet>
>>>>> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&,
>>>>> std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) const in fjcore.o

appear to the screen.

These error are consequence of an incorrect configuration of the compilers.
Please note that XCode has to be installed on the computer, with the "Command line tools" enabled (the "Command line tools" can be installed with the "xcode-select --install" command).

In particular if one installs v4.6 or later of the GNU compilers (gcc / gfortran / g++) using e.g. MacPorts, what one typically gets is that while gfortran correctly points to the newly installed compiler, gcc does not (this can be checked with "gfortran --version" and "gcc --version").
Over the internet there are many forums explaining how to select the newly installed gcc/g++ compiler as default, for example the instruction related to an installation done using MacPorts can be found at this link

http://stackoverflow.com/questions/8361002/how-to-use-the-gcc-installed-in-macports

Please note that after the update of the system/compilers one has to recompile CutTools and the FastJet installation on his computer.
The recompilation of FastJet should be straightforward.
In order to recompile CutTools one has to go in the "vendor/CutTools" directory (which is inside the MG5_aMCNLO main dir)
and type

make clean
make