Skip to content

Adjust references to the external libraries for Python packages to allow relocation (MacOS only)

Ammar Nejati requested to merge fixRPATH_OSX into main

MacOS has a peculiar way of locating dynamical libraries (dylibs): Unlike other *NIXes, the Darwin linker, dyld, by default locates dependent dynamic libraries using the full path to each dylib. This leads to a problem for making Python packages which require relocatable libraries.

To eliminate this issue, first, the references to the external libraries (like libfftw3.dylib) must be adjusted in BornAgain libraries (like libBornAgainBase) to allow relocation. Therefore a MacOS-specific script is added to adjust the library references to make them relocatable (Wrap/adjust_rpath_osx.sh). This script extracts the library ids of the external dylibs and produces another shell script which can be used to adjust the library paths corresponding to the external dylibs in a given BornAgain dylib (like libBornAgainBase). The script uses MacOS-specific tools otool and install_name_tool.

Secondly, a proper rpath must be added to the libraries for Python packages.

In addition, the formfactor library is added to the Python package -- it was forgotten before.

Related to #96 (closed)

Edited by Ammar Nejati

Merge request reports

Loading