Visualisation does not find OGL as a candidate

Hello,

I have used the B1 example as a basis to create a simulation for electron induced xray emissions. The code can be found here:

Unfortunately the visualisation does not work. I recieve the following error:
“Candidates are: ATree DAWNFILE HepRepFile HepRepXML RayTracer VRML1FILE
VRML2FILE gMocrenFile”

the line in the macro is “/vis/open OGL 600x600-0+0”

I compiled Geant4 myself, OpenGL and X11 is activated and the libraries are installed.

running “geant4-config -h” outputs “opengl-x11[yes]”

1 Like

Are you linked against the same Geant4 you built with OpenGL enabled? I just checked, and even if you don’t have the envvar G4VIS_USE_OPENGL set, it will still list the OGL* candidates at runtime. If those candidates aren’t listed, it means that your Geant4 wasn’t compiled against OpenGL.

One additional way to check your installation is to go to your build directory, and use the command

grep OPENGL_X11 CMakeCache.txt

The first line of output should be

GEANT4_USE_OPENGL_X11:BOOL=ON

If it isn’t, re-run CMake with -DGEANT4_USE_OPENGL_X11=ON and redo the make install action (that will recompile as well as install).

1 Like

I checked the Makefile:

$ grep OPENGL_X11 CMakeCache.txt
GEANT4_USE_OPENGL_X11:BOOL=ON
//MODIFIED property for variable: GEANT4_USE_OPENGL_X11
GEANT4_USE_OPENGL_X11-MODIFIED:INTERNAL=ON

I also redid the make install, but no change. Do I have to link my program against additional libraries? Right now I am using in my Makefile:

find_package(Geant4 REQUIRED)
and then
target_link_libraries(SoEiXRS ${Geant4_LIBRARIES})

To enable all optional drivers, find_package needs to be called as

find_package(Geant4 REQUIRED vis_all ui_all)

Well, new try new error:

=================================================================
==3602==ERROR: AddressSanitizer: attempting free on address which was not malloc()-ed: 0x7fe965639820 in thread T0
    #0 0x7fe9715bbf40 in realloc (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xdef40)
    #1 0x7fe964afc2e0 in QListData::realloc_grow(int) (/usr/lib/x86_64-linux-gnu/libQt5Core.so.5+0xfe2e0)
    #2 0x7fe964afc37e in QListData::append(int) (/usr/lib/x86_64-linux-gnu/libQt5Core.so.5+0xfe37e)
    #3 0x7fe964bca357  (/usr/lib/x86_64-linux-gnu/libQt5Core.so.5+0x1cc357)
    #4 0x7fe964bc5b0c in qRegisterResourceData(int, unsigned char const*, unsigned char const*, unsigned char const*) (/usr/lib/x86_64-linux-gnu/libQt5Core.so.5+0x1c7b0c)
    #5 0x7fe964a7b692  (/usr/lib/x86_64-linux-gnu/libQt5Core.so.5+0x7d692)
    #6 0x7fe9724a8732  (/lib64/ld-linux-x86-64.so.2+0x10732)
    #7 0x7fe9724990c9  (/lib64/ld-linux-x86-64.so.2+0x10c9)

Address 0x7fe965639820 is a wild pointer.
SUMMARY: AddressSanitizer: bad-free (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xdef40) in realloc
==3602==ABORTING

Note that this happens BEFORE anything is being executed by the main thread.

(I am using fsanitize) Does this ring a bell to you? Or do I have to look into my qt (which is from my package manager …)

Okay I figured out 2 possible workarounds:

  1. Use qt4
  2. Don’t use at at all

since I only need the visual verification of my geometry without any UI I am fine.

You can close this thread if you want.