Build MarlinJava on Linux or MacOS X

Most of the instructions below were taken but slightly changed from the Marlin documenation.

What we assume you have

What you need (or was used)

  • SWIG 1.3.29
  • gsl 1.8
  • lcio v01-08-vtx
  • gear v00-03
  • CLHEP 1.9.2.3
  • CERNLIB
  • Root 5.12
  • MarlinUtil v00-02
  • MarlinReco v00-02
  • Marlin v00-09-05
  • PandoraPFA (included in MarlinJava)

Installation Procedure

Execute in the following order:

MarlinJava

Check out the latest Marlin Java wrapper from svn using:

svn co svn://svn.freehp.org/svn/sandbox/MarlinJava

The rest of the installation goes in the MarlinJava directory, run the setup there:

cd MarlinJava
source setup.sh

Gnu Scientific Library

Download gsl from the GNU ftp site. Then run the following:

tar zxvf gsl-1.8.tar.gz
cd gsl-1.8
./configure --prefix=<marlinpath>/gsl
make
make install
cd ..
rm gsl/lib/libgsl.dylib gsl/lib/libgsl.so
rm gsl/lib/libgslcblas.dylib gsl/lib/libgslcblas.so

CLHEP

Download CLHEP from the distribution and untar it with the following command:

mkdir clhep
tar -C clhep -zxvf clhep-xxxxx.tgz
rm clhep/lib/libCLHEP.dylib clhep/lib/libCLHEP.so

LCIO

Check out the lcio code using

cvs -d :pserver:anonymous@cvs.freehep.org:/cvs/lcio co -r v01-08-vtx lcio
cd lcio
tools/ant aid cpp f77
cd ..

CERNLIB

Make sure you have CERNLIB. We link with /cern/2003.

MacOS X
Go to Hep on MacOSX and install the binary packages. Do not use the 10.4 stuff as it is compiled with gfortran rather than g77.

ROOT

Make sure you have root and that "root-config" is available in your PATH.

Gear

Download gear from Marlins CVSWeb and run:

tar zxvf gear.tar.gz
cd gear
tools/ant aid.generate
[Linux] tools/ant cpp
[MacOS X] make -C src/cpp
cd ..
MacOS X
Problems about /lib non existing can be ignored.

MarlinUtil, MarlinReco, PandoraPFA and Marlin

Download the above mentioned versions of MarlinUtil, MarlinReco and Marlin from Marlins CVSWeb and run:

tar zxvf Marlin.tar.gz
tar zxvf MarlinReco.tar.gz
tar zxvf MarlinUtil.tar.gz

In the Marlin directory add the following file with name "userlib.gmk"

USERINCLUDES += -I$(MARLIN)/packages/MarlinUtil/include
USERINCLUDES += -Df2cFortran
USERINCLUDES += -I$(MARLINJAVA)/gsl/include

USERLIBS += -L/cern/2003/lib/ -lmathlib -lkernlib
USERLIBS += -lg2c
USERLIBS += -L$(MARLINJAVA)/gsl/lib -lgsl -lgslcblas

Make symbolic links to the MarlinReco and MarlinUtil packages

cd Marlin
mkdir packages
cd packages
ln -s ../../MarlinReco
ln -s ../../MarlinUtil
ln -s ../../PandoraPFA
cd ..
MacOS X ONLY

Add the line

#define stat64 stat

to the file lcio/src/cpp/include/LCIOTypes.h just before "namespace EVENT".

Link f77 to g77:

(as root)
ln -s /usr/local/bin/g77 /usr/local/bin/f77

Add

#include <cmath>

to the files

  • include/marlin/Global.h
  • packages/MarlinReco/TrackDigi/VTXDigi/src/MyG4UniversalFluctuationForSi.cc

Remove XMLParser:: (line 166) in include/marlin/XMLParser.h.

Remove MarlinCED:: (line 61, 69 and 73) in packages/MarlinUtil/include/MarlinCED.h

Remove the space between the -L and the identifier and remove the option "-Wl,-whole-archive" and "-Wl,-no-whole-archive" in the following files:

GNUmakefile (identifier MARLINLIB)
src/GNUmakefile (identifier LIBS in several places)
Linux and MacOS X

Change private into public

  • include/marlin/Processor.h, line 188

Then run

make clean (to get rid of the Linux .a file in PandoraPFA).
make

to create lib/libMarlin.a and the other libraries.

MarlinJava

In the top-level (MarlinJava) directory to re-create the SWIG generated files (not necessary as these are included in check out of SVN):

mvn -Dswig.force=true

To compile the Java files, the C++ files and to link with all the libraries to produce a working system, type:

mvn

Run the example

To run the example type:

ExampleVTX.sh