I get the successfull check for Filesystem library and libstdc++
appears in the output of ldd
for both files. I attach all outputs below.
From the output of bt
in Line #2 I see the error comes from the nullpointer during the destruction of std::filesystem::path
.
From this Forum I read that this is a known bug from gcc and can be resolved by linking -lstdc++fs
. Is there a clean way to add this link to the installation of Geant4? (I suppose one had to modify the CMakeList somewhere)
Output of bt
:
#0 std::filesystem::__cxx11::path::~path (this=0x0, __in_chrg=<optimized out>) at /usr/include/c++/8/bits/fs_path.h:207
#1 0x00007ffff6ac3804 in std::filesystem::__cxx11::path::_Cmpt::~_Cmpt (this=0x0, __in_chrg=<optimized out>) at /usr/include/c++/8/bits/fs_path.h:642
#2 std::_Destroy<std::filesystem::__cxx11::path::_Cmpt> (__pointer=0x0) at /usr/include/c++/8/bits/stl_construct.h:98
#3 std::_Destroy_aux<false>::__destroy<std::filesystem::__cxx11::path::_Cmpt*> (__last=<optimized out>, __first=0x0) at /usr/include/c++/8/bits/stl_construct.h:108
#4 std::_Destroy<std::filesystem::__cxx11::path::_Cmpt*> (__last=<optimized out>, __first=<optimized out>) at /usr/include/c++/8/bits/stl_construct.h:137
#5 std::_Destroy<std::filesystem::__cxx11::path::_Cmpt*, std::filesystem::__cxx11::path::_Cmpt> (__last=0x2, __first=<optimized out>) at /usr/include/c++/8/bits/stl_construct.h:206
#6 std::vector<std::filesystem::__cxx11::path::_Cmpt, std::allocator<std::filesystem::__cxx11::path::_Cmpt> >::~vector (this=0x6c71e0, __in_chrg=<optimized out>)
at /usr/include/c++/8/bits/stl_vector.h:567
#7 std::filesystem::__cxx11::path::~path (this=0x6c71c0, __in_chrg=<optimized out>) at /usr/include/c++/8/bits/fs_path.h:207
#8 0x00007ffff0ee2b14 in std::filesystem::__cxx11::path::_Cmpt::~_Cmpt (this=0x6c71c0, __in_chrg=<optimized out>) at /usr/include/c++/8/bits/fs_path.h:642
#9 std::_Destroy<std::filesystem::__cxx11::path::_Cmpt> (__pointer=0x6c71c0) at /usr/include/c++/8/bits/stl_construct.h:98
#10 std::_Destroy_aux<false>::__destroy<std::filesystem::__cxx11::path::_Cmpt*> (__last=<optimized out>, __first=0x6c71c0) at /usr/include/c++/8/bits/stl_construct.h:108
#11 std::_Destroy<std::filesystem::__cxx11::path::_Cmpt*> (__last=<optimized out>, __first=<optimized out>) at /usr/include/c++/8/bits/stl_construct.h:137
#12 std::_Destroy<std::filesystem::__cxx11::path::_Cmpt*, std::filesystem::__cxx11::path::_Cmpt> (__last=0x0, __first=<optimized out>) at /usr/include/c++/8/bits/stl_construct.h:206
#13 std::vector<std::filesystem::__cxx11::path::_Cmpt, std::allocator<std::filesystem::__cxx11::path::_Cmpt> >::~vector (this=0x7fffffffcca0, __in_chrg=<optimized out>)
at /usr/include/c++/8/bits/stl_vector.h:567
#14 std::filesystem::__cxx11::path::~path (this=0x7fffffffcc80, __in_chrg=<optimized out>) at /usr/include/c++/8/bits/fs_path.h:207
#15 G4FindDataDir (name=name@entry=0x7ffff2a4ce51 "G4ENSDFSTATEDATA") at /home/ams/Documents/geant4-v11.2.1/source/global/management/src/G4FindDataDir.cc:112
#16 0x00007ffff29cd0dc in G4NuclideTable::GenerateNuclide (this=0x7ffff2c74c80 <G4NuclideTable::GetInstance()::instance>)
at /home/ams/Documents/geant4-v11.2.1/source/particles/management/src/G4NuclideTable.cc:165
#17 0x00007ffff29cd8fd in G4NuclideTable::G4NuclideTable (this=0x7ffff2c74c80 <G4NuclideTable::GetInstance()::instance>)
at /home/ams/Documents/geant4-v11.2.1/source/particles/management/src/G4NuclideTable.cc:60
#18 0x00007ffff29cd964 in G4NuclideTable::GetInstance () at /home/ams/Documents/geant4-v11.2.1/source/particles/management/src/G4NuclideTable.cc:46
#19 0x00007ffff29bac79 in G4IonTable::PrepareNuclideTable (this=this@entry=0x6c5570) at /home/ams/Documents/geant4-v11.2.1/source/particles/management/src/G4IonTable.cc:1336
#20 0x00007ffff29bf8e5 in G4IonTable::G4IonTable (this=0x6c5570) at /home/ams/Documents/geant4-v11.2.1/source/particles/management/src/G4IonTable.cc:128
#21 0x00007ffff29d5cd8 in G4ParticleTable::G4ParticleTable (this=0x7ffff2c74ec0 <G4ParticleTable::GetParticleTable()::theParticleTable>)
at /home/ams/Documents/geant4-v11.2.1/source/particles/management/src/G4ParticleTable.cc:123
#22 0x00007ffff29d71fc in G4ParticleTable::GetParticleTable () at /home/ams/Documents/geant4-v11.2.1/source/particles/management/src/G4ParticleTable.cc:85
#23 0x00007ffff532f681 in G4PrimaryTransformer::G4PrimaryTransformer (this=0x6c4820) at /home/ams/Documents/geant4-v11.2.1/source/event/src/G4PrimaryTransformer.cc:46
#24 0x00007ffff53163f6 in G4EventManager::G4EventManager (this=0x6a4b40) at /home/ams/Documents/geant4-v11.2.1/source/event/src/G4EventManager.cc:74
#25 0x00007ffff55f4f52 in G4RunManagerKernel::G4RunManagerKernel (this=0x6a7ee0, rmkType=G4RunManagerKernel::masterRMK)
at /home/ams/Documents/geant4-v11.2.1/source/run/src/G4RunManagerKernel.cc:211
#26 0x00007ffff55ccc75 in G4MTRunManagerKernel::G4MTRunManagerKernel (this=0x6a7ee0) at /home/ams/Documents/geant4-v11.2.1/source/run/src/G4MTRunManagerKernel.cc:72
#27 0x00007ffff55da025 in G4RunManager::G4RunManager (this=0x6a79d0, rmType=G4RunManager::masterRM) at /home/ams/Documents/geant4-v11.2.1/source/run/src/G4RunManager.cc:157
#28 0x00007ffff55c95ee in G4MTRunManager::G4MTRunManager (this=0x6a79d0) at /home/ams/Documents/geant4-v11.2.1/source/run/src/G4MTRunManager.cc:121
#29 0x00007ffff55fd202 in G4TaskRunManager::G4TaskRunManager (this=0x6a79d0, task_queue=0x0, useTBB=<optimized out>, grainsize=0)
at /home/ams/Documents/geant4-v11.2.1/source/run/src/G4TaskRunManager.cc:78
#30 0x00007ffff55de95e in G4RunManagerFactory::CreateRunManager (_type=G4RunManagerType::Tasking, _type@entry=G4RunManagerType::Default, _queue=_queue@entry=0x0,
fail_if_unavail=<optimized out>, fail_if_unavail@entry=true, nthreads=nthreads@entry=0) at /home/ams/Documents/geant4-v11.2.1/source/run/src/G4RunManagerFactory.cc:124
#31 0x0000000000406dac in main (argc=1, argv=0x7fffffffdef8) at /home/ams/Documents/B1/exampleB1.cc:63
Output of cmake config:
ams@localhorst:~/Documents/geant4-v11.2.1-build> cmake ../geant4-v11.2.1
-- Checking C++ feature CXXSTDLIB_FILESYSTEM_NATIVE - Success
-- Pre-configuring dataset G4NDL (4.7)
-- Pre-configuring dataset G4EMLOW (8.5)
-- Pre-configuring dataset PhotonEvaporation (5.7)
-- Pre-configuring dataset RadioactiveDecay (5.6)
-- Pre-configuring dataset G4PARTICLEXS (4.0)
-- Pre-configuring dataset G4PII (1.3)
-- Pre-configuring dataset RealSurface (2.2)
-- Pre-configuring dataset G4SAIDDATA (2.0)
-- Pre-configuring dataset G4ABLA (3.3)
-- Pre-configuring dataset G4INCL (1.2)
-- Pre-configuring dataset G4ENSDFSTATE (2.3)
*WARNING*
Geant4 has been pre-configured to look for datasets
in the directory:
/usr/local/share/Geant4/data
but the following datasets are NOT present on disk at
that location:
G4NDL (4.7)
G4EMLOW (8.5)
PhotonEvaporation (5.7)
RadioactiveDecay (5.6)
G4PARTICLEXS (4.0)
G4PII (1.3)
RealSurface (2.2)
G4SAIDDATA (2.0)
G4ABLA (3.3)
G4INCL (1.2)
G4ENSDFSTATE (2.3)
If you want to have these datasets installed automatically
simply re-run cmake and set the GEANT4_INSTALL_DATA
variable to ON. This will configure the build to download
and install these datasets for you. For example, on the
command line, do:
cmake -DGEANT4_INSTALL_DATA=ON <otherargs>
The variable can also be toggled in ccmake or cmake-gui.
If you're running on a Windows system, this is the best
solution as CMake will unpack the datasets for you
without any further software being required
Alternatively, you can install these datasets manually
now or after you have installed Geant4. To do this,
download the following files:
https://cern.ch/geant4-data/datasets/G4NDL.4.7.tar.gz
https://cern.ch/geant4-data/datasets/G4EMLOW.8.5.tar.gz
https://cern.ch/geant4-data/datasets/G4PhotonEvaporation.5.7.tar.gz
https://cern.ch/geant4-data/datasets/G4RadioactiveDecay.5.6.tar.gz
https://cern.ch/geant4-data/datasets/G4PARTICLEXS.4.0.tar.gz
https://cern.ch/geant4-data/datasets/G4PII.1.3.tar.gz
https://cern.ch/geant4-data/datasets/G4RealSurface.2.2.tar.gz
https://cern.ch/geant4-data/datasets/G4SAIDDATA.2.0.tar.gz
https://cern.ch/geant4-data/datasets/G4ABLA.3.3.tar.gz
https://cern.ch/geant4-data/datasets/G4INCL.1.2.tar.gz
https://cern.ch/geant4-data/datasets/G4ENSDFSTATE.2.3.tar.gz
and unpack them under the directory:
/usr/local/share/Geant4/data
As we supply the datasets packed in gzipped tar files,
you will need the 'tar' utility to unpack them.
Nota bene: Missing datasets will not affect or break
compilation and installation of the Geant4
libraries.
-- The following Geant4 features are enabled:
CMAKE_CXX_STANDARD: 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
-- Configuring done
-- Generating done
-- Build files have been written to: /home/ams/Documents/geant4-v11.2.1-build
Output of ldd
ams@localhorst:/usr/local/lib64> ldd libG4global.so
linux-vdso.so.1 (0x00007fffc2334000)
libG4clhep.so => /usr/local/lib64/libG4clhep.so (0x00007f2ef36e7000)
libG4ptl.so.2 => /usr/local/lib64/libG4ptl.so.2 (0x00007f2ef34ba000)
libstdc++.so.6 => /usr/lib64/libstdc++.so.6 (0x00007f2ef30df000)
libm.so.6 => /lib64/libm.so.6 (0x00007f2ef2d9e000)
libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x00007f2ef2b85000)
libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f2ef2965000)
libc.so.6 => /lib64/libc.so.6 (0x00007f2ef2590000)
/lib64/ld-linux-x86-64.so.2 (0x00007f2ef3c18000)
ams@localhorst:~/Documents/B1/build> ldd exampleB1
linux-vdso.so.1 (0x00007ffd4a1b0000)
libG4Tree.so => /usr/local/lib64/libG4Tree.so (0x00007f7489a30000)
libG4FR.so => /usr/local/lib64/libG4FR.so (0x00007f748981b000)
libG4GMocren.so => /usr/local/lib64/libG4GMocren.so (0x00007f74895d6000)
libG4visHepRep.so => /usr/local/lib64/libG4visHepRep.so (0x00007f74893bc000)
libG4RayTracer.so => /usr/local/lib64/libG4RayTracer.so (0x00007f7489190000)
libG4VRML.so => /usr/local/lib64/libG4VRML.so (0x00007f7488f7f000)
libG4ToolsSG.so => /usr/local/lib64/libG4ToolsSG.so (0x00007f7488bab000)
libG4vis_management.so => /usr/local/lib64/libG4vis_management.so (0x00007f7488846000)
libG4modeling.so => /usr/local/lib64/libG4modeling.so (0x00007f7488550000)
libG4interfaces.so => /usr/local/lib64/libG4interfaces.so (0x00007f7488329000)
libG4mctruth.so => /usr/local/lib64/libG4mctruth.so (0x00007f7488101000)
libG4geomtext.so => /usr/local/lib64/libG4geomtext.so (0x00007f7487e78000)
libG4error_propagation.so => /usr/local/lib64/libG4error_propagation.so (0x00007f7487c3b000)
libG4readout.so => /usr/local/lib64/libG4readout.so (0x00007f7487a31000)
libG4physicslists.so => /usr/local/lib64/libG4physicslists.so (0x00007f74876b9000)
libG4run.so => /usr/local/lib64/libG4run.so (0x00007f74873e0000)
libG4event.so => /usr/local/lib64/libG4event.so (0x00007f748715d000)
libG4tracking.so => /usr/local/lib64/libG4tracking.so (0x00007f7486f07000)
libG4parmodels.so => /usr/local/lib64/libG4parmodels.so (0x00007f7486cd8000)
libG4processes.so => /usr/local/lib64/libG4processes.so (0x00007f7484fbd000)
libG4digits_hits.so => /usr/local/lib64/libG4digits_hits.so (0x00007f7484d01000)
libG4track.so => /usr/local/lib64/libG4track.so (0x00007f7484ae5000)
libG4particles.so => /usr/local/lib64/libG4particles.so (0x00007f74847ba000)
libG4geometry.so => /usr/local/lib64/libG4geometry.so (0x00007f748429d000)
libG4materials.so => /usr/local/lib64/libG4materials.so (0x00007f7483fb7000)
libG4graphics_reps.so => /usr/local/lib64/libG4graphics_reps.so (0x00007f7483d63000)
libG4analysis.so => /usr/local/lib64/libG4analysis.so (0x00007f7483641000)
libexpat.so.1 => /usr/lib64/libexpat.so.1 (0x00007f748340f000)
libG4zlib.so => /usr/local/lib64/libG4zlib.so (0x00007f74831f7000)
libG4intercoms.so => /usr/local/lib64/libG4intercoms.so (0x00007f7482f94000)
libG4global.so => /usr/local/lib64/libG4global.so (0x00007f7482d09000)
libG4clhep.so => /usr/local/lib64/libG4clhep.so (0x00007f7482a63000)
libG4ptl.so.2 => /usr/local/lib64/libG4ptl.so.2 (0x00007f7482836000)
libstdc++.so.6 => /usr/lib64/libstdc++.so.6 (0x00007f748245b000)
libm.so.6 => /lib64/libm.so.6 (0x00007f748211a000)
libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x00007f7481f01000)
libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f7481ce1000)
libc.so.6 => /lib64/libc.so.6 (0x00007f748190c000)
/lib64/ld-linux-x86-64.so.2 (0x00007f7489c43000)