You are here: Home Software Tips for installing Top++ on Mac OS X

Welcome to my website!

Alexander Mitov

Tips for installing Top++ on Mac OS X

E-mail Print PDF

Here is the approach we have followed; an alternative approach using the Mac supplied GCC compiler is described below.

  1. Install the GCC C++ compiler. An elegant way to do this is to first install the program Fink (can be found here), and then use it to automatically install the compiler. The installation of Fink is trivial. The installation of the compiler by Fink might take few hours but is otherwise quite straightforward. Note that Fink installs the compiler under the name g++-4 to avoid conflict with the C++ compiler that comes with the Mac Developer Tools which is called g++. Top++ will not compile with the latter compiler (however see the alternative installation approach below). Once the GCC compiler is installed and running the user needs to open the file Makefile located in the Top++ directory and change the compiler's name from g++ to g++-4.
  2. Install the GSL library. This is a very straightforward task: first download the library from here, then unpack it in a convenient directory and install it following the instructions. During the installation you might specify as options to the command ./configure the names of the C and C++ compilers that were installed by Fink (./configure CC=gcc-4 CXX=g++-4).
  3. Install the LHAPDF library. It can be downloaded here. Installation is quite simple and similar to GSL described above. Note that the new LHAPDF distributions come without the PDF sets. You'll have to download the ones you want separately. A pdf is a single text file (that can be as large as 100MB!); it can either be saved directly in the appropriate directory or one can use the automated command line script that comes with LHAPDF.
If GSL and LHAPDF are installed in standard locations, the only thing remaining is to install Top++ by typing make in its directory. If the locations of these two libraries are non-standard, one has to adjust the makefile (see the installation instructions in the program's manual). Enjoy!

Added January 12, 2012: An alternative method for running Top++ on a Mac was kindly suggested by Dr. James Ferrando from the University of Glasgow. He reports he was able to run Top++ on a Mac with the g++ compiler from apple (with Xcode 3.2.5) and running Snow Leopard (OS/X 10.6). He provides the following details:
  • feanor% g++ --v
  • Using built-in specs.
  • Target: i686-apple-darwin10
  • Configured with: /var/tmp/gcc/gcc-5664~89/src/configure
  • --disable-checking --enable-werror --prefix=/usr --mandir=/share/man
  • --enable-languages=c,objc,c++,obj-c++
  • --program-transform-name=/^[cg][^.-]*$/s/$/-4.2/ --with-slibdir=/usr/lib
  • --build=i686-apple-darwin10 --program-prefix=i686-apple-darwin10-
  • --host=x86_64-apple-darwin10 --target=i686-apple-darwin10
  • --with-gxx-include-dir=/include/c++/4.2.1
  • Thread model: posix
  • gcc version 4.2.1 (Apple Inc. build 5664)
GSL is installed via Macports (feanor% gsl-config --version 1.14.91) and LHAPDF compiled and installed privately (lhapdf-config --version 5.8.6). The gfortran used to compile lhapdf is from apple, an add-on to xcode (links can be found here). He suggests modification of the Makefile "... in a manner which should generically work on all systems where lhapdf and gsl are correctly installed (irrespective of the location)". Changed the lines for GSLDIR and LHADIR to:
  • GSLDIR = $(shell gsl-config --prefix)
  • LHADIR = $(shell lhapdf-config --prefix)
or, alternatively:
  • CXX = g++
  • GSLDIR = $(shell gsl-config --prefix)
  • LHADIR = $(shell lhapdf-config --prefix)
  • LHAFLAGS=$(shell lhapdf-config --cppflags)
  • GSLFLAGS=$(shell gsl-config --cflags)
  • LHALIBS=$(shell lhapdf-config --ldflags)
  • GSLLIBS=$(shell gsl-config --libs)
  • #CXXFLAGS = -O -I$(GSLDIR)/include -I$(LHADIR)/include
  • LD = $(CXX)
  • SRCS = Utilities.cpp FixedOrder.cpp \
  • PartonicFlux.cpp Resummation.cpp \
  • SubtrFlux.cpp lgamma.cpp top++.cpp psin.cpp
  • OBJS = $(patsubst %.cpp,%.o,$(SRCS))
  • all: top++
Thank you James!
Last Updated ( Thursday, 12 January 2012 09:57 )