Hello. (hold for a moment, I'll get to the point) I'm developing addon for Blender and I'm trying to make it work on MacOS m1 too. I'm using hppfcl
library for the addon and whenever I'm trying to import it from python I get the error below.
Error: Python: Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/Users/m1/Library/Application Support/Blender/3.6/scripts/addons/blenderbim/libs/site/packages/hppfcl/__init__.py", line 34, in <module>
from .hppfcl import *
ImportError: dlopen(/Users/m1/Library/Application Support/Blender/3.6/scripts/addons/blenderbim/libs/site/packages/hppfcl/hppfcl.cpython-310-darwin.so, 0x0002): Symbol not found: __ZN5boost6python15instance_holder8allocateEP7_objectmm
Referenced from: /Users/m1/Library/Application Support/Blender/3.6/scripts/addons/blenderbim/libs/site/packages/hppfcl/hppfcl.cpython-310-darwin.so
Expected in: /Applications/Blender.app/Contents/Resources/lib/libboost_python310.dylib
The error is caused by the fact that /Applications/Blender.app/Contents/Resources/lib/libboost_python310.dylib
is incompatible with hppfcl
. I have compatible version in /Users/m1/Library/Application Support/Blender/3.6/scripts/addons/blenderbim/libs/libboost_python310.dylib
.
❓Mine question is how to make scripts/addons/blenderbim/libs/libboost_python310.dylib
either main library to be loaded for hppfcl
or for the entire Blender (this will work too)?
What I've tried and researched:
- If I check
hppfcl
library withotool -l hppfcl.cpython-310-darwin.so
it's referring to the correct library that should be compatible given that/scripts/addons/blenderbim/libs/site/packages/hppfcl/../../../libboost_python310.dylib
=>/scripts/addons/blenderbim/libs/libboost_python310.dylib
.
Load command 20
cmd LC_RPATH
cmdsize 40
path @loader_path/../../../ (offset 12)
- If i run
otool -l /Applications/Blender.app/Contents/MacOS/Blender
I see why error is referring to/Resources/lib/libboost_python310.dylib
. So it seems thathppfcl
@loader_path
is overriden by Blender's@loader_path
.
Load command 65
cmd LC_RPATH
cmdsize 48
path @loader_path/../Resources/lib (offset 12)
- I tried to use
export DYLD_LIBRARY_PATH="/Users/m1/Library/Application Support/Blender/3.6/scripts/addons/blenderbim/libs/:$DYLD_LIBRARY_PATH"
(and same thing withDYLD_FALLBACK_LIBRARY_PATH
) before starting Blender which lead to no success -DYLD_LIBRARY_PATH
is purged when I start Blender (deduced it by checkingos.environ
from python). I guess it's because Blender is protected process and the only way around it so either rebuild with different build settings or to disable system integrity protection (both are very bad options for the addon).