Issues with Geant4 official docker image

I am trying to use the official docker imagefor GEANT4 .

I pulled the image to my local machine, then I downloaded the source code.

I am now trying to make exampleB1. Following the tutorial here, I run

cd /HOMEDIR/geant4-master/examples/basic/B1/ # go to directory which contains your example % mkdir exampleB1_build/ % cd exampleB1_build/ % cmake …/exampleB1_build

The tutorial has a cmake flag “DGeant4_DIR”, but I don’t know where that is located in the docker image.

Anyways, I get the error

cmake: /lib64/libselinux.so.1: no version information available (required by /opt/udiImage/modules/mpich/dep/libkrb5support.so.0)
CMake Error: The source directory “/HOMEDIR/geant4-master/examples/basic/B1/exampleB1” does not exist.
Specify --help for usage, or press the help button on the CMake GUI.

I know that exampleB1 doesn’t exist, since I am trying to make it! But I am at a loss as to how to move forwards.

Apologies for the confusion - the “geant4/geant4” organisation is owned by us, but was originally setup as a placeholder and testing. The images there should not be used for production work, and are not supported so have been deleted. Whilst providing Docker images is on the radar, it’s at a lower priority than other packaging/deployment tasks.

Building from source or using one of the existing packages as described in the Installation Guide should be used.

Thanks for the information!

I’m now trying out the conda installation, so I know where the geant4 installation directory is.

However, running the same steps as above, I get the same error

cmake -DGeant4_DIR=/global/homes/r/rmastand/.conda/envs/geant4/lib/cmake/Geant4/ …/exampleB1_build

gives the error

The source directory “/HOMEDIR/geant4-master/examples/basic/B1/exampleB1” does not exist.

I think the build is failing because the cmake paths are not correct. When does your cmake file look like? If you install in a conda environment, you likely have to point to all the library files in your conda environment instead of root. It is unlikely the conda install will be able to correctly point to the proper conda directories and if it confuses it with the root you will have all sorts of problems.

In the folder B1, the GNUmakefile looks like this

# --------------------------------------------------------------
# GNUmakefile for examples module.  Gabriele Cosmo, 06/04/98.
# --------------------------------------------------------------

name := exampleB1
G4TARGET := $(name)
G4EXLIB := true

ifndef G4INSTALL
  G4INSTALL = /global/homes/r/rmastand/.conda/envs/geant4/share/Geant4/geant4make/
endif

.PHONY: all
all: lib bin

include $(G4INSTALL)/config/binmake.gmk

visclean:
	rm -f g4*.prim g4*.eps g4*.wrl
	rm -f .DAWN_*

This is identical to the default, except, I changed the path G4INSTALL from the default value of ../../... I have checked that the path /global/homes/r/rmastand/.conda/envs/geant4/share/Geant4/geant4make/config//binmake.gmk exists, such that the included $(G4INSTALL)/config/binmake.gmk is well-defined.

The GNUmakefile is a different system from the cmake you tried initially. Let’s focus on the cmake one.

Which directory are you running the cmake command in?

The path given to cmake for the source directory is ../exampleB1_build (I assume the .../exampleB1_build above is an autocorrect issue, but do check), but that’s where the build, i.e. the cmake command, should be run. This also doesn’t seem to make sense in terms of the path the error message is reporting.

Hi all,

Sorry, a lot of typos on my end. The command I am running is NOT
cmake -DGeant4_DIR=/global/homes/r/rmastand/.conda/envs/geant4/lib/cmake/Geant4/ …/exampleB1_build
It is (and has always been)
cmake -DGeant4_DIR=/global/homes/r/rmastand/.conda/envs/geant4/lib/cmake/Geant4/ ../exampleB1
and that is what the README tells you to run.

I am running the cmake command in the directory /global/u1/r/rmastand/geant4-master/examples/basic/B1/exampleB1_build (as the README suggests)

Sorry for delay in replying - I think you’ve found a typo/clarity issue in the documentation you linked to. From the commands posted, I _think the “source directory” for the B1 example (i.e. the location CMake needs to be pointed to) is

/global/u1/r/rmastand/geant4-master/examples/basic/B1

That can be confirmed by checking there is are CMakeLists.txt and exampleB1.cc files there. That be the case, the appropriate command will be, assuming it is run in

/global/u1/r/rmastand/geant4-master/examples/basic/B1/exampleB1_build

will be:

cmake -DGeant4_DIR=/global/homes/r/rmastand/.conda/envs/geant4/lib/cmake/Geant4 ../

The text in the docs here is probably not clear enough:

% cd path_to_exampleXYZ     # go to directory which contains your example

The comment should be read as “the directory which contains a subdirectory containing your example”. @ivana , could we take a look at clarifying that?

Hello,

Indeed, the instructions in the README page are incorrect.

If the build is performed withing the example directory, as the first line suggests:

% cd path_to_exampleXYZ     # go to directory which contains your example

then the cmake should point at the source at the upper directory:

cmake -DGeant4_DIR=path_to_geant4_installation ..

The other way is to have the build directory alongside the example source directory:

$ cd /mypath
$ mkdir B1_build
$ ls
B1 B1_build
$ cd /mypath/B1_build
$ cmake -DGeant4_DIR=path_to_geant4_installation ../B1

We will correct the examples documentation.