When you install geant4, cmake produces a geant4.sh shell script in <install-dir>/bin/. If you use an external dependency such as CLHEP or Xerces, the path to these libraries is appended to the DYLD_LIBRARY_PATH. These libraries exist in directories with other libraries and adding this path to the DYLD_LIBRARY_PATH variable results in breaking most of the mac operating system from the terminal. Adding these in nominally unnecessary as the Geant4 libraries should be compiled with the path of the libraries used. For example, this breaks anything using libPNG... From my understanding, the DYLD_LIBRARY_PATH should only be used for development to override any libraries an executable may have been compiled with. Please can this be removed. We require external CLHEP for additional functionality not in the Geant4 version and we require both Geant4 and our application to be built against only one set of CLHEP libraries to ensure we don't have two underlying random number generators and our simulation is strongly reproducible. We require Xerces for the GDML package in Geant4. My group typically gets CLHEP and Xerces through macports so the libraries exist in /opt/local/lib along with many other libraries. If someone installs from source themselves, the libraries will also be alongside other libraries so this problem will still exist. Sourcing this breaks for example the 'open' command in mac OS terminal. Offending lines in my <install-dir>/bin/geant4.sh (I've commented out): #----------------------------------------------------------------------- # Setup Third-party binary and library paths... # - CLHEP #if test "x$DYLD_LIBRARY_PATH" = "x" ; then # export DYLD_LIBRARY_PATH=/opt/local/lib #else # export DYLD_LIBRARY_PATH=${DYLD_LIBRARY_PATH}:/opt/local/lib #fi # - XercesC #if test "x$DYLD_LIBRARY_PATH" = "x" ; then # export DYLD_LIBRARY_PATH=/opt/local/lib #else # export DYLD_LIBRARY_PATH=${DYLD_LIBRARY_PATH}:/opt/local/lib #fi Many thanks, Laurie
Fixed in the current development in tag cmake-V10-03-17. This should be in the next patch and release.
Hello, This appears to still be a problem. The latest two patched version of Geant4.10.3 (July and October 2017) don't fix this. The problem is still the same - the <install-dir>/bin/geant4.sh appends the paths for 3rd party libraries to DYLD_LIBRARY_PATH, which breaks mac installations. This happens on macs when your environment is either from homebrew or macports, which are common setups. We're having to advise users of our geant4-based framework of this problem and help them correct it often. If this could either be removed or the feature turned off by default this would be very helpful! Many thanks, Laurie
Apologies, this was an oversight in the patches due to a fairly complex merge in other developments. It will be in 10.4 and any further patches to 10.3. For clarity, which versions of macOS are you supporting, and do these have SIP enabled? DYLD_LIBRARY_PATH shouldn't have any effect on macOS >= 10.11 (El Capitan) assuming SIP is enabled.
Hello, Thanks for including this now. We use a variety of versions of MacOSX from 10.11.6 (el Capitan) onwards. Personally, I have SIP disabled as is required for some debugging / IDEs, but others in my group have it on. With SIP on, you're right, executables and the shell are protected from the DYLD_LIBRARY_PATH variable, however, Python still picks this up (its own behaviour to inspect this variable), which in turn breaks a lot of python libraries. If it's not strictly required, it is good to remove though rather than rely on the environment. Thanks for fixing!