This one is strictly work-related.

This is what I used to compile GEANT4 on an RHEL6 computer. Note that first I had to install and compile a new gcc to be able to compile GEANT4.

Also be sure to create /etc/ld.so.conf.d/gcc-4.9.4.conf and add /usr/local/lib and /usr/local/lib64 to it. Then run ldconfig -v.

# tar xzf geant4.10.03.tar.gz
# mkdir geant.4.10.03-build
# # cd geant4.10.03-build/
# cmake3 -DCMAKE_INSTALL_PREFIX=/code/geant4.10.03-rhel6 /code/download/geant4/geant4.10.03/ -DCMAKE_C_COMPILER=/usr/local/bin/gcc -DCMAKE_CXX_COMPILER=/usr/local/bin/g++ -DGEANT4_INSTALL_DATA=ON -DWITH_ANALYSIS_USE=ON
# make -j2
# make install

I also needed to make geant4-9.6.4, here’s the cmake command that I used. The other commands are basically the same. And I think that this probably has the options that I should use by default. (Can leave off specifying the compiler if the default one works.)

#  cmake3 -DCMAKE_INSTALL_PREFIX=/code/geant4.9.6.4 /code/geant4.9.6.4-src -DCMAKE_C_COMPILER=/usr/local/bin/gcc -DCMAKE_CXX_COMPILER=/usr/local/bin/g++ -DGEANT4_INSTALL_DATA=ON -DWITH_ANALYSIS_USE=ON -DGEANT4_USE_OPENGL_X11=ON -DGEANT4_INSTALL_EXAMPLES=ON

For RHEL7 systems, the gcc that comes with it is new enough, so I can leave those tags out.

# cd /code/src/geant4-src/geant4-9.5.2-build
# cmake -DCMAKE_INSTALL_PREFIX=/code/geant4.9.5.2 -DGEANT4_INSTALL_DATA=ON -DWITH_ANALYSIS_USE=ON -DGEANT4_USE_OPENGL_X11=ON -DGEANT4_INSTALL_EXAMPLES=ON ../geant4