Unable to execute example B1

Geant4 Version: 10.5.1
Operating System: Ubuntu 24.04 noble
Compiler/Version: gcc4.8.5
CMake Version: 3.28.3

Hello, I’m a new user of Geant4 and am trying to get the various examples to run. I think it’s a problem with the default visualizations, I’m using OpenGL. When I open a build directory in example B1 and do
cmake …/
make
./exampleB1
it gives the following output

**************************************************************
 Geant4 version Name: geant4-10-05-patch-01    (17-April-2019)
                       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/
**************************************************************

<<< Reference Physics List QBBC 
Visualization Manager instantiating with verbosity "warnings (3)"...
Visualization Manager initialising...
Registering graphics systems...

You have successfully registered the following graphics systems.
Current available graphics systems are:
ASCIITree (ATree)
DAWNFILE (DAWNFILE)
G4HepRep (HepRepXML)
G4HepRepFile (HepRepFile)
RayTracer (RayTracer)
VRML1FILE (VRML1FILE)
VRML2FILE (VRML2FILE)
gMocrenFile (gMocrenFile)
OpenGLImmediateX (OGLIX, OGLI)
OpenGLStoredX (OGLSX, OGL, OGLS)

Registering model factories...

You have successfully registered the following model factories.
Registered model factories:
  generic
  drawByAttribute
  drawByCharge
  drawByOriginVolume
  drawByParticleID
  drawByEncounteredVolume

Registered filter factories:
  attributeFilter
  chargeFilter
  originVolumeFilter
  particleFilter
  encounteredVolumeFilter

You have successfully registered the following user vis actions.
Run Duration User Vis Actions: none
End of Event User Vis Actions: none
End of Run User Vis Actions: none

Some /vis commands (optionally) take a string to specify colour.
"/vis/list" to see available colours.
/control/saveHistory
/run/verbose 2
#
# Change the default number of threads (in multi-threaded mode)
#/run/numberOfThreads 4
#
# Initialize kernel
/run/initialize
userDetector->Construct() start.
Checking overlaps for volume Envelope ... OK! 
Checking overlaps for volume Shape1 ... OK! 
Checking overlaps for volume Shape2 ... OK! 
World is registered to the default region.
physicsList->Construct() start.
### Adding tracking cuts for neutron  TimeCut(ns)= 10000  KinEnergyCut(MeV)= 0
physicsList->CheckParticleList() start.
physicsList->setCut() start.
#
# Visualization setting
/control/execute vis.mac
# Macro file for the visualization setting in the initialization phase
# of the B1 example when running in interactive mode
#
# Use these open statements to open selected visualization
#
# Use this open statement to create an OpenGL view:
/vis/open OGL 600x600-0+0
/vis/sceneHandler/create OGL
/vis/viewer/create ! ! 600x600-0+0
G4OpenGLXViewer::G4OpenGLXViewer failed to allocate a standard colormap.
X Error of failed request:  BadMatch (invalid parameter attributes)
  Major opcode of failed request:  1 (X_CreateWindow)
  Serial number of failed request:  32
  Current serial number in output stream:  39

The thing is, I’ve used my current installation of Geant4 to run and visualize a collaborators simulation with OpenGL_X11, so I’m not sure why it’s failing here.

Any help or suggestions is much appreciated.

Hello @dimani
perhaps you can try to install more libraries in your sys.

sudo apt-get install libgl1-mesa-glx libgl1-mesa-dev
sudo apt-get install libx11-dev

Restart machine and re-run your code after.

VRS

It looks like I already have libx11-dev installed.
When I run the first one I get the output

Package libgl1-mesa-glx is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source

E: Package 'libgl1-mesa-glx' has no installation candidate

I think libgl1-mesa-glx has been obsolete after Ubuntu 23.

I am on Ubuntu 21.
Alternatively, you can check these libraries directly in the synaptic package manager.

  1. libgl1-mesa-glx
  2. libgl1-mesa-dev

Ref: Debian -- Details of package libgl1-mesa-dev in buster

VRS

I doubt that additional libraries will solve things - if Geant4 and the application have built o.k., then the system probably has everything needed already.

I’d also strongly suggest upgrading to a newer version that 10.5.1.

I could potentially try 10.7.3 but unfortunately any version newer than that likely won’t be compatible with a repository my collaborator has made that I’d like to run on.
So far this version does work with it but I’d also like to be able to visualize the example projects as well. If its simply a version problem it may be something I’ll have to live with but I wanted to see if anyone knew of any solutions for this version.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.