Geant4.5.2 / CLHEP1.8 /

on MacOSX

Note

Geant4.5.2 finally compiles without any patch as long as you use MacOS 10.2 :-).
We have not tried on MacOS 10.3 because we don't have the environment.
Prease care the version of gcc, older one may not work well.
To check your version of gcc, type

% gcc -v

In any case, you need to install the rpm command beforehand since a binary
executable of DAWN is only available as a RPM package.
Note also that DAWN requires X11. Also latest version of gcc is available from
HEP on X page by Keisuke Fujii.

Note that, STEP library is not compiled by default from verson4.5.2.
To build it, an environment variable G4LIB_BUILD_STEP must be set
before compilation.
We didn't try this option, however,
we suppose gcc2.95.2 compiles
STEP library correctly at least.

All patches have been tested on my machine but may not work on your platform.
Install them thus at your own risk.

If you have questions, send mail here. Don't ask Geant4 Official developers.

Spec

Machines

Macintosh PowerBookG4 500MHz Memory 512MB
Macintosh G4 dual 800MHz Memory 1GB

OS MacOSX10.2.5 / kernel : Darwin 6.5
Development
environment
gcc-with-g77-1175-1a
X11 (You can obtain it from Apple's home page.)

 

How to install

  1. Install CLHEP1.8
    Choose your compiler at first. You must use SAME compiler between
    CLHEP and Geant4.

    A) gcc2.95.2

    You can get a binary tarball of CLHEP1.8.00 from here.

    B) gcc3.1
    The binary and source packages are available from RPM and SRPM, respectively.
    Typing

    % rpm -ivh clhep-1.8.0.0-1b.ppc.rpm

    installs the binary rpm under /usr/local.

  2. Get Geant4.4.2 source files and patches
    The original source tarball is here.

  3. Expand the tarball
    Move the source tarball and the patches to a directory of your convenience, then in that directory, type

    % gnutar -zxvf geant4.5.2.gtar.gz
    % ln -s geant4.5.2 pro

    Geant4 requires an environmental variable called G4INSTALL be set to the top directory of the Geant4 package.
    In our case, G4INSTALL will be <your convenient directry>/pro.

    % export G4INSTALL=<your convenient directry>/pro

  4. Modify configure file IF YOU USE GCC3.1
    Geant4 will be compiled by gcc2.95.2 by default.
    To use gcc3.1, modify G4INSTALL/config/sys/Darwin-g++.gmk

    % cd $G4INSTALL/config/sys/

    modify Darwin-g++.gmk as following:

    ifeq ($(G4SYSTEM),Darwin-g++)
    # choice of GNU compilers:
    # CXX := g++2
    CXX := g++3

    CXXFLAGS := -Wall -ansi -pedantic -pipe
    # optionally add verbose flag
    # CXXFLAGS += -v


  5. Define environmental variables
    Add the following lines to ~/.bashrc.

    ##### Geant4 general setting ####
    export G4SYSTEM=Darwin-g++
    export G4USE_STL=1
    export G4INSTALL=$HOME/work/G4/pro ###(or your convenient directry)
    #export CLHEP_BASE_DIR=/usr/local ###(/usr/local is included in the default search path. )
    export G4DATA=$G4INSTALL/../share/data
    export G4LEVELGAMMADATA=$G4DATA/PhotonEvaporation

    ###### 2. UI

    ############ 2-1. Selection of (G)UI in installation of libraries
    export G4UI_BUILD_TERMINAL_SESSION=1
    export G4UI_BUILD_GAG_SESSION=1

    ############ 2-2. Selection of (G)UI in compiling executables
    export G4UI_USE_TERMINAL=1
    export G4UI_USE_GAG=1

    ###### 3. Visualization
    export G4VRMLFILE_VIEWER=vrwave

    ############ 3-1. Home directory of Mesa
    export OGLHOME=/usr/X11R6

    ############ 3-2. Selection of visualization drivers
    # in installation of libraries
    export G4VIS_BUILD_DAWNFILE_DRIVER=1
    export G4VIS_BUILD_OPENGLX_DRIVER=1
    export G4VIS_BUILD_VRMLFILE_DRIVER=1

    ############ 3-3. Selection of visualization drivers
    # in compiling executables
    export G4VIS_USE_DAWNFILE=1
    export G4VIS_USE_OPENGLX=1
    export G4VIS_USE_VRMLFILE=1

    ############ Selection of viewer
    export GVRMLFILE_VIEWER=vrwave

    ########### image file directry ##############
    export G4DAWNFILE_DEST_DIR=./images/dawn/
    export G4VRMLFILE_DEST_DIR=./images/vrml/

  6. Build Geant4
    Type

    % source ~/.bashrc
    % cd $G4INSTALL/source
    % unset G4OPTIMISE
    % make >& make.log &
    % tail -f make.log

    !!!ATTENTION!!!
    We have experienced some anomalous behavior for some of our application programs linked to Geant4 libraries compiled with optimization ("-O").
    The problem disappeared when the entire Geant4 libraries had been recompiled without any optimization ("-O0").
    We have not yet identified exactly which source files should be compiled without optimization.
    For the moment, therefore, using any nonzero optimization level for Geant4 compilation is not recommended on MacOS X.
    Swich off the optimization by typing
    unset G4OPTIMISE
    our putting this line into your ~/.bashrc.


    If you see following messages, you can quit tail by ctrl + C.

    Reading dependency files...
    Checking for circular dependencies...
    Reordering according to dependencies...
    Writing new library map file...


  7. Install data files
    Expand data files under $G4DATA.

    % cd $G4DATA
    % gnutar -zxvf G4NDL3.7.tar.gz
    % gnutar -zxvf G4EMLOW1.1.tar.gz
    % gnutar -zxvf G4PhotonEvaporation.2.0.tar.gz
    % gnutar -zxvf G4RadiactiveDecay.3.0.tar.gz

  8. Install Dawn-3_85d-1a (if you need)
    Get the binary package. (RPM)(SRPM)
    Typing

    % rpm -ivh dawn-3_85d-1a.ppc.rpm

    installs dawn under /usr/local.

  9. Install Dawncut-1_51a-1a (if you need)
    Get the binary package. (RPM)(SRPM)
    Typing

    % rpm -ivh dawncut-1_51a-1a.ppc.rpm

    installs dawn under /usr/local.


HOME