So I am still using Ubuntu Gutsy and wanted to install the new version of geant4, which has migrated from is old build system to using CMake. I suppose this is long over due (as anyone knows who tried to build it 4 years ago). Here is what I had to do.
CMake upgrade to 2.8
First I needed to upgrade my version of CMake from their website and remove the old one.
wajig purge cmake
wget http://www.cmake.org/files/v2.8/cmake-2.8.7.tar.gz
# then follow install instructions for cmake
Geant4 – First build attempt
Almost … I get the following error
…
[ 81%] Building CXX object source/processes/CMakeFiles/G4processes.dir/transportation/src/G4UserSpecialCuts.cc.o
[ 81%] Building CXX object source/processes/CMakeFiles/G4processes.dir/transportation/src/G4VTrackTerminator.cc.o
Linking CXX shared library ../../outputs/library/Linux-g++/libG4processes.so
Error running link command: Argument list too long
make[2]: *** [outputs/library/Linux-g++/libG4processes.so] Error 2
make[1]: *** [source/processes/CMakeFiles/G4processes.dir/all] Error 2
make: *** [all] Error 2
Looks like there is just too many shared libraries in the compiling command! To see how bad it is check out the output
Googling… results in finding a similar error
As a user recommends I will try appending cmake flags (although this is not ideal)
-DBUILD_SHARED_LIBS=OFF -DBUILD_STATIC_LIBS=ON
Geant4 – Second build attempt
Thinking it might be my old install, I commented all my geant4 settings from by previous install in my .bashrc file.
Using the command
cmake -DCMAKE_INSTALL_PREFIX=/path/to/geant4.9.5-install /path/to/geant4.9.5 -DBUILD_SHARED_LIBS=OFF -DBUILD_STATIC_LIBS=ON
we are not building the shared libraries (only the static). Need to find a fix for this. I think it is just my old kernel…
…
[ 98%] Building CXX object source/physics_lists/CMakeFiles/G4physicslists-static.dir/lists/src/MaxTimeCuts.cc.o
[ 98%] Building CXX object source/physics_lists/CMakeFiles/G4physicslists-static.dir/lists/src/MinEkineCuts.cc.o
[100%] Building CXX object source/physics_lists/CMakeFiles/G4physicslists-static.dir/lists/src/QBBC.cc.o
[100%] Building CXX object source/physics_lists/CMakeFiles/G4physicslists-static.dir/lists/src/SpecialCuts.cc.o
[100%] Building CXX object source/physics_lists/CMakeFiles/G4physicslists-static.dir/lists/src/G4PhysListUtil.cc.o
Linking CXX static library ../../outputs/library/Linux-g++/libG4physicslists.a
[100%] Built target G4physicslists-static
Success!
My conclusion is that I cannot build the shared libraries because of my old system. If you know how to get around this please let me know.