MaterialX icon indicating copy to clipboard operation
MaterialX copied to clipboard

make relocatable shared libs on MacOS / Linux (via relative RPATH)

Open pmolodo opened this issue 3 years ago • 2 comments

MR805 ensured a relocatable cmake config file, but the .so shared libs built on Linux are not themselves relocatable, as they have absolute paths baked into their RPATH/RUNPATH.

This fixes this issue by making the libs use a relative RPATH/RUNPATH.

pmolodo avatar Sep 08 '22 21:09 pmolodo

Hmm, need to fix the RPATH for the python libs...

pmolodo avatar Sep 08 '22 21:09 pmolodo

It seems this is failing the tests because the python libs are being copied into the python folder's site-packages dir, ie:

copying build/lib/MaterialX/PyMaterialXGenGlsl.cpython-37m-x86_64-linux-gnu.so.1.38.6 -> /opt/hostedtoolcache/Python/3.7.13/x64/lib/python3.7/site-packages/MaterialX

...and this is then how the modules are found (as opposed to modifying the PYTHONPATH). I suppose to deal with this scenario, and for maximum backward compatibility, I can also use the absolute build path as a last fallback...?

pmolodo avatar Sep 09 '22 00:09 pmolodo