3

I'm having some issues with a library file compiled from C++, so I've used the otool command line utility (on OSX) to look at the files it links against.

This is the output:

! otool -L pyopenvdb.so 
pyopenvdb.so:
    pyopenvdb.so (compatibility version 0.0.0, current version 0.0.0)
    /usr/local/opt/tbb/lib/libtbb.dylib (compatibility version 0.0.0, current version 0.0.0)
    /usr/local/lib/libHalf.11.dylib (compatibility version 12.0.0, current version 12.0.0)
    /usr/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.2.5)
    /usr/local/lib/libIlmImf-Imf_2_1.21.dylib (compatibility version 22.0.0, current version 22.0.0)
    /usr/local/lib/libjemalloc.1.dylib (compatibility version 0.0.0, current version 0.0.0)
    /System/Library/Frameworks/Python.framework/Versions/2.7/Python (compatibility version 2.7.0, current version 2.7.5)
    libboost_python.dylib (compatibility version 0.0.0, current version 0.0.0)
    libopenvdb.so.2.3.0 (compatibility version 0.0.0, current version 0.0.0)
    /usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 120.0.0)
    /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1197.1.1)

Most of the files linked against are referenced by an absolute path, e.g. /usr/local/opt/tbb/lib/libtbb.dylib.

However, some are referenced by what seems to be a relative path, just as filenames, e.g. libboost_python.dylib.

What does this mean?

Does it mean that at runtime a different version of libboost_python.dylib could be linked against, depending on what is found first on the path? Or is it some other method by which these 'relative' paths are searched?

1 Answer 1

3

This is no problem. That means that you library with out a absolute path are relative with respect to the thing you have otool'ed (pyopenvdb.so). However, if you would like to standardise it, you can change the path with install_name_tool. In the case you mentioned, use the -change argument.

Usage: install_name_tool [-change old new] ... [-rpath old new] ... [-add_rpath new] ... [-delete_rpath old] ... [-id name] input

For example, install_name_tool pyopencdv.so -change libboost_python.dylib /usr/local/lib/libboost_python.dylib

Note that you also see that pyopenvdb.so references itself too, in the first line of output. Of course that is a relative path, but even that can be changed to an absolute path if you'd like using install_name_tool, for that, use the '-id' argument.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.