Installing Geant on ubuntu

Dear friends,

I am trying to install geant4 on ubuntu 23.10. I downloaded a source code. made a build directory and executed this command from build directory:

sudo cmake -DCMAKE_INSTALL_PREFIX=/usr/local/bin/GEANT4/geant4-v11.2.0-install /usr/local/bin/GEANT4/geant4-v11.2.0 -DGEANT4_INSTALL_DATA=ON

the problem is that after exetucing this command the folder named “/usr/local/bin/GEANT4/geant4-v11.2.0-install” is still ampty.

What should I do?

_Geant4 Version:_10.6
Operating System: ubuntu 23.10
Compiler/Version:
_CMake Version:_cmake3


Please see the relevant section of the Installation Guide. That command configures Geant4’s build, and the build, install steps require additional commands that are documented on that link.

Hi @bmorgan @mariam_abuladze ,

I encountered similar problem when installing Geant4 on Win10:

_Geant4 Version:_10.6.3
Operating System: win10
Compiler/Version: VS 2019
_CMake Version:_3.27.9

The variables set in configuring are as follows:

When executing command cmake --build . --config Release and cmake --build . --config Release --target install in the geant4-build folder, a lot of the same errors occured but the compile and install process was not interrupted. The error was like:

  G4HadronInelasticProcess.cc
D:\geant4\geant4-v10.6.3\source\processes\hadronic\cross_sections\include\G4FastPathHadronicCrossSection.hh(299,85): er
ror C2445: ?????? result ?????: ??"const G4String"?"const char [10]"?????????? [D:\geant4\geant4-build\source\processes
\G4processes.vcxproj]
D:\geant4\geant4-v10.6.3\source\processes\hadronic\cross_sections\include\G4FastPathHadronicCrossSection.hh(299,85): me
ssage : ???"const G4String" [D:\geant4\geant4-build\source\processes\G4processes.vcxproj]
D:\geant4\geant4-v10.6.3\source\processes\hadronic\cross_sections\include\G4FastPathHadronicCrossSection.hh(299,85): me
ssage : ?    "const char *" [D:\geant4\geant4-build\source\processes\G4processes.vcxproj]
D:\geant4\geant4-v10.6.3\source\processes\hadronic\cross_sections\include\G4FastPathHadronicCrossSection.hh(300,77): er
ror C2445: ?????? result ?????: ??"const G4String"?"const char [10]"?????????? [D:\geant4\geant4-build\source\processes
\G4processes.vcxproj]
D:\geant4\geant4-v10.6.3\source\processes\hadronic\cross_sections\include\G4FastPathHadronicCrossSection.hh(300,77): me
ssage : ???"const G4String" [D:\geant4\geant4-build\source\processes\G4processes.vcxproj]
D:\geant4\geant4-v10.6.3\source\processes\hadronic\cross_sections\include\G4FastPathHadronicCrossSection.hh(300,77): me
ssage : ?    "const char *" [D:\geant4\geant4-build\source\processes\G4processes.vcxproj]

Then after the installing the geant4-install folder is still empty.

These errors appear to be due to ambiguity in the writing of the .cc file, but I have used the same method to install Geant4 on other machines before without such errors. And the number of such errors is too large for me to correct one by one.

What should I do?

After I manually modified several .cc files, a new error appeared. The full output is as follows, and finally I use Ctrl+C to terminate the process.

d:\geant4\geant4-v11.2.0-build>cmake --build . --config Release
Microsoft (R) Build Engine version 16.11.0+0538acc04 for .NET Framework
Copyright (C) Microsoft Corporation. All rights reserved.

  Auto build dll exports
  G4clhep.vcxproj -> D:\geant4\geant4-v11.2.0-build\BuildProducts\Release\bin
  \G4clhep.dll
  Auto build dll exports
  ptl-shared.vcxproj -> D:\geant4\geant4-v11.2.0-build\BuildProducts\Release\
  bin\G4ptl.dll
  Auto build dll exports
  G4global.vcxproj -> D:\geant4\geant4-v11.2.0-build\BuildProducts\Release\bi
  n\G4global.dll
  Auto build dll exports
  G4intercoms.vcxproj -> D:\geant4\geant4-v11.2.0-build\BuildProducts\Release
  \bin\G4intercoms.dll
  Auto build dll exports
  G4graphics_reps.vcxproj -> D:\geant4\geant4-v11.2.0-build\BuildProducts\Rel
  ease\bin\G4graphics_reps.dll
  Auto build dll exports
  G4zlib.vcxproj -> D:\geant4\geant4-v11.2.0-build\BuildProducts\Release\bin\
  G4zlib.dll
  Auto build dll exports
  G4materials.vcxproj -> D:\geant4\geant4-v11.2.0-build\BuildProducts\Release
  \bin\G4materials.dll
  Auto build dll exports
  G4geometry.vcxproj -> D:\geant4\geant4-v11.2.0-build\BuildProducts\Release\
  bin\G4geometry.dll
  Auto build dll exports
  G4particles.vcxproj -> D:\geant4\geant4-v11.2.0-build\BuildProducts\Release
  \bin\G4particles.dll
  Auto build dll exports
  G4track.vcxproj -> D:\geant4\geant4-v11.2.0-build\BuildProducts\Release\bin
  \G4track.dll
  Auto build dll exports
  G4digits_hits.vcxproj -> D:\geant4\geant4-v11.2.0-build\BuildProducts\Relea
  se\bin\G4digits_hits.dll
  Auto build dll exports
  G4expat.vcxproj -> D:\geant4\geant4-v11.2.0-build\BuildProducts\Release\bin
  \G4expat.dll
  Auto build dll exports
  G4analysis.vcxproj -> D:\geant4\geant4-v11.2.0-build\BuildProducts\Release\
  bin\G4analysis.dll
  G4LatticeManager.cc
  G4LatticeReader.cc
  G4PhononDownconversion.cc
  G4PhononPolarization.cc
  G4PhononReflection.cc
  G4PhononScattering.cc
  G4PhononTrackMap.cc
  G4VPhononProcess.cc
  ??????...
  G4ChannelingTrackData.cc
  G4ChannelingOptrMultiParticleChangeCrossSection.cc
  G4ChannelingOptrChangeCrossSection.cc
  G4ChannelingMaterialData.cc
  G4Channeling.cc
  G4ChannelingECHARM.cc
  ??????...
  G4FastSimHitMaker.cc
  G4FastSimulationHelper.cc
  G4FastSimulationManager.cc
  G4FastSimulationManagerProcess.cc
  G4FastSimulationMessenger.cc
  G4FastStep.cc
  G4FastTrack.cc
  G4GlobalFastSimulationManager.cc
  G4VFastSimulationModel.cc
  ??????...
  G4EnergySplitter.cc
  G4ParallelWorldProcess.cc
  G4ParallelWorldProcessStore.cc
  G4ParallelWorldScoringProcess.cc
  G4ScoreSplittingProcess.cc
  ??????...
  G4CoupledTransportation.cc
  G4NeutronKiller.cc
  G4NeutronKillerMessenger.cc
  G4StepLimiter.cc
  G4Transportation.cc
  G4TransportationParameters.cc
  G4TransportationLogger.cc
  G4VTrackTerminator.cc
  ??????...
  Auto build dll exports
G4MoleculeGunMessenger.obj : error LNK2005: "public: virtual void __cdecl TG4
MoleculeShoot<class G4Track>::Shoot(class G4MoleculeGun *)" (?Shoot@?$TG4Mole
culeShoot@VG4Track@@@@UEAAXPEAVG4MoleculeGun@@@Z) ??? G4MoleculeGun.obj ??? [
D:\geant4\geant4-v11.2.0-build\source\G4processes.vcxproj]
    ????? D:/geant4/geant4-v11.2.0-build/BuildProducts/Release/lib/G4processe
  s.lib ??? D:/geant4/geant4-v11.2.0-build/BuildProducts/Release/lib/G4proces
  ses.exp
D:\geant4\geant4-v11.2.0-build\BuildProducts\Release\bin\G4processes.dll : fa
tal error LNK1169: ?????????????? [D:\geant4\geant4-v11.2.0-build\source\G4pr
ocesses.vcxproj]
  Building Custom Rule D:/geant4/geant4-v11.2.0/source/CMakeLists.txt
  G4InteractorMessenger.cc
  G4UIArrayString.cc
  G4UIcsh.cc
????????...
^C
d:\geant4\geant4-v11.2.0-build>

@luca29q, I don’t think your issue is related to the original one at all, as your actually doing the build step which was missing in the original post. I’d suggest at this point creating your own post so as not to derail the original one given it’s not the same problem.

1 Like

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