Having issues running example B1

user@user-HP-630-Notebook-PC:~/software/geant4/geant4-v11.1.1/examples/basic/B1/build$ make install
[ 12%] Building CXX object CMakeFiles/exampleB1.dir/exampleB1.cc.o
[ 25%] Building CXX object CMakeFiles/exampleB1.dir/src/ActionInitialization.cc.o
[ 37%] Building CXX object CMakeFiles/exampleB1.dir/src/DetectorConstruction.cc.o
[ 50%] Building CXX object CMakeFiles/exampleB1.dir/src/EventAction.cc.o
[ 62%] Building CXX object CMakeFiles/exampleB1.dir/src/PrimaryGeneratorAction.cc.o
[ 75%] Building CXX object CMakeFiles/exampleB1.dir/src/RunAction.cc.o
[ 87%] Building CXX object CMakeFiles/exampleB1.dir/src/SteppingAction.cc.o
[100%] Linking CXX executable exampleB1
[100%] Built target exampleB1
Install the project…
– Install configuration: “Release”
– Installing: /home/user/software/geant4/geant4-v11.1.1/examples/basic/B1/build-install/bin/exampleB1
– Set runtime path of “/home/user/software/geant4/geant4-v11.1.1/examples/basic/B1/build-install/bin/exampleB1” to “”

Try to use (make) instead of make install!

I have actually used that but the executable file for example B1 is not displaying which shows i can’t run it after the (make)

Usually it goes like this once you already made make and make install for geant4
cd

mkdir build

cd build

cmake …

make

./

similar to mine just given me headache for the past 3week

The error still persist?

What are you trying to do after the make step? I can’t see the example being executed, so what output do you get when trying to do that?

user@user-HP-630-Notebook-PC:~/software/geant4/geant4-v11.1.1/examples/basic/B1/build$ make
Consolidate compiler generated dependencies of target exampleB1
[ 12%] Building CXX object CMakeFiles/exampleB1.dir/exampleB1.cc.o
[ 25%] Building CXX object CMakeFiles/exampleB1.dir/src/ActionInitialization.cc.o
[ 37%] Building CXX object CMakeFiles/exampleB1.dir/src/DetectorConstruction.cc.o
[ 50%] Building CXX object CMakeFiles/exampleB1.dir/src/EventAction.cc.o
[ 62%] Building CXX object CMakeFiles/exampleB1.dir/src/PrimaryGeneratorAction.cc.o
[ 75%] Building CXX object CMakeFiles/exampleB1.dir/src/RunAction.cc.o
[ 87%] Building CXX object CMakeFiles/exampleB1.dir/src/SteppingAction.cc.o
[100%] Linking CXX executable exampleB1
/usr/bin/ld: /home/user/software/geant4/geant4-v11.1.1/build/BuildProducts/lib/libG4run.so: undefined reference to G4UnitsTable::Synchronize()' /usr/bin/ld: /home/user/software/geant4/geant4-v11.1.1/build/BuildProducts/lib/libG4run.so: undefined reference to G4Threading::G4SetPinAffinity(int, unsigned long&)’
/usr/bin/ld: /home/user/software/geant4/geant4-v11.1.1/build/BuildProducts/lib/libG4RayTracer.so: undefined reference to _G4cerr_p()' /usr/bin/ld: /home/user/software/geant4/geant4-v11.1.1/build/BuildProducts/lib/libG4intercoms.so: undefined reference to _G4cerrbuf_p()’
/usr/bin/ld: /home/user/software/geant4/geant4-v11.1.1/build/BuildProducts/lib/libG4Tree.so: undefined reference to _G4cout_p()' /usr/bin/ld: /home/user/software/geant4/geant4-v11.1.1/build/BuildProducts/lib/libG4intercoms.so: undefined reference to _G4coutbuf_p()’
collect2: error: ld returned 1 exit status
make[2]: *** [CMakeFiles/exampleB1.dir/build.make:238: exampleB1] Error 1
make[1]: *** [CMakeFiles/Makefile2:84: CMakeFiles/exampleB1.dir/all] Error 2
make: *** [Makefile:136: all] Error 2
@bmorgan @SimpungaElias

so when you run
./exampleB1

what is the output?

As that function is only available when Geant4 is build with multithreading enabled, I would guess that the build is picking up no-multithreaded Geant4 libraries from somewhere other than /home/user/software/geant4/geant4-v11.1.1/build/BuildProducts/lib.

Do you have DYLD_LIBRARY_PATH and/or LD_LIBRARY_PATH set in your environment, or any similar ...LIBRARY_PATH env vars? If so, do they contain paths where there is another Geant4 install present?

thanks so much sir the problem has been resolve.
please i will like to have a hint on how to compile advance example, i still have problem on that. most especially x-ray Fluoroscopic. please a guide @bmorgan @SimpungaElias

The advanced examples are mostly built in exactly the same way as the basic ones (and X-ray fluorescence certainly is), so the same process you used to build and execute B1 can be used. This is covered in this section of the Application Developer’s Guide.

If that doesn’t help, then please post the error messages you’re getting as we can’t help without seeing those.

user@user-HP-630-Notebook-PC:~/software/geant4/geant4-v11.1.1/examples/advanced/xray_fluorescence/build$ ./XrayFluo


Geant4 version Name: geant4-11-01-patch-01 (10-February-2023)
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/


Please Select Simulation Geometrical Set-Up:
1 - Test Beam
2 - Infinite Plane
3 - Planet and Sun
4 - Phase-Space Production
1
XrayFluoAnalysisManager created
G4NistMaterialBuilder::FindOrBuildMaterial WARNING: material is not found.
G4NistMaterialBuilder::FindOrBuildMaterial WARNING: material is not found.
G4NistMaterialBuilder::FindOrBuildMaterial WARNING: material is not found.
G4NistMaterialBuilder::FindOrBuildMaterial WARNING: material is not found.
G4NistMaterialBuilder::FindOrBuildMaterial WARNING: material is not found.
G4NistMaterialBuilder::FindOrBuildMaterial WARNING: material is not found.
G4Material WARNING: duplicate name of material Dolorite
G4NistMaterialBuilder::FindOrBuildMaterial WARNING: material is not found.
G4NistMaterialBuilder::FindOrBuildMaterial WARNING: material is not found.
G4NistMaterialBuilder::FindOrBuildMaterial WARNING: material is not found.
G4NistMaterialBuilder::FindOrBuildMaterial WARNING: material is not found.
G4NistMaterialBuilder::FindOrBuildMaterial WARNING: material is not found.
G4NistMaterialBuilder::FindOrBuildMaterial WARNING: material is not found.
G4NistMaterialBuilder::FindOrBuildMaterial WARNING: material is not found.
G4NistMaterialBuilder::FindOrBuildMaterial WARNING: material is not found.
G4NistMaterialBuilder::FindOrBuildMaterial WARNING: material is not found.
G4NistMaterialBuilder::FindOrBuildMaterial WARNING: material is not found.
G4NistMaterialBuilder::FindOrBuildMaterial WARNING: material is not found.
G4NistMaterialBuilder::FindOrBuildMaterial WARNING: material is not found.
G4NistMaterialBuilder::FindOrBuildMaterial WARNING: material is not found.
G4NistMaterialBuilder::FindOrBuildMaterial WARNING: material is not found.
G4NistMaterialBuilder::FindOrBuildMaterial WARNING: material is not found.

no any diagram of HpGe was displayed sir. my question is that are they other necessary code that will be added before it display an image. because i am currently working on gamma radiation shielding of glassing containing some samples of element.

Apologies for the delay in replying - I don’t think those warnings are related to the problem of visualisation. Do you get any other output, and if so what are the last few lines printing? Also, did you compile Geant4 with support for any visualisation drivers, and if so which ones?


This what was obtain in the examples as stated previously after selecting option 4. no geometry.

O.k., but in the first post, option “1” was selected, and there should be more output to the terminal (even if the GUI starts up) where the program was started after all of the G4NistMaterialBuilder... output.

Pinging @guatelli and @ivana for their info and guidance on this example.

also having this issue in trying to construct my own detector.

user@user-HP-630-Notebook-PC:~/HPGe_simulation/build$ make
[ 50%] Linking CXX executable HPGe_simulation
/usr/bin/ld: CMakeFiles/HPGe_simulation.dir/HPGe_simulation.cc.o: in function main': HPGe_simulation.cc:(.text+0x7b): undefined reference to DetectorConstruction::DetectorConstruction()’
/usr/bin/ld: HPGe_simulation.cc:(.text+0xc0): undefined reference to PhysicsList::PhysicsList()' /usr/bin/ld: HPGe_simulation.cc:(.text+0x12d): undefined reference to ActionInitialization::ActionInitialization()’
collect2: error: ld returned 1 exit status
make[2]: *** [CMakeFiles/HPGe_simulation.dir/build.make:142: HPGe_simulation] Error 1
make[1]: *** [CMakeFiles/Makefile2:83: CMakeFiles/HPGe_simulation.dir/all] Error 2
make: *** [Makefile:136: all] Error 2

@SimpungaElias please really need your help regarding my previous question. I’m trying to build a detector by having error at the final state. Thanks

As I see the problem is within linking, try to define well physicalists and link them with other codes files

Hello,

To get geometry drawn, please, change the first line in vis.mac:

/vis/open

with

/vis/open OGL

and then, execute this macro in your session window:

/control/execute vis.mac

The specification of the visualization driver is needed, because this example creates visualization manager before creating UI session, and in this case, G4VisExecutive fails to detect a suitable visualization driver. This issue will be fixed in the next patch, and then the vis.mac will work also without this modification.