Segmentation fault (core dumped) running a own program

Dear experts,

I have recently started with Geant4 and I am trying to run a very simple program that I created. It consists in a world with low density and Cs-137 ions created at the center with zero velocity (I am interested in analyzing the electron spectrum of the beta decays). The program had before the classes: DetectorConstruction, PhysicLists, RunAction, EventAction, ActionInicialization and PrimaryGeneratorAction. To create it I used as reference the basic examples and it worked very well but I implemented the SteppingAction class to obtain some information of the decays CMakeLists.txt (2.4 KB) task1.cc (1.6 KB) and I obtain now the error “Segmentation fault (core dumped)”.

I am using Ubuntu 20.04.2 LTS and geant4-10-07-patch-01. You can find all the files that I am using attached.

I did a debug using gdb and I obtain the following information:

diego@diego-HP-Laptop-15-bs0xx:~/GEANT4/Examples/Task1/task1-build$ gdb task1
GNU gdb (Ubuntu 9.2-0ubuntu1~20.04) 9.2
Copyright © 2020 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later http://gnu.org/licenses/gpl.html
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type “show copying” and “show warranty” for details.
This GDB was configured as “x86_64-linux-gnu”.
Type “show configuration” for configuration details.
For bug reporting instructions, please see:
http://www.gnu.org/software/gdb/bugs/.
Find the GDB manual and other documentation resources online at:
http://www.gnu.org/software/gdb/documentation/.

For help, type “help”.
Type “apropos word” to search for commands related to “word”…
Reading symbols from task1…
(No debugging symbols found in task1)
(gdb) run
Starting program: /home/diego/GEANT4/Examples/Task1/task1-build/task1
[Thread debugging using libthread_db enabled]
Using host libthread_db library “/lib/x86_64-linux-gnu/libthread_db.so.1”.


Geant4 version Name: geant4-10-07-patch-01 (5-February-2021)
Copyright : Geant4 Collaboration
References : NIM A 506 (2003), 250-303
: IEEE-TNS 53 (2006), 270-278
: NIM A 835 (2016), 186-225
WWW : http://geant4.org/


Program received signal SIGSEGV, Segmentation fault.
0x00007ffff78a6592 in G4EventManager::SetUserAction(G4UserSteppingAction*) () from /home/diego/GEANT4/geant4.10.07/lib/libG4event.so
(gdb) bt
#0 0x00007ffff78a6592 in G4EventManager::SetUserAction(G4UserSteppingAction*) () from /home/diego/GEANT4/geant4.10.07/lib/libG4event.so
#1 0x00007ffff7944fa9 in G4RunManager::SetUserAction(G4UserSteppingAction*) () from /home/diego/GEANT4/geant4.10.07/lib/libG4run.so
#2 0x000055555555b119 in main ()

I am trying to find the error comparing with the examples that Geant4 provides but until now I can’t know anything. I would really appreciate if someone could help me in any way.

Thanks in advance for your time!

Best regards,

Diego Mendoza

EventAction.cc (1.1 KB) RunAction.cc (2.5 KB) DetectorConstruction.cc (1.2 KB) PrimaryGeneratorAction.cc (1.7 KB) PhysicsList.cc (511 Bytes) ActionInitialization.cc (812 Bytes) SteppingAction.cc (1.9 KB) CMakeLists.txt (2.4 KB) task1.cc (1.6 KB)

You have attached 9 files that need to be downloaded to try to reproduce your problem locally: it would be so much easier for others to help you if you provided these in some publicly accessible VC repository (e.g. on GitHub). Failing that, packaging them up in a single tarball or zip archive would help. Furthermore, it turns out to be far more than 9 files …

Your CMakeLists.txt requires init_vis.mac, run1.mac and vis.mac, but these are missing, so cmake fails.

If I hack around that problem, then make fails, because you didn’t provide the header files.

It wouldn’t be too difficult to reverse engineer your header files, but … well … it’s too much effort on my lunch break :slight_smile:

Could you please point us at a GitHub repo (or tarball) with everything in it? Preferably after you’ve cloned (or unpacked) it into say, /tmp and checked that it really does contain everything needed to reproduce your problem!