Installation of G4.10.6.3 fails on ubuntu22.04

Please fill out the following information to help in answering your question, and also see tips for posting code snippets. If you don’t provide this information it will take more time to help with your problem!

_Geant4 Version:_10.6.3
_Operating System:_wsl2 Ubuntu22.04
_Compiler/Version:_gcc&g++ 11.4.0
_CMake Version:_3.22.1

I am compiling geant4.10.6.3 in ubuntu22.04 but it fails, here the default gcc version is 11.4 and cmake version is 3.22.1. where the cmake command is as follows
cmake code:
cmake …/geant4_src -DCMAKE_INSTALL_PREFIX=/opt/geant4.10.6.3 -DGEANT4_USE_GDML=ON -DGEANT4_USE_QT=ON -DGEANT4_USE_OPENGL_X11=ON -DGEANT4_USE_RAYTRACER_X11=ON -DGEANT4_BUILD_MULTITHREADED=ON

But when geant4 compiles to 89% an error occurs as below.
[ 89%] Building CXX object source/physics_lists/CMakeFiles/G4physicslists.dir/constructors/hadron_inelastic/src/G4HadronPhysicsFTFP_BERT_TRV.cc.o
/home/luowt/Apps/G4_10.6.3/geant4_src/source/persistency/ascii/src/G4tgrEvaluator.cc:79:10: error: ambiguating new declaration of ‘G4double fsqrt(G4double)’
** 79 | G4double fsqrt( G4double arg ){ return std::sqrt(arg); }**
** | ^**
In file included from /usr/include/c++/11/cmath:45,
** from /usr/include/c++/11/complex:44,**
** from /home/luowt/Apps/G4_10.6.3/geant4_src/source/global/management/include/G4Types.hh:74,**
** from /home/luowt/Apps/G4_10.6.3/geant4_src/source/global/management/include/G4ios.hh:38,**
** from /home/luowt/Apps/G4_10.6.3/geant4_src/source/global/management/include/globals.hh:48,**
** from /home/luowt/Apps/G4_10.6.3/geant4_src/source/global/management/include/G4ThreeVector.hh:38,**
** from /home/luowt/Apps/G4_10.6.3/geant4_src/source/persistency/ascii/include/G4tgrEvaluator.hh:42,**
** from /home/luowt/Apps/G4_10.6.3/geant4_src/source/persistency/ascii/src/G4tgrEvaluator.cc:35:**
/usr/include/x86_64-linux-gnu/bits/mathcalls-narrow.h:36:20: note: old declaration ‘float fsqrt(double)’
** 36 | __MATHCALL_NARROW (__MATHCALL_NAME (sqrt), __MATHCALL_REDIR_NAME2 (sqrt), 1);**
** | ^
**
/home/luowt/Apps/G4_10.6.3/geant4_src/source/persistency/ascii/src/G4tgrEvaluator.cc: In member function ‘void G4tgrEvaluator::AddCommonFunctions()’:
/home/luowt/Apps/G4_10.6.3/geant4_src/source/persistency/ascii/src/G4tgrEvaluator.cc:102:14: error: no matching function for call to ‘setFunction(const char [5], float (&)(double) noexcept)’
** 102 | setFunction(“sqrt”, (fsqrt));*
** | ~^
~**
In file included from /home/luowt/Apps/G4_10.6.3/geant4_src/source/global/management/include/G4Evaluator.hh:39,
** from /home/luowt/Apps/G4_10.6.3/geant4_src/source/persistency/ascii/include/G4tgrEvaluator.hh:43,**
** from /home/luowt/Apps/G4_10.6.3/geant4_src/source/persistency/ascii/src/G4tgrEvaluator.cc:35:**
/home/luowt/Apps/G4_10.6.3/geant4_src/source/externals/clhep/include/CLHEP/Evaluator/Evaluator.h:125:8: note: candidate: ‘void HepTool::Evaluator::setFunction(const char, double (*)())’ (near match)*
** 125 | void setFunction(const char * name, double (fun)());*
** | ^
**
/home/luowt/Apps/G4_10.6.3/geant4_src/source/externals/clhep/include/CLHEP/Evaluator/Evaluator.h:125:8: note: conversion of argument 2 would be ill-formed:
/home/luowt/Apps/G4_10.6.3/geant4_src/source/persistency/ascii/src/G4tgrEvaluator.cc:102:24: error: invalid conversion from ‘float ()(double) noexcept’ to ‘double ()()’ [-fpermissive]
** 102 | setFunction(“sqrt”, (fsqrt));*
** | ~^
**
** | |**
** | float ()(double) noexcept**
In file included from /home/luowt/Apps/G4_10.6.3/geant4_src/source/global/management/include/G4Evaluator.hh:39,
** from /home/luowt/Apps/G4_10.6.3/geant4_src/source/persistency/ascii/include/G4tgrEvaluator.hh:43,**
** from /home/luowt/Apps/G4_10.6.3/geant4_src/source/persistency/ascii/src/G4tgrEvaluator.cc:35:**
*/home/luowt/Apps/G4_10.6.3/geant4_src/source/externals/clhep/include/CLHEP/Evaluator/Evaluator.h:135:8: note: candidate: ‘void HepTool::Evaluator::setFunction(const char, double (
)(double))’ (near match)**
** 135 | void setFunction(const char * name, double (fun)(double));*
** | ^**
/home/luowt/Apps/G4_10.6.3/geant4_src/source/externals/clhep/include/CLHEP/Evaluator/Evaluator.h:135:8: note: conversion of argument 2 would be ill-formed:
/home/luowt/Apps/G4_10.6.3/geant4_src/source/persistency/ascii/src/G4tgrEvaluator.cc:102:24: error: invalid conversion from ‘float ()(double) noexcept’ to ‘double ()(double)’ [-fpermissive]
** 102 | setFunction(“sqrt”, (fsqrt));*
** | ~^
**
** | |**
** | float ()(double) noexcept**
In file included from /home/luowt/Apps/G4_10.6.3/geant4_src/source/global/management/include/G4Evaluator.hh:39,
** from /home/luowt/Apps/G4_10.6.3/geant4_src/source/persistency/ascii/include/G4tgrEvaluator.hh:43,**
** from /home/luowt/Apps/G4_10.6.3/geant4_src/source/persistency/ascii/src/G4tgrEvaluator.cc:35:**
*/home/luowt/Apps/G4_10.6.3/geant4_src/source/externals/clhep/include/CLHEP/Evaluator/Evaluator.h:145:8: note: candidate: ‘void HepTool::Evaluator::setFunction(const char, double (
)(double, double))’ (near match)**
** 145 | void setFunction(const char * name, double (fun)(double,double));*
** | ^
**
/home/luowt/Apps/G4_10.6.3/geant4_src/source/externals/clhep/include/CLHEP/Evaluator/Evaluator.h:145:8: note: conversion of argument 2 would be ill-formed:
/home/luowt/Apps/G4_10.6.3/geant4_src/source/persistency/ascii/src/G4tgrEvaluator.cc:102:24: error: invalid conversion from ‘float ()(double) noexcept’ to ‘double ()(double, double)’ [-fpermissive]
** 102 | setFunction(“sqrt”, (fsqrt));*
** | ~^
**
** | |**
** | float ()(double) noexcept**
In file included from /home/luowt/Apps/G4_10.6.3/geant4_src/source/global/management/include/G4Evaluator.hh:39,
** from /home/luowt/Apps/G4_10.6.3/geant4_src/source/persistency/ascii/include/G4tgrEvaluator.hh:43,**
** from /home/luowt/Apps/G4_10.6.3/geant4_src/source/persistency/ascii/src/G4tgrEvaluator.cc:35:**
*/home/luowt/Apps/G4_10.6.3/geant4_src/source/externals/clhep/include/CLHEP/Evaluator/Evaluator.h:155:8: note: candidate: ‘void HepTool::Evaluator::setFunction(const char, double (
)(double, double, double))’ (near match)**
** 155 | void setFunction(const char * name, double (fun)(double,double,double));*
** | ^**
/home/luowt/Apps/G4_10.6.3/geant4_src/source/externals/clhep/include/CLHEP/Evaluator/Evaluator.h:155:8: note: conversion of argument 2 would be ill-formed:
/home/luowt/Apps/G4_10.6.3/geant4_src/source/persistency/ascii/src/G4tgrEvaluator.cc:102:24: error: invalid conversion from ‘float ()(double) noexcept’ to ‘double ()(double, double, double)’ [-fpermissive]
** 102 | setFunction(“sqrt”, (fsqrt));*
** | ~^
**
** | |**
** | float ()(double) noexcept**
In file included from /home/luowt/Apps/G4_10.6.3/geant4_src/source/global/management/include/G4Evaluator.hh:39,
** from /home/luowt/Apps/G4_10.6.3/geant4_src/source/persistency/ascii/include/G4tgrEvaluator.hh:43,**
** from /home/luowt/Apps/G4_10.6.3/geant4_src/source/persistency/ascii/src/G4tgrEvaluator.cc:35:**
*/home/luowt/Apps/G4_10.6.3/geant4_src/source/externals/clhep/include/CLHEP/Evaluator/Evaluator.h:165:8: note: candidate: ‘void HepTool::Evaluator::setFunction(const char, double (
)(double, double, double, double))’ (near match)**
** 165 | void setFunction(const char * name,**
** | ^
**
/home/luowt/Apps/G4_10.6.3/geant4_src/source/externals/clhep/include/CLHEP/Evaluator/Evaluator.h:165:8: note: conversion of argument 2 would be ill-formed:
/home/luowt/Apps/G4_10.6.3/geant4_src/source/persistency/ascii/src/G4tgrEvaluator.cc:102:24: error: invalid conversion from ‘float ()(double) noexcept’ to ‘double ()(double, double, double, double)’ [-fpermissive]
** 102 | setFunction(“sqrt”, (fsqrt));*
** | ~^
**
** | |**
** | float ()(double) noexcept**
In file included from /home/luowt/Apps/G4_10.6.3/geant4_src/source/global/management/include/G4Evaluator.hh:39,
** from /home/luowt/Apps/G4_10.6.3/geant4_src/source/persistency/ascii/include/G4tgrEvaluator.hh:43,**
** from /home/luowt/Apps/G4_10.6.3/geant4_src/source/persistency/ascii/src/G4tgrEvaluator.cc:35:**
*/home/luowt/Apps/G4_10.6.3/geant4_src/source/externals/clhep/include/CLHEP/Evaluator/Evaluator.h:176:8: note: candidate: ‘void HepTool::Evaluator::setFunction(const char, double (
)(double, double, double, double, double))’ (near match)**
** 176 | void setFunction(const char * name,**
** | ^~~~~**
/home/luowt/Apps/G4_10.6.3/geant4_src/source/externals/clhep/include/CLHEP/Evaluator/Evaluator.h:176:8: note: conversion of argument 2 would be ill-formed:
/home/luowt/Apps/G4_10.6.3/geant4_src/source/persistency/ascii/src/G4tgrEvaluator.cc:102:24: error: invalid conversion from ‘float ()(double) noexcept’ to ‘double ()(double, double, double, double, double)’ [-fpermissive]
** 102 | setFunction(“sqrt”, (fsqrt));*
** | ~^
**
** | |**
** | float (*)(double) noexcept**
[ 89%] Building CXX object source/physics_lists/CMakeFiles/G4physicslists.dir/constructors/hadron_inelastic/src/G4HadronPhysicsFTFP_BERT_ATL.cc.o
I have to use this version of geant4 because the software I was using depended on it.

This is a known issue with versions prior to 10.7: Error while installing GEANT4 in ubuntu 22.04.2 LTS - #8 by bmorgan.

The Bugzilla in that link provides the report and one suggested patch, but please note that 10.6 is no longer being patched and we strongly encourage updates to newer versions (for which we can help with).

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.