Skip to content

Fix install names of boost libraries on OSX #35

Description

@kordejong

The install names don't contain the path to the libraries. An application linking to the libraries cannot be started without tricks like DYLD_LIBRARY_PATH. Fixup the boost libraries after installation with a script like this:

set -e

for filename in *.dylib; do

    # Change id name of shared each library. It must be the absolute
    # pathname of the library.
    # The id name of a shared library is also called its install name.
    install_name_tool -id $(realpath $filename) $filename


    # Change install names of all local libraries that are *referenced*
    # by each library.
    install_names=`
        otool -L $filename |  # List install names.
        sed '1,2d' |          # Skip the name of ourselves.
        sed 's/^\s//' |       # Get rid of leading whitespace.
        sed 's/\s.*$//'       # Get rid of trailing whitespace.
    `

    library_directory=$(dirname $(realpath $filename))

    for install_name in $install_names; do
        # If this is one of the neighboring shared libraries, then replace
        # its install name by the absolute pathname.
        install_name_directory=$(dirname $(realpath $install_name))

        if [[ $install_name_directory == $library_directory ]]; then
            install_name_tool -change $install_name $(realpath $install_name) $filename 
        fi  
    done
done

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions