Skip to content
  • Alexey Matveichev's avatar
    ENH: reimplement Foam::dlOpen() for macOS (#2801) · f584ec97
    Alexey Matveichev authored and Mark OLESEN's avatar Mark OLESEN committed
    - The Apple SIP (System Integrity Protection) clears environment
      variables, which affects the behaviour of dynamic library loading
      (the DYLD_LIBRARY_PATH env variable).
    
      OpenFOAM shadows this variable as FOAM_LD_LIBRARY_PATH, which has
      been used to restore DYLD_LIBRARY_PATH (eg, in RunFunctions script).
    
      However, this solution is not quite complete, as it
        (a) requires sourcing of RunFunctions file,
        (b) additional errors appear depending on a user workflow.
    
      This changeset alleviates the problem by also iterating through
      paths stored in the shadow variable when loading dynamic libraries
      (if the DYLD_LIBRARY_PATH is empty).
    f584ec97