Error while installing GEANT4 in ubuntu 22.04.2 LTS

While installing GEANT4 in ubunutu I got error after commend ‘make -j4’
The information of software and their version is as follows:

_Geant4 Version:_geant4.10.07.p01
_Operating System:_ubuntu 22.04.2 LTS
_Compiler/Version:gcc (Ubuntu 11.3.0-1ubuntu1~22.04.1) 11.3.0
_CMake Version:_cmake version 3.22.1
Qt version 5.15.3

The error is as follows:
als/include/G4Material.hh:103,
from /home/kajal/software/geant4/geant4.10.07.p01/source/track/include/G4Track.hh:58,
from /home/kajal/software/geant4/geant4.10.07.p01/source/processes/transportation/src/G4TransportationLogger.cc:39:
/home/kajal/software/geant4/geant4.10.07.p01/source/materials/include/G4Isotope.hh:81:31: warning: declaration of ‘m’ shadows a global declaration [-Wshadow]
81 | G4int m = 0); //isomer level
| ~~~~~~^
In file included from /home/kajal/software/geant4/geant4.10.07.p01/source/global/management/include/G4SystemOfUnits.hh:36,
from /home/kajal/software/geant4/geant4.10.07.p01/source/processes/transportation/src/G4TransportationLogger.cc:37:
/home/kajal/software/geant4/geant4.10.07.p01/source/externals/clhep/include/CLHEP/Units/SystemOfUnits.h:109:27: note: shadowed declaration is here
109 | static constexpr double m = meter;
| ^
[ 79%] Building CXX object source/CMakeFiles/G4processes.dir/processes/transportation/src/G4VTrackTerminator.cc.o
[ 79%] Linking CXX shared library …/BuildProducts/lib/libG4processes.so
[ 79%] Built target G4processes
make: *** [Makefile:156: all] Error 2

Please help me to fix this problem. Before this error i didn’t get any warning or error.
Thanks in advance.


These are, as far as I can see, just warnings, not the actual error. This/These will be something like:

/home/kajal/software/geant4/geant4.10.07.p01/source/<SOMEFILE>:NN:MM: error: <ERRORMESSAGE>

note the “error”. It may help to run just plain make as then the cause of the error should appear last in the output.

But due to this error it did not build 100% and break after 79%.
I tried twice using different version of geant4 but got the same error.
What should I do any suggestions please.

After ‘make’ commend, I received this type of error:

TLSv1.2 (IN), TLS header, Supplemental data (23):

[5 bytes data]

[1 bytes data]

[16384 bytes data]

TLSv1.2 (IN), TLS header, Supplemental data (23):

[5 bytes data]

[1 bytes data]

[16320 bytes data]
make[2]: *** [CMakeFiles/G4NDL.dir/build.make:98: Externals/G4NDL-4.6/src/G4NDL-stamp/G4NDL-download] Error 1
make[1]: *** [CMakeFiles/Makefile2:2556: CMakeFiles/G4NDL.dir/all] Error 2
make: *** [Makefile:156: all] Error 2

Please suggest what to do.

i got the same problem, you can install geant4 in ubuntu 20.04
(install virtual box machine upload ubuntu 20.04 and install geant4)

This probably suggests that the error is due to the download of the data libraries timing out. To see if that’s the case, run CMake again in the directory where you’re building Geant4 as follows:

cmake -DGEANT4_INSTALL_DATA_TIMEOUT=6000 .

Try running make again. The number here is the number of seconds to allow for the download, so an hour should be enough. If the error persists, please post the full error output here.

I run cmake using above command after that I got error as follows:

[ 84%] Building CXX object source/CMakeFiles/G4persistency.dir/persistency/ascii/src/G4tgrEvaluator.cc.o
/home/kajal/software/geant4.10.07.p01/source/persistency/ascii/src/G4tgrEvaluator.cc:73:10: error: ambiguating new declaration of ‘G4double fsqrt(G4double)’
73 | 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/kajal/software/geant4.10.07.p01/source/global/management/include/G4Types.hh:74,
from /home/kajal/software/geant4.10.07.p01/source/global/management/include/G4ios.hh:35,
from /home/kajal/software/geant4.10.07.p01/source/global/management/include/globals.hh:35,
from /home/kajal/software/geant4.10.07.p01/source/global/management/include/G4ThreeVector.hh:33,
from /home/kajal/software/geant4.10.07.p01/source/persistency/ascii/include/G4tgrEvaluator.hh:37,
from /home/kajal/software/geant4.10.07.p01/source/persistency/ascii/src/G4tgrEvaluator.cc:31:
/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/kajal/software/geant4.10.07.p01/source/persistency/ascii/src/G4tgrEvaluator.cc: In member function ‘void G4tgrEvaluator::AddCommonFunctions()’:
/home/kajal/software/geant4.10.07.p01/source/persistency/ascii/src/G4tgrEvaluator.cc:95:14: error: no matching function for call to ‘setFunction(const char [5], float (&)(double) noexcept)’
95 | setFunction(“sqrt”, (fsqrt));
| ~^~~~~~~~
In file included from /home/kajal/software/geant4.10.07.p01/source/global/management/include/G4Evaluator.hh:33,
from /home/kajal/software/geant4.10.07.p01/source/persistency/ascii/include/G4tgrEvaluator.hh:38,
from /home/kajal/software/geant4.10.07.p01/source/persistency/ascii/src/G4tgrEvaluator.cc:31:
/home/kajal/software/geant4.10.07.p01/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/kajal/software/geant4.10.07.p01/source/externals/clhep/include/CLHEP/Evaluator/Evaluator.h:125:8: note: conversion of argument 2 would be ill-formed:
/home/kajal/software/geant4.10.07.p01/source/persistency/ascii/src/G4tgrEvaluator.cc:95:24: error: invalid conversion from ‘float (
)(double) noexcept’ to ‘double (
)()’ [-fpermissive]
95 | setFunction(“sqrt”, (fsqrt));
| ~^~~~~~~
| |
| float (
)(double) noexcept
In file included from /home/kajal/software/geant4.10.07.p01/source/global/management/include/G4Evaluator.hh:33,
from /home/kajal/software/geant4.10.07.p01/source/persistency/ascii/include/G4tgrEvaluator.hh:38,
from /home/kajal/software/geant4.10.07.p01/source/persistency/ascii/src/G4tgrEvaluator.cc:31:
/home/kajal/software/geant4.10.07.p01/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/kajal/software/geant4.10.07.p01/source/externals/clhep/include/CLHEP/Evaluator/Evaluator.h:135:8: note: conversion of argument 2 would be ill-formed:
/home/kajal/software/geant4.10.07.p01/source/persistency/ascii/src/G4tgrEvaluator.cc:95:24: error: invalid conversion from ‘float (
)(double) noexcept’ to ‘double (
)(double)’ [-fpermissive]
95 | setFunction(“sqrt”, (fsqrt));
| ~^~~~~~~
| |
| float (
)(double) noexcept
In file included from /home/kajal/software/geant4.10.07.p01/source/global/management/include/G4Evaluator.hh:33,
from /home/kajal/software/geant4.10.07.p01/source/persistency/ascii/include/G4tgrEvaluator.hh:38,
from /home/kajal/software/geant4.10.07.p01/source/persistency/ascii/src/G4tgrEvaluator.cc:31:
/home/kajal/software/geant4.10.07.p01/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/kajal/software/geant4.10.07.p01/source/externals/clhep/include/CLHEP/Evaluator/Evaluator.h:145:8: note: conversion of argument 2 would be ill-formed:
/home/kajal/software/geant4.10.07.p01/source/persistency/ascii/src/G4tgrEvaluator.cc:95:24: error: invalid conversion from ‘float (
)(double) noexcept’ to ‘double (
)(double, double)’ [-fpermissive]
95 | setFunction(“sqrt”, (fsqrt));
| ~^~~~~~~
| |
| float (
)(double) noexcept
In file included from /home/kajal/software/geant4.10.07.p01/source/global/management/include/G4Evaluator.hh:33,
from /home/kajal/software/geant4.10.07.p01/source/persistency/ascii/include/G4tgrEvaluator.hh:38,
from /home/kajal/software/geant4.10.07.p01/source/persistency/ascii/src/G4tgrEvaluator.cc:31:
/home/kajal/software/geant4.10.07.p01/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/kajal/software/geant4.10.07.p01/source/externals/clhep/include/CLHEP/Evaluator/Evaluator.h:155:8: note: conversion of argument 2 would be ill-formed:
/home/kajal/software/geant4.10.07.p01/source/persistency/ascii/src/G4tgrEvaluator.cc:95:24: error: invalid conversion from ‘float (
)(double) noexcept’ to ‘double (
)(double, double, double)’ [-fpermissive]
95 | setFunction(“sqrt”, (fsqrt));
| ~^~~~~~~
| |
| float (
)(double) noexcept
In file included from /home/kajal/software/geant4.10.07.p01/source/global/management/include/G4Evaluator.hh:33,
from /home/kajal/software/geant4.10.07.p01/source/persistency/ascii/include/G4tgrEvaluator.hh:38,
from /home/kajal/software/geant4.10.07.p01/source/persistency/ascii/src/G4tgrEvaluator.cc:31:
/home/kajal/software/geant4.10.07.p01/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/kajal/software/geant4.10.07.p01/source/externals/clhep/include/CLHEP/Evaluator/Evaluator.h:165:8: note: conversion of argument 2 would be ill-formed:
/home/kajal/software/geant4.10.07.p01/source/persistency/ascii/src/G4tgrEvaluator.cc:95:24: error: invalid conversion from ‘float (
)(double) noexcept’ to ‘double ()(double, double, double, double)’ [-fpermissive]
95 | setFunction(“sqrt”, (fsqrt));
| ~^~~~~~~
| |
| float (
)(double) noexcept
In file included from /home/kajal/software/geant4.10.07.p01/source/global/management/include/G4Evaluator.hh:33,
from /home/kajal/software/geant4.10.07.p01/source/persistency/ascii/include/G4tgrEvaluator.hh:38,
from /home/kajal/software/geant4.10.07.p01/source/persistency/ascii/src/G4tgrEvaluator.cc:31:
/home/kajal/software/geant4.10.07.p01/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/kajal/software/geant4.10.07.p01/source/externals/clhep/include/CLHEP/Evaluator/Evaluator.h:176:8: note: conversion of argument 2 would be ill-formed:
/home/kajal/software/geant4.10.07.p01/source/persistency/ascii/src/G4tgrEvaluator.cc:95:24: error: invalid conversion from ‘float (
)(double) noexcept’ to ‘double (*)(double, double, double, double, double)’ [-fpermissive]
95 | setFunction(“sqrt”, (fsqrt));
| ~^~~~~~~
| |
| float (
)(double) noexcept
make[2]: *** [source/CMakeFiles/G4persistency.dir/build.make:398: source/CMakeFiles/G4persistency.dir/persistency/ascii/src/G4tgrEvaluator.cc.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:3275: source/CMakeFiles/G4persistency.dir/all] Error 2
make: *** [Makefile:156: all] Error 2

Thanks, that’s a lot clearer now - this is Bug 2444 for which there are a few resolutions. It should be fixed for Geant4 10.7.4 and later, but I’d recommend using the latest Geant4 11.1.2 release for best support with GCC 11.

Thanks a lot. It solved the problem and I successfully installed GEANT4 software.

1 Like

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