9.4.p03

G4 now builds with CMake

Windows Visual Studio 2008 (9)

  1. Download the source from the G4 website
  2. ungzip and untar the source using GNU's gzip and tar for windows
  3. Start up a DOS command window
  4. Run C:\Program Files\Microsoft Visual Studio 9\Common\Tools\vsvars32.bat
  5. Start up cmake-gui
  6. Point "Where is the source code" at the G4 source
  7. Create a separate build directory and point "Where to build binaries" at that location
  8. Click Configure - you will likely get errors
  9. Location of CLHEP needs to be set up
    1. Click "Add Entry"  CLHEP_INCLUDE_DIR, type "PATH", and point to the location of the include files.
    2. It is not clear if CLHEP_INCLUDE_DIRS is the new term, so I also define this as well.
    3. Click "Add Entry" CLHEP_LIBRARIES, type FilePATH and point to the actual CLHEP.lib file
    4. Do the same for CLHEP_LIBRARY as it is also not clear if this is needed as well.
    5. Click "Add Entry" and define CLHEP_ROOT_DIR as PATH
    6. Click "Add Entry" and define CLHEP_VERSION_OK as a BOOL and check it (this seems to be a bug, it seems we shouldn't have to do this)
    7. Click "Add Entry" and define GEANT4_USE_SYSTEM_CLHEP as BOOL and check 
    8. Click "Add Entry" and define CMAKE_INSTALL_PREFIX as PATH and point it to the location you desire for the G4 installed binaries.
    9. There doesn't seem to be a way to set G4VERBOSE or not via CMake
  10. Click Configure again
    1. actually looks like CLHEP_INCLUDE_DIR, CLHEP_LIBRARY, CLHEP_ROOT_DIR, and GEANT4_USE_SYSTEM_CLHEP are not needed
  11. Click Generate
  12. Open the solution file in Visual Studio
  13. Update all the static library projects to use /MDd for the multi-threaded debug library (there doesn't seem to be a way to set that via CMake in this version of G4)
    http://hypernews.slac.stanford.edu:5090/HyperNews/geant4/get/installconfig/1436/1.html
  14. Choose ALL_BUILD and build
  15. Choose Install and build

9.4.p01

The bug in 8.0.p01's G4ParticleDefinition.cc is fixed in 9.4, so no modification to the source is required.

Windows 2008

Building Geant4.8.0.p01 Using the Native Compilation Script

Unpack the G4 source, and you will find the Configure script in the top-level directory.

You could set the environment variable G4_NO_VERBOSE in the hopes of improving performance, though to date those improvements have not fully materialized, in fact as of G4 version 8.0.p01, a code modification (see updated G4ParticleDefinition.cc which is attached) is required to prevent the setting of G4_NO_VERBOSE from skipping important code in G4.  Tracy has patched this and it is included in our 8.0.p01-gl4 version of G4, located in $GLAST_EXT/srcExtLibs/geant4.8.0.01-gl4-src.tar.gz

Make sure to install the header files into a single common directory.

Logs of the build are stored in the .config directory

Some interesting things...  the library libG4parameterisations is the product of Tracy's CMT requirements used to build G4 rather than the native G4 build scripts.  G4 calls this same library libG4parmodels

libG4visualizations is the product of Riccardo's addition to the CMT requirements file:  http://www.fisica.uniud.it/~glast/MRStudio/Geant4vis.html

libG4g3tog4 is natively called libG4G3toG4

8.0.p01-gl4

We must use CLHEP 1.9.2.2 to build this version of Geant4 - there are incompatible changes in later versions of CLHEP (even 1.9.4.2).

redhat4-i686-32bit-gcc34

  1. Obtain the source from /afs/slac/g/glast/ground/GLAST_EXT/srcExtlibs/geant4-8.0.p01-gl4-src.tar.gz and unpack a geant4.8.0.p01 directory will be created.
  2. Enter the geant4.8.0.p01 directory and locate the Confgure script
  3. setenv G4_NO_VERBOSE 1
  4. Create a directory named "data"
  5. Run ./Configure -build
    1. OS: Linux Compiler:  g++
    2. Expect to run these binaries on multiple machines:  y
    3. You'll answer where the source is located
    4. Take default for where to install the libraries
    5. Copy all headers into one directory
    6. Store data in data directory
    7. Accept default directories
    8. Provide the locagtion of CLHEP
      Base Directory:  $GLAST_EXT/CLHEP/1.9.2.2/gcc34
    9. Build shared libraries
    10. Build static libraries too
    11. Build global libraries
    12. Do not build granular libraries
    13. Do not build in DEBUG
    14. G4UI_NONE  accept default n
    15. G4UI_BUILD_XAW_SESSION  accept default n
    16.  G4UI_BUILD_XM_SESSION  accept default n
    17.  G4VIS_NONE  accept default n
    18. G4VIS_BUILD_OPENGLX_DRIVER  accept default n
    19. G4VIS_BUILD_OPENGLXM_DRIVER  accept default n
    20. G4VIS_BULID_DAWN_DRIVER  accept default n
    21. G4VIS_BUILD_OIX_DRIVER  accept default n
    22. G4VIS_BUILD_RAYTRACERXX_DRIVER  Set to Yes
    23. G4VIS_BUILD_VRML_DRIVER  Set to Yes
    24. G4LIB_BUILD_G3TOG4   Set to Yes
    25. G4LIB_BUILD_ZLIB   Set to Yes
    26. G4ANALYSIS_USE  Accept default n
  6. Run ./Configure -install
  7.  In the lib/Linux-g++ directory:
    1. rename libG3toG4.* to libG4g3tog4.*
    2. rename libparmodels.* to libparameterisations.*
  8. Copy the following directories to the $GLAST_EXT/redhat4-i686-32bit-gcc34/geant4/8.0.p01-gl4/gcc34 directory
    include    lib
  9. Copy the tables directory from an existing Geant4 8.0.p01 installation in $GLAST_EXT, such as $GLAST_EXT/redhat4-i686-32bit-gcc34/gcc34/tables

Windows VS2008

  1. Install cygwin, if you do not already have it.
    Include gcc-g77 in the installation
    You may need to install an older version of "make"
    Rename the link.exe to link_cyg.exe, so it will not be used.  See:  http://geant4.web.cern.ch/geant4/support/windows_note.shtml
  2. Obtain and build CLHEP 1.9.2.3 (the source for 1.9.2.2 no longer seems to be available)
  3. Obtain the source from /afs/slac/g/glast/ground/GLAST_EXT/srcExtlibs/geant4-8.0.p01-gl4-src.tar.gz and unpack a geant4.8.0.p01 directory will be created.
  4. In a DOS command window, set up to use VS 2008:
    1. set PATH=
    2. set LIB=
    3. set INCLUDE=
    4. Run C:\Program Files\Microsoft Visual Studio 9.0\Common\Tools\vsvars32.bat
    5. set LIB=C:\Program Files\Microsoft SDKs\Windows\v6.0A\Lib;%LIB%
    6. set PATH=C:\WINNT\system32;C:\WINNT;C:\WINNT\System32\Wbem;C:\Program Files\Microsoft SDKs\Windows\v6.0A\bin;%PATH%
    7. set INCLUDE=C:\Program Files\Microsoft SDKs\Windows\v6.0A\Include;include;%INCLUDE%
  5. Start up a cygwin session:
    cd cygwin/bin
    bash --login -i
  6. Enter the directory containing your G4 source code
  7. Set the G4_NO_VERBOSE flag
    export G4_NO_VERBOSE=1
  8. set CLHEP_LIB to CLHEP.lib (avoid trouble building shared libraries)
    export CLHEP_LIB=CLHEP.lib
  9. Create a data directory in the top-level of the G4 source
  10. Run G4's Configure script
    ./Configure -build
    1. OS: WIN-VC
    2. Expect to run these binaries on multiple machines:  y
    3. You'll answer where the source is located
    4. Take default for where to install the libraries
    5. Copy all headers into one directory
    6. Store data in data directory
    7. Accept default directories
    8. Provide the location of CLHEP
      Base Directory:  $GLAST_EXT/CLHEP/1.9.2.3
      1. and double-check the setting of CLHEP_LIB
    9. Do not Build shared libraries - lwe haven't been able to use them with GR for some time
    10. Build static libraries
    11. Do not build in DEBUG
    12. G4UI_NONE  accept default n
    13. G4UI_BUILD_XAW_SESSION  accept default n
    14.  G4UI_BUILD_XM_SESSION  accept default n
    15.  G4VIS_NONE  accept default n
    16. G4VIS_BUILD_OPENGLX_DRIVER  accept default n
    17. G4VIS_BUILD_OPENGLXM_DRIVER  accept default n
    18. G4VIS_BULID_DAWN_DRIVER  accept default n
    19. G4VIS_BUILD_OIX_DRIVER  accept default n
    20. G4VIS_BUILD_RAYTRACERXX_DRIVER  Set to Yes
    21. G4VIS_BUILD_VRML_DRIVER  Set to Yes
    22. G4LIB_BUILD_G3TOG4   Set to Yes
    23. G4LIB_BUILD_ZLIB   Set to Yes
    24. G4ANALYSIS_USE  Accept default n
  11. After the build is complete, do ./Configure -install
    This should copy al the headers to the top level include directory
  12. Rename all the *.a static libraries to *.lib
  • No labels