Geant4 by default uses: -ftls-model=initial-exec -pthread if compiled with "threads". This prevents anything else on the system from dynamically loading the installed libraries, since, as the gcc manpage states: "The default without -fpic is initial-exec; with -fpic the default is global-dynamic." An example for such failure is https://github.com/gentoo/gentoo/pull/7088 . Simple reproducer, if ROOT is installed: root [1] gSystem->Load("/usr/lib64/libG4particles.so") cling::DynamicLibraryManager::loadLibrary(): /usr/lib64/libG4particles.so: cannot allocate memory in static TLS block (int) -1 Geant allows to select TLS model: https://its.cern.ch/jira/browse/GEANT-94 I am unsure whether this should be changed to global-dynamic by default, at least for 17.0 profiles. The gain would be that e.g. sci-physics/geant-vmc can be compiled even against sci-physics/geant[threads].
Just to be clear, the best solution here would be to remove -ftls-model parameter altogether and let compiler use its default.
The bug has been closed via the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=395a5469e0d79b72275ebb16275b1957dc65a7f4 commit 395a5469e0d79b72275ebb16275b1957dc65a7f4 Author: Guilherme Amadio <amadio@gentoo.org> AuthorDate: 2018-05-18 15:13:55 +0000 Commit: Guilherme Amadio <amadio@gentoo.org> CommitDate: 2018-05-18 15:35:26 +0000 sci-physics/geant: choose right tls model with USE=threads Closes: https://bugs.gentoo.org/648736 Package-Manager: Portage-2.3.38, Repoman-2.3.9 sci-physics/geant/geant-4.10.03-r1.ebuild | 1 + 1 file changed, 1 insertion(+)
I am using Geant4's own option for now, but asked upstream to provide a way to not add any -ftls-model option to the compilation flags in a later version. If this is not enough I will patch out the option by force, as suggested by mgorny.
(In reply to Guilherme Amadio from comment #3) > I am using Geant4's own option for now, but asked upstream to provide a way > to not add any -ftls-model option to the compilation flags in a later > version. If this is not enough I will patch out the option by force, as > suggested by mgorny. Thanks! I'll test =sci-physics/geant-4.10.03-r1[threads] against sci-physics/geant-vmc this weekend and provide feedback at the corresponding Github issue. However, does this not warrant a revbump? Otherwise, sci-physics/geant-vmc will still be broken for users with existing installations of =sci-physics/geant-4.10.03-r1[threads] unless they recompile explicitly. In any case, it's probably best to wait with a revbump until I have tested to confirm it actually works (even though I'm sure it will).
(In reply to Oliver Freyermuth from comment #4) > (In reply to Guilherme Amadio from comment #3) > > I am using Geant4's own option for now, but asked upstream to provide a way > > to not add any -ftls-model option to the compilation flags in a later > > version. If this is not enough I will patch out the option by force, as > > suggested by mgorny. > > Thanks! I'll test =sci-physics/geant-4.10.03-r1[threads] against > sci-physics/geant-vmc this weekend and provide feedback at the corresponding > Github issue. > > However, does this not warrant a revbump? Yes, it makes sense. I want to bump version to 10.4, and don't want everyone to rebuild twice. I already bumped clhep, let me finish bumping Geant4, then we can merge the PR.
Ok, understood! In any case, most people will already have rebuilt current Geant as a consequence of the clhep bump.