Hello,
I am trying to get geant4.10.02.p03 working with CLHEP 2.3.3.2 on Ubuntu 18.04.3 LTS. I followed the tutorial here: https://indico.tifr.res.in/indico/getFile.py/access?contribId=29&resId=0&materialId=slides&confId=5309, but I had to install some additional packages to the ones listed there to get cmake to build Geant4.
I ran into trouble trying to compile the first example. According to the tutorial, I have edited .bashrc to contain
export CLHEP_DIR=/home/thomas/CLHEP/2.3.3.2/CLHEP-install export CLHEP_INCLUDE_DIR=${CLHEP_DIR}/include/ export CLHEP_LIBRARY=${CLHEP_DIR}/lib/ export LD_LIBRARY_PATH=${CLHEP_LIBRARY}:${LD_LIBRARY_PATH} export PATH=$CLHEP_DIR/bin/:$PATH source /home/thomas/Geant4/geant4.10.02.p03-install/bin/geant4.sh
When I try to build the example with cmake I get the following error:
$ cmake ../B1 -- The C compiler identification is GNU 7.4.0 -- The CXX compiler identification is GNU 7.4.0 -- Check for working C compiler: /usr/bin/cc -- Check for working C compiler: /usr/bin/cc -- works -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Detecting C compile features -- Detecting C compile features - done -- Check for working CXX compiler: /usr/bin/c++ -- Check for working CXX compiler: /usr/bin/c++ -- works -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Detecting CXX compile features -- Detecting CXX compile features - done CMake Error at /usr/share/cmake-3.10/Modules/FindPackageHandleStandardArgs.cmake:137 (message): Could NOT find CLHEP: CLHEP Header Path Not Found CLHEP Library Not Found Incompatible versions, (found) < 2.3.3.2(required) (missing: CLHEP_LIBRARY CLHEP_INCLUDE_DIR) (Required is at least version "2.3.3.2") Call Stack (most recent call first): /usr/share/cmake-3.10/Modules/FindPackageHandleStandardArgs.cmake:378 (_FPHSA_FAILURE_MESSAGE) /home/thomas/Geant4/geant4.10.02.p03-install/lib/Geant4-10.2.3/Modules/FindCLHEP.cmake:297 (find_package_handle_standard_args) /home/thomas/Geant4/geant4.10.02.p03-install/lib/Geant4-10.2.3/Geant4Config.cmake:281 (find_package) CMakeLists.txt:15 (find_package) -- Configuring incomplete, errors occurred! See also "/home/thomas/Geant4/geant4.10.02.p03-install/share/Geant4-10.2.3/examples/basic/B1-build/CMakeFiles/CMakeOutput.log".
I can get it to build if I instead do
$ cmake -DCLHEP_INCLUDE_DIR=/home/thomas/CLHEP/2.3.3.2/CLHEP-install/include/ -DCLHEP_LIBRARY=/home/thomas/CLHEP/2.3.3.2/CLHEP-install/lib/ ../B1 -- Configuring done -- Generating done -- Build files have been written to: /home/thomas/Geant4/geant4.10.02.p03-install/share/Geant4-10.2.3/examples/basic/B1-build
I am confused that cmake cannot find CLHEP_INCLUDE_DIR and CLHEP_LIBRARY. If I then run make I get the following error:
$ make Scanning dependencies of target exampleB1 [ 12%] Building CXX object CMakeFiles/exampleB1.dir/exampleB1.cc.o [ 25%] Building CXX object CMakeFiles/exampleB1.dir/src/B1ActionInitialization.cc.o [ 37%] Building CXX object CMakeFiles/exampleB1.dir/src/B1DetectorConstruction.cc.o [ 50%] Building CXX object CMakeFiles/exampleB1.dir/src/B1EventAction.cc.o [ 62%] Building CXX object CMakeFiles/exampleB1.dir/src/B1PrimaryGeneratorAction.cc.o [ 75%] Building CXX object CMakeFiles/exampleB1.dir/src/B1RunAction.cc.o [ 87%] Building CXX object CMakeFiles/exampleB1.dir/src/B1SteppingAction.cc.o [100%] Linking CXX executable exampleB1 /usr/bin/ld: cannot find /home/thomas/CLHEP/2.3.3.2/CLHEP-install/lib: File format not recognized collect2: error: ld returned 1 exit status CMakeFiles/exampleB1.dir/build.make:295: recipe for target 'exampleB1' failed make[2]: *** [exampleB1] Error 1 CMakeFiles/Makefile2:99: recipe for target 'CMakeFiles/exampleB1.dir/all' failed make[1]: *** [CMakeFiles/exampleB1.dir/all] Error 2 Makefile:129: recipe for target 'all' failed make: *** [all] Error 2
I am very inexperienced with Linux, and I am not sure what this error means or how to fix it. Any help would be greatly appreciated. Thank you.