OS X Yosemite : Runtime path error

Use this forum for discussions specifically related to the Krakatoa SR C++ API.
For discussion of topics applicable to both the C++ and Py APIs, please use the parent forum.
nicholas_yue
Posts: 31
Joined: Tue Sep 13, 2011 11:43 pm

OS X Yosemite : Runtime path error

Postby nicholas_yue » Sat Dec 20, 2014 12:09 am

Hi,

OS X Yosemite complains about the embedded path in the libKrakatoaSR.dylib

$ /Users/nicholas/temp/kk/bin/example03
dyld: Library not loaded: /Users/cwiebe/Development/KrakatoaProject/KrakatoaSR/sharedlib/libKrakatoaSR.dylib
Referenced from: /Users/nicholas/temp/kk/bin/example03
Reason: image not found
Trace/BPT trap: 5

$ otool -L /Users/nicholas/temp/kk/bin/example03
/Users/nicholas/temp/kk/bin/example03:
/Users/cwiebe/Development/KrakatoaProject/KrakatoaSR/sharedlib/libKrakatoaSR.dylib (compatibility version 0.0.0, current version 0.0.0)


Cheers

User avatar
Conrad Wiebe
Posts: 774
Joined: Wed Aug 15, 2007 12:24 pm
Location: Thinkbox Software

Re: OS X Yosemite : Runtime path error

Postby Conrad Wiebe » Mon Dec 22, 2014 6:48 pm

Right, this has always been kind of an annoying problem when linking our 3rd party dynamic libraries. I'll do a test here and see if I can come up with a good solution for you.
Conrad Wiebe
Software Development Manager
Thinkbox Software

User avatar
Conrad Wiebe
Posts: 774
Joined: Wed Aug 15, 2007 12:24 pm
Location: Thinkbox Software

Re: OS X Yosemite : Runtime path error

Postby Conrad Wiebe » Mon Dec 22, 2014 8:34 pm

I reproduced your issue, and found a solution using "install_name_tool".

Here is a simple setup in OSX to build the most basic Krakatoa program:

Create hello.cpp:

Code: Select all

#include <krakatoasr_renderer.hpp>
int main() {
    krakatoasr::krakatoa_renderer r;
    r.render();
}


Then from the command line, build it like this:

Code: Select all

g++ -c -o hello.o hello.cpp -Ipath_to_ksr/include
g++ -o myexecutable hello.o -Lpath_to_ksr/lib-osx-x64 -lKrakatoaSR -ltbb -ltbbmalloc
install_name_tool -change /Users/cwiebe/Development/KrakatoaProject/KrakatoaSR/sharedlib/libKrakatoaSR.dylib ./libKrakatoaSR.dylib myexecutable


After this, make sure that KrakatoaSR.dylib, tbb.dylib and tbbmalloc.dylib are in the same directory as "myexecutable", and it should link and run. I will also include this repathing in the next release. Thank you for alerting me to the problem. Note: If you want it to work when the dylib files are not in the current directory, you will need to repath libtbb.dylib and libtbbmalloc.dylib also.

Does that get it working for you?
Conrad Wiebe
Software Development Manager
Thinkbox Software

nicholas_yue
Posts: 31
Joined: Tue Sep 13, 2011 11:43 pm

Re: OS X Yosemite : Runtime path error

Postby nicholas_yue » Tue Dec 23, 2014 12:45 am

I fixed it by doing the following

install_name_tool -id libKrakatoaSR.dylib <path to the libKrakatoaSR.dylib>

I think the above is the correct way so that specifying DYLD_LIBRARY_PATH will get all 3 shared libraries (including the 2 TBBs)

Cheers


Return to “Krakatoa SR C++ API”

Who is online

Users browsing this forum: No registered users and 1 guest