pace-neutrons / pace-python

Python module of the PACE inelastic neutron data analysis suite of programs.
GNU General Public License v3.0
3 stars 4 forks source link

Use of LD_LIBRARY_PATH on Linux #4

Closed mducle closed 3 years ago

mducle commented 3 years ago

On Linux systems, users must set the LD_LIBRARY_PATH environment variable before starting Python.

At present, the initialisation routines tries to detect where Matlab / MCR is installed and sets this programmatically but this does not seem to be respected by the mex files and it fails to load its required libraries.

If symlinks to the required libraries (libmex.so and libMatlabDataArray.so) are provided then a segfault occurs due to incompatibility between the Matlab binaries and the system / Python libstdc++.so.6 and libgcc_s.so.1. (When LD_LIBRARY_PATH is defined it is search first before all other search paths so the Matlab provided libraries are picked up when Python loads).

mducle commented 3 years ago

Seems the only way to solve this is to run then restart the interpreter with os.execv

See: https://stackoverflow.com/questions/6543847/setting-ld-library-path-from-inside-python

mducle commented 3 years ago

This is fixed by the new wrapper script.