Errors during compilation using old Geant4 versions

Hello, yesterday my supervisor said me the path to use Geant4 installed on the computer hosted in the laboratory that is faster than a normal computer so I should get simulation in lower time.
Unfortunately, even if my simulation is compiled and runned without error on my computer (Geant4 10.06 and VS2019 compiler) when we tried (together) to compile my simulation on this computer by ssh connection, we got this error

i.e. the CMake is obsolete.
So I tried to use older Geant4…but for example, by using Geant4 10.2 I get this error

Geant 10.3

I also tried to compile the original exampleB1 (I mean the one downoladed by Geant4 website)
but it doesn’t work too

Maybe, does the exampleB1 included in Geant4 10.6 work just on Geant4 10.6 and doesn’t it work by using older version than Geant4 10.6?

Going back with Geant4 versions is not a solution, you need anyway new cmake and also gcc. Examples are released with each G4 version, and of course they evolve with the G4 code, you’d need to check the example provided with a particular version of G4 instead of the latest one.
I don’t know the details of the machine you attempt to run it on, but since you have access to cvmfs try the following:

  1. First use newer gcc, type:
    source /cvmfs/
  2. Use appropriate version of G4, e.g.:
    source /cvmfs/
  3. Substitute cmake with cmake3 in your build command (if it’s installed)
    otherwise try substituting cmake with /cvmfs/

Thank you @anna it worked by using the comand


but when I compile I get these warnings (I don’t get them when I compile on my computer)

I understand there are unused variables/parameters. Are they important?

Moreover, yesterday my supervisor said me to run in this way


nohup ./exampleB1 ../run1.mac &

he said me to write nohup so that I can close my terminal during the running but this command didn’t work.

Does it depend on this cmake /cvmfs/ ?

Thank you

Warning suggest you can clean-up the code, but it’s not critical.

I’m not sure what you mean that the suggested command does not work (and it certainly has no connection to the build system - cmake). It seems it does work, have a look inside nohup.out file to see the output (as you see printed in the terminal).

Thank you @anna, you are right the nohup works! Two last question please.

  1. During the compiling it says that solidEndv2 is unesed variable, but it is my second target, because in DetectorConstruction I wrote




then I call the fScoringVolume2 in the SteppingAction, for example

then, it isn’t unused variable!..Why does it say unused?

  1. Is there in /cvmfs ROOT too? or just Geant4?

Thank you

solidEnv2 certainly is unused. Look at the highlighted line in the screenshot you posted. In particular, look at the last character just before the comma.

We often see what we expect to see; I frequently have this problem debugging my own code.

Yes. See /cvmfs/

Thank you @mkelsey

You are right! I’d to debug this line


but it’s strange…Given that I wrote

new G4LogicalVolume(solidEnv, //its solid

instead of

new G4LogicalVolume(solidEnv2, //its solid

why did I get different released energy, etc in the two targets by writing

if (volume == fScoringVolume) {


if (volume == fScoringVolume2) {

they should have been identical…or not?

you see…I tried so much command but the didn’t work…what should I write?

Moreover, Do I’ve to upload the macro here




I found this working version of ROOT (unfortunately it’s an old version)


so I tried it and it works

but when I try to upload my macro on


I can’t do it…so where should I upload my macro?

  1. If your two volume the same size and shape (i.e., solidEnv and solidEnv2 are equivalent), then you don’t need them to be separate. You can use the same solid multiple times in different LVs. You can even use a single LV for multiple placements.

  2. You don’t “upload” your personal macros into directories on CVMFS. You use the software on CVMFS to run your personal macros in your own personal directories.

If you are not familiar with how to configure and use ROOT, I strongly recommend reading the documentation from, before posting questions to the ROOT forums.

Thank you @mkelsey

I’m able to use ROOT, but I always used it on my computer! I never used id on CVMF!

[quote=“mkelsey, post:9, topic:2968, full:true”]

You don’t “upload” your personal macros into directories on CVMFS. You use the software on CVMFS to run your personal macros in your own personal directories. [/quote]

I uploaded the macro in my personal directory and now I can run it! There is just a “problem”. When I run a ROOT macro on my computer, I see the Canvas during the run and he prints the name of the pdf file created (step by step). I runned the macro on cvmf but I don’t see anything

and when the run end it prints all the names of the cavas created. Isn’t there a way to see the canvas during the run (just to know which step it is doing ? Maybe it depends on the warning

*** DISPLAY not set, setting


But I connected by ssh -Y

Yes, the “DISPLAY not set” error is the key here. Do you have X11 running on your local Windows machine? I don’t use Windows, and this is not a Geant4 issue, so you will need to look for information elsewhere on how to run an XWindows server on your machine.

Once you have that working, then the ssh -Y command is correct, and you should be able to launch a TBrowser or do other graphical stuff with ROOT (as well as getting visualization with G4).

thank you @mkelsey !