Compilation Issue: G4VisExecutive.icc

ranulfo@ranulfo:~$ geant4-config --libs --cflags
-L/home/ranulfo/Programas/Geant4/geant4-v11.2.1/geant4-v11.2.0-install/lib -lG4OpenGL -lG4visQt3D -lG4Tree -lG4FR -lG4GMocren -lG4visHepRep -lG4RayTracer -lG4VRML -lG4ToolsSG -lG4vis_management -lG4modeling -lG4gdml -lG4interfaces -lG4geomtext -lG4mctruth -lG4analysis -lG4error_propagation -lG4readout -lG4physicslists -lG4run -lG4event -lG4tracking -lG4parmodels -lG4processes -lG4digits_hits -lG4track -lG4particles -lG4geometry -lG4materials -lG4graphics_reps -lG4intercoms -lG4global -lG4clhep -lG4zlib -lG4ptl
-DG4VIS_USE_OPENGL -DG4UI_USE_TCSH -DG4UI_USE_QT -DG4VIS_USE_OPENGLQT -DG4VIS_USE_TOOLSSG_QT_GLES -I/usr/include/x86_64-linux-gnu/qt5/ -I/usr/include/x86_64-linux-gnu/qt5/QtCore -I/usr/lib/x86_64-linux-gnu/qt5//mkspecs/linux-g++ -I/usr/include/x86_64-linux-gnu/qt5/QtGui -I/usr/include/x86_64-linux-gnu/qt5/QtWidgets -I/usr/include/x86_64-linux-gnu/qt5/QtOpenGL -DG4UI_USE_QT3D -DG4VIS_USE_RAYTRACERX -DG4VIS_USE_OPENGLX -DG4VIS_USE_TOOLSSG_X11_GLES -W -Wall -pedantic -Wno-non-virtual-dtor -Wno-long-long -Wwrite-strings -Wpointer-arith -Woverloaded-virtual -Wno-variadic-macros -Wshadow -pipe -pthread -ftls-model=initial-exec -std=c++17 -I/home/ranulfo/Programas/Geant4/geant4-v11.2.1/geant4-v11.2.0-install/include/Geant4
ranulfo@ranulfo:~$ 

Sorry for the delay in getting back to this. O.k., I think this is nominally a bug in geant4-config to be determined/fixed upstream, but, in the meantime can you try the compile command

g++ tutorial003.cpp -Wl,--copy-dt-needed-entries -Wl,--no-as-needed `geant4-config --libs --cflags` -fPIC -o tutorial003

The background is in this blog post and this StackOverflow answer.

Thanks! I used command:

g++ tutorial003.cpp -Wl,--copy-dt-needed-entries -Wl,--no-as-needed `geant4-config --libs --cflags` -fPIC -o tutorial003

Opened the graphical interface, but the simulation did not appear.

Maybe it’s because my notebook didn’t support it or because in the code I used I left lines 75 and 76 in comments. If I had defined lines 75 and 76, I would have the following error:

tutorial003.cpp:75: warning: "G4VIS_USE_OPENGLX" redefined
    75 | #define G4VIS_USE_OPENGLX
       |
<command-line>: note: this is the location of the previous definition
tutorial003.cpp:76: warning: "G4VIS_USE_OPENGLQT" redefined
    76 | #define G4VIS_USE_OPENGLQT
       |
<command-line>: note: this is the location of the previous definition
In file included from /home/ranulfo/Programas/Geant4/geant4-v11.2.1/geant4-v11.2.0-install/include/Geant4/G4VisExecutive.hh:141,
                  from tutorial003.cpp:79:
/home/ranulfo/Programas/Geant4/geant4-v11.2.1/geant4-v11.2.0-install/include/Geant4/G4VisExecutive.icc:292:32: error: operator '||' has no right operand
   292 | G4VIS_USE_OPENGLX || G4VIS_USE_OPENGLWIN32

The code compiles if I use the command “./tutorial003 muons.mac”, the interaction is generated and the result is provided in text, it opens the graphical interface, but does not generate the simulation to be viewed and at the end an error message (qt.qpa.wayland: Wayland does not support QWindow::requestActivate() Changing export format to “jpg”) that should be the reason for not being able to view the simulation in the graphical interface.

Track (trackID 2, parentID 1) is processed with stopping code 2
NULL returned from G4StackManager.
Terminate current event processing.
  Run terminated.
Run Summary
   Number of events processed: 1
   User=0.260000s Real=0.399149s Sys=0.030000s [Cpu=72.7%]
1 event has been kept for refreshing and/or reviewing.
   "/vis/reviewKeptEvents" to review one by one.
   To see accumulated, "/vis/enable", then "/vis/viewer/flush" or "/vis/viewer/rebuild".
qt.qpa.wayland: Wayland does not support QWindow::requestActivate()
  Changing export format to "jpg"

As the program is now compiling and running, I’ve moved the post to the Vis category of the forum to see if the experts here can provide some insight.

One thing we’ll need to know is are you able to build the Geant4 example B1 using CMake as outlined here:

https://geant4-userdoc.web.cern.ch/UsersGuides/ForApplicationDeveloper/html/GettingStarted/gettingStarted.html
https://geant4-userdoc.web.cern.ch/UsersGuides/ForApplicationDeveloper/html/GettingStarted/makeFile.html

and here

https://geant4-userdoc.web.cern.ch/Doxygen/examples_doc/html/ExampleB1.html

Hi

It looks like you have a corrupt version of `G4VisExecutive.icc’.

I was not able to follow the above correspondence with @bmorgan in detail, but all I can say is: start again, download, follow the Installation Guide. Don’t rely on any videos - they are not official. If they help you, fine, but if not, go back to the official Installation Guide. There seem to be several videos around on the Web; they might simply be out of date. We, that is, Geant4, do not produce videos. Even Geant4 tutorial material might be out of date. Please simply follow the current Installation Guide.

John

1 Like