Problem building GEANT4 on SL7.8

Hello all!
I was trying to locally install GEANT4 10.6 on Scientific Linux but i have faced a weird issue while building the software…
I have the same problem that is shown here: Error when making geant4. I installed gcc version 8.2 locally (i don’t have any root privileges on my server )
The default version of my gcc was 4.8.2 which is far below the required version. I already set up (locally) gcc 8.2, in fact when typing gcc --version in the terminal the output is gcc 8.2.0, as expected.

However, i don’t get it why the older version is used during the building process…

I would like trying to tell my system to use gcc 8.2 instead of looking and older version of GEANT4 that allows a version <=4.8.2. If you guys have some advises to share, i will appreciate them all.

the flags i used were:

cmake -DCMAKE_INSTALL_PREFIX=/emph/app/ydeniz/GEANT4/geant4.10.6/geant4.10.06-install /emph/app/ydeniz/GEANT4/geant4.10.6/geant4.10.06.p02

cmake -DGEANT4_INSTALL_DATA=ON .

make -j1 VERBOSE=1

i attach a section of the output of the building process that got the errorproblemsbulding.txt (5.0 KB)

What’s the output when running cmake to do the configuration as that will show the compilers picked up. It’s possible (likely) the install of gcc has not created a cc link to gcc which system packages often do, and that’s causing CMake to ignore the custom install. If you’ve confirmed that running:

$ gcc --version
...
$ g++ --version

are the versions you want, then you can run cmake as:

$ CC=gcc CXX=g++ cmake <otherargs>

and it should pick up the right compiler.

@bmorgan sorry for the late reply, but Thank you a lot!!! It works, now i’m trying to run some examples. :grin:

Finally, Just another question… Do i have to add the CC and CXX flags each time i run make or cmake for Geant4!

Cheers, Yael.