C++ Extension Working In KL But Not In Python Client

davisadam10davisadam10 Posts: 11
edited April 2016 in Python Bindings

Hey Guys,

I am having some trouble with the python binding for fabric. Im pretty sure this is environment configuration, but I cant see what for the life of me i'm missing.

In kl, if I do

require FabricTestExtension;

this loads and all of the code + unit tests work great.

If I try and load the same extension from the same environment via the python bindings such as

import FabricEngine.Core as fabric
client = fabric.createClient()

I get the below error.

unable to open 'libFabricTestExtension-Darwin-x86_64.dylib': dlopen(/Users/adam/dev/workspace/git/MyFabricExts//FabricTestExtension/libFabricTestExtension-Darwin-x86_64.dylib, 5): Library not loaded: @executable_path/libtestextension.dylib

All the native fabric extenstions ie Math seem to load fine.

As I say I have this working fine in kl so the FABRIC_EXTS_PATH & LD_LIBRARY_PATH must be correct or this would not be working, the PYTHONPATH also seems correct or it would not be picking up any of the native fabric stuff.

Any ideas what im missing?





  • borjaborja Administrator, Fabric Employee Posts: 480 admin

    Hi @davisadam10

    I assume you mean DYLD_LIBRARY_PATH instead of LD_LIBRARY_PATH (The OS X equivalent). In any case, your 'libFabricTestExtension-Darwin-x86_64.dylib' is trying to load another dylib called libtestextension.dylib Where is this one located?
    Would it be possible for you to share your setup with us? (you can send it to me with a Private message and it would, of course, be confidential).

    Borja Morales
    Technical Product Manager
    Fabric Software Inc.

  • davisadam10davisadam10 Posts: 11

    Hey Borja,

    Yes I do mean DYLD_LIBRARY_PATH, Im having the same issue on Linux as well as OSX.

    I had come to the same conclusion regarding the missing libtestextension.dylib but the path to this is included in the variable and as I say its working fine through kl, which would have the same issue if the path was missing.

    Ill try and bundle this up into a repo and send it over a pm to you when I get a minute.

  • davisadam10davisadam10 Posts: 11

    Ok so figured this out, kind of.

    On Linux i was just being stupid and had an error in the path, my bad.

    But the OSX one is proving to be more of an OSX thing now than a Fabric issue.

    If you set the DYLD_LIBRARY_PATH in you bash_profile in the terminal this is set, ie echo $DYLD_LIBRARY_PATH
    gives me the same as I have set.

    kl then runs, finds the libs and all is good.

    But in python from the same terminal if you do

    import os
    print os.environ.keys()

    The DYLD_LIBRARY_PATH is not there, which explains why it all errors out in python.

    Looking around it sounds like there was an update to OSX which strips out any variables starting with DYLD from any subprocesses which are launched. Which is great :(

    Anyone have any ideas how we work around this? As cant find a straight answer so far...


Sign In or Register to comment.