Cmake configuration fails with v10.6.0 and Fedora 31

I’m trying to install the latest version, v10.6.0 on a fully updated Fedora 31, but the cmake step fails to create any build files.

I use this cmake command

cmake -GNinja -DCMAKE_CXX_COMPILER=/usr/bin/clang++ -DCMAKE_C_COMPILER=/usr/bin/clang -DCMAKE_INSTALL_PREFIX=/usr/local/share/geant4/10.6.0/install/debug -DGEANT4_INSTALL_DATADIR=/usr/local/share/geant4/data -DGEANT4_BUILD_MULTITHREADED=ON -DGEANT4_BUILD_CXXSTD=17 -DCMAKE_BUILD_TYPE=RelWithDebInfo -DGEANT4_USE_QT=ON -DGEANT4_USE_GDML=ON -DGEANT4_USE_OPENGL_X11=ON -DGEANT4_USE_RAYTRACER_X11=ON /usr/local/share/geant4/geant4

and get the following output

-- The C compiler identification is Clang 9.0.0
-- The CXX compiler identification is Clang 9.0.0
-- Check for working C compiler: /usr/bin/clang
-- Check for working C compiler: /usr/bin/clang -- 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/clang++
-- Check for working CXX compiler: /usr/bin/clang++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Performing Test HAVE_TLS
-- Performing Test HAVE_TLS - Success
-- Found EXPAT: /usr/lib64/libexpat.so (found version "2.2.8") 
-- Found XercesC: /usr/lib64/libxerces-c.so (found version "3.2.2") 
-- Found OpenGL: /usr/lib64/libOpenGL.so   
-- Found X11: /usr/include   
-- Looking for XOpenDisplay in /usr/lib64/libX11.so;/usr/lib64/libXext.so
-- Looking for XOpenDisplay in /usr/lib64/libX11.so;/usr/lib64/libXext.so - found
-- Looking for gethostbyname
-- Looking for gethostbyname - found
-- Looking for connect
-- Looking for connect - found
-- Looking for remove
-- Looking for remove - found
-- Looking for shmat
-- Looking for shmat - found
-- Looking for IceConnectionNumber in ICE
-- Looking for IceConnectionNumber in ICE - found
-- Looking for sys/types.h
-- Looking for sys/types.h - found
-- Looking for stdint.h
-- Looking for stdint.h - found
-- Looking for stddef.h
-- Looking for stddef.h - found
-- Check size of off64_t
-- Check size of off64_t - done
-- Looking for fseeko
-- Looking for fseeko - found
-- Looking for unistd.h
-- Looking for unistd.h - found
-- Reusing dataset G4NDL (4.6)
-- Reusing dataset G4EMLOW (7.9)
-- Reusing dataset PhotonEvaporation (5.5)
-- Reusing dataset RadioactiveDecay (5.4)
-- Reusing dataset G4PARTICLEXS (2.1)
-- Reusing dataset G4PII (1.3)
-- Reusing dataset RealSurface (2.1.1)
-- Reusing dataset G4SAIDDATA (2.0)
-- Reusing dataset G4ABLA (3.1)
-- Reusing dataset G4INCL (1.0)
-- Reusing dataset G4ENSDFSTATE (2.2)
-- The following Geant4 features are enabled:
GEANT4_BUILD_CXXSTD: Compiling against C++ Standard '17'
GEANT4_BUILD_MULTITHREADED: Build multithread enabled libraries
GEANT4_BUILD_TLS_MODEL: Building with TLS model 'initial-exec'
GEANT4_USE_SYSTEM_EXPAT: Using system EXPAT library
GEANT4_USE_GDML: Building Geant4 with GDML support
GEANT4_USE_QT: Build Geant4 with Qt support
GEANT4_USE_RAYTRACER_X11: Build RayTracer driver with X11 support
GEANT4_USE_OPENGL_X11: Build Geant4 OpenGL driver with X11 support

-- Configuring done
CMake Error at cmake/Modules/G4DeveloperAPI_OLD.cmake:239 (add_library):
  Target "G4gl2ps" links to target "OpenGL::GLU" but the target was not
  found.  Perhaps a find_package() call is missing for an IMPORTED target, or
  an ALIAS target is missing?
Call Stack (most recent call first):
  cmake/Modules/G4DeveloperAPI_OLD.cmake:427 (geant4_library_target)
  source/visualization/externals/gl2ps/CMakeLists.txt:17 (GEANT4_GLOBAL_LIBRARY_TARGET)


CMake Error at cmake/Modules/G4DeveloperAPI_OLD.cmake:239 (add_library):
  Target "G4OpenGL" links to target "OpenGL::GLU" but the target was not
  found.  Perhaps a find_package() call is missing for an IMPORTED target, or
  an ALIAS target is missing?
Call Stack (most recent call first):
  cmake/Modules/G4DeveloperAPI_OLD.cmake:427 (geant4_library_target)
  source/visualization/OpenGL/CMakeLists.txt:17 (GEANT4_GLOBAL_LIBRARY_TARGET)


CMake Error at cmake/Modules/G4DeveloperAPI_OLD.cmake:239 (add_library):
  Target "G4OpenGL" links to target "OpenGL::GLU" but the target was not
  found.  Perhaps a find_package() call is missing for an IMPORTED target, or
  an ALIAS target is missing?
Call Stack (most recent call first):
  cmake/Modules/G4DeveloperAPI_OLD.cmake:427 (geant4_library_target)
  source/visualization/OpenGL/CMakeLists.txt:17 (GEANT4_GLOBAL_LIBRARY_TARGET)


CMake Error at cmake/Modules/G4DeveloperAPI_OLD.cmake:239 (add_library):
  Target "G4gl2ps" links to target "OpenGL::GLU" but the target was not
  found.  Perhaps a find_package() call is missing for an IMPORTED target, or
  an ALIAS target is missing?
Call Stack (most recent call first):
  cmake/Modules/G4DeveloperAPI_OLD.cmake:427 (geant4_library_target)
  source/visualization/externals/gl2ps/CMakeLists.txt:17 (GEANT4_GLOBAL_LIBRARY_TARGET)


CMake Error at cmake/Modules/G4DeveloperAPI_OLD.cmake:239 (add_library):
  Target "G4OpenGL" links to target "OpenGL::GLU" but the target was not
  found.  Perhaps a find_package() call is missing for an IMPORTED target, or
  an ALIAS target is missing?
Call Stack (most recent call first):
  cmake/Modules/G4DeveloperAPI_OLD.cmake:427 (geant4_library_target)
  source/visualization/OpenGL/CMakeLists.txt:17 (GEANT4_GLOBAL_LIBRARY_TARGET)


CMake Error at cmake/Modules/G4DeveloperAPI_OLD.cmake:239 (add_library):
  Target "G4OpenGL" links to target "OpenGL::GLU" but the target was not
  found.  Perhaps a find_package() call is missing for an IMPORTED target, or
  an ALIAS target is missing?
Call Stack (most recent call first):
  cmake/Modules/G4DeveloperAPI_OLD.cmake:427 (geant4_library_target)
  source/visualization/OpenGL/CMakeLists.txt:17 (GEANT4_GLOBAL_LIBRARY_TARGET)


-- Generating done
-- Build files have been written to: /usr/local/share/geant4/10.6.0/build

The cmake version is 3.14.5

$ cmake --version
cmake version 3.14.5

CMake suite maintained and supported by Kitware (kitware.com/cmake).

Anyone got any ideas, is this related to something in the latest version? I’ve built previous version with the same options (apart from c++17).

This is likely due to 10.6 moving to use of CMake imported targets exclusively, plus I’d guess that your system doesn’t have libGLU installed? Geant4’s setup to prefer the legacy GL/GLU at present, and I’m not familiar enough with Fedora to know how it packages uses GLVND vs Mesa.

It looks like we’ll need to add a check on the presence of the needed OpenGL::GLU target. However, if you can check for and install libGLU on your system, it should resolve the missing target error.

Your command (with some slight modifications such as changing paths and removing GDML support) works fine for me. The package you need to install is mesa-libGLU-devel, I think.

Thanks both!

I had the mesa-libGLU package installed but not the “devel” version. Things are now configured, built and installed.

1 Like