Error in building B1 example after installation of geant4

It shows executable file “exampleB1” in “B1-build” folder but when I try to run it, this error occurs. How can I fix this problem?

Could you please tell us you platform, Geant4 version, and what build options you used?

I used ubuntu 18.04 as platform and Geant4-10.3.0 and below are the steps that I followed

devanshsoni@DESKTOP-0VUP5MO:~$ mkdir b1-build
devanshsoni@DESKTOP-0VUP5MO:~$ cd b1-build/
devanshsoni@DESKTOP-0VUP5MO:~/b1-build$ cmake -DGeant4_DIR=/usr/local/lib/Geant4-10.3.0 $HOME/B1
– The C compiler identification is GNU 7.5.0
– The CXX compiler identification is GNU 7.5.0
– Check for working C compiler: /usr/bin/cc
– Check for working C compiler: /usr/bin/cc – works
– Detecting C compiler ABI info
– Detecting C compiler ABI info - done
– Detecting C compile features
– Detecting C compile features - done
– Check for working CXX compiler: /usr/bin/c++
– Check for working CXX compiler: /usr/bin/c++ – works
– Detecting CXX compiler ABI info
– Detecting CXX compiler ABI info - done
– Detecting CXX compile features
– Detecting CXX compile features - done
– Configuring done
– Generating done
– Build files have been written to: /home/devanshsoni/b1-build
devanshsoni@DESKTOP-0VUP5MO:~/b1-build$ ls
CMakeCache.txt CMakeFiles Makefile cmake_install.cmake exampleB1.in exampleB1.out init_vis.mac run1.mac run2.mac vis.mac
devanshsoni@DESKTOP-0VUP5MO:~/b1-build$ make -j4
Scanning dependencies of target exampleB1
[ 25%] Building CXX object CMakeFiles/exampleB1.dir/src/B1ActionInitialization.cc.o
[ 25%] Building CXX object CMakeFiles/exampleB1.dir/exampleB1.cc.o
[ 37%] Building CXX object CMakeFiles/exampleB1.dir/src/B1EventAction.cc.o
[ 50%] Building CXX object CMakeFiles/exampleB1.dir/src/B1DetectorConstruction.cc.o
[ 62%] Building CXX object CMakeFiles/exampleB1.dir/src/B1PrimaryGeneratorAction.cc.o
[ 75%] Building CXX object CMakeFiles/exampleB1.dir/src/B1RunAction.cc.o
[ 87%] Building CXX object CMakeFiles/exampleB1.dir/src/B1SteppingAction.cc.o
[100%] Linking CXX executable exampleB1
[100%] Built target exampleB1
devanshsoni@DESKTOP-0VUP5MO:~/b1-build$ ls
CMakeCache.txt CMakeFiles Makefile cmake_install.cmake exampleB1 exampleB1.in exampleB1.out init_vis.mac run1.mac run2.mac vis.mac
devanshsoni@DESKTOP-0VUP5MO:~/b1-build$ source /usr/local/bin/geant4.sh
devanshsoni@DESKTOP-0VUP5MO:~/b1-build$ ./exampleB1
Available UI session types: [ Qt, GAG, tcsh, csh ]
G4WT0 >
G4WT0 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
G4WT0 > Local thread RunManagerKernel version Name: geant4-10-03 [MT]
G4WT0 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
G4WT0 >
G4WT1 >
G4WT1 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
G4WT1 > Local thread RunManagerKernel version Name: geant4-10-03 [MT]
G4WT1 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
G4WT1 >
G4WT0 > ### Adding tracking cuts for neutron TimeCut(ns)= 10000 KinEnergyCut(MeV)= 0
G4WT1 > ### Adding tracking cuts for neutron TimeCut(ns)= 10000 KinEnergyCut(MeV)= 0
X Error: GLXBadCurrentWindow 157
Extension: 146 (Uknown extension)
Minor opcode: 5 (Unknown request)
Resource id: 0xf4
X Error: GLXBadContext 152
Extension: 146 (Uknown extension)
Minor opcode: 26 (Unknown request)
Resource id: 0x0
QGLContext::makeCurrent(): Failed.
X Error: GLXBadContext 152
Extension: 146 (Uknown extension)
Minor opcode: 26 (Unknown request)
Resource id: 0x0
QGLContext::makeCurrent(): Failed.
X Error: GLXBadContext 152
Extension: 146 (Uknown extension)
Minor opcode: 26 (Unknown request)
Resource id: 0x0
QGLContext::makeCurrent(): Failed.
X Error: GLXBadContext 152
Extension: 146 (Uknown extension)
Minor opcode: 26 (Unknown request)
Resource id: 0x0
QGLContext::makeCurrent(): Failed.
X Error: GLXBadContext 152
Extension: 146 (Uknown extension)
Minor opcode: 26 (Unknown request)
Resource id: 0x0
QGLContext::makeCurrent(): Failed.
Segmentation fault

Mmm. Ubuntu is usually a good system.

Geant4 is now up to 10.7 - could you try that?

It looks like an X Windows problem. Could you try re-installing X Windows?

Sorry not to be more helpful.