Skip to content
This repository has been archived by the owner on Jul 15, 2023. It is now read-only.

Fix library install_name on OS X #62

Open
ryandesign opened this issue Dec 10, 2012 · 0 comments
Open

Fix library install_name on OS X #62

ryandesign opened this issue Dec 10, 2012 · 0 comments

Comments

@ryandesign
Copy link

The install_name of the library is not correct on OS X. Here's what the library looks like when building field3d 1.3.2 in MacPorts:

$ otool -L /opt/local/var/macports/build/_Users_rschmidt_macports_dports_graphics_field3d/field3d/work/Field3D-1.3.2/install/darwin/m64/release/lib/libField3D.dylib
/opt/local/var/macports/build/_Users_rschmidt_macports_dports_graphics_field3d/field3d/work/Field3D-1.3.2/install/darwin/m64/release/lib/libField3D.dylib:
    /opt/local/var/macports/build/_Users_rschmidt_macports_dports_graphics_field3d/field3d/work/Field3D-1.3.2/install/darwin/m64/release/lib/libField3D.dylib (compatibility version 0.0.0, current version 0.0.0)
    /opt/local/lib/libHalf.6.dylib (compatibility version 7.0.0, current version 7.0.0)
    /opt/local/lib/libIex.6.dylib (compatibility version 7.0.0, current version 7.0.0)
    /opt/local/lib/libImath.6.dylib (compatibility version 7.0.0, current version 7.0.0)
    /opt/local/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.2.7)
    /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 169.3.0)
    /opt/local/lib/libhdf5.7.dylib (compatibility version 8.0.0, current version 8.3.0)
    /opt/local/lib/libboost_thread-mt.dylib (compatibility version 0.0.0, current version 0.0.0)
    /opt/local/lib/libboost_system-mt.dylib (compatibility version 0.0.0, current version 0.0.0)
    /usr/lib/libstdc++.6.dylib (compatibility version 7.0.0, current version 56.0.0)

/opt/local/var/macports/build/_Users_rschmidt_macports_dports_graphics_field3d/field3d/work/Field3D-1.3.2/install/darwin/m64/release/lib/libField3D.dylib is the location of the library on disk at build time, but that should not be the path baked into the library as its install_name (shown as the first line of output from otool -L); the install_name needs to be the absolute path the library will have after installation, for example in the case of MacPorts /opt/local/lib/libField3D.dylib. In MacPorts we are fixing this by running install_name_tool manually after the build, but it would be better if you fixed it in your build system.

You should also be setting the current_version and compatibility_version of the library as befits your library version numbering scheme.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant