Whamcloud - gitweb
Update shared library flags used for Apple/Darwin
authorTheodore Ts'o <tytso@mit.edu>
Thu, 18 Aug 2022 21:24:17 +0000 (17:24 -0400)
committerTheodore Ts'o <tytso@mit.edu>
Thu, 18 Aug 2022 21:24:17 +0000 (17:24 -0400)
commit558146c31d341faae62237eafc0c260bd785a2d7
tree6f34050e13d3b4262463833298ee595081799627
parentdc79c2ad59bde8918b0cc1d53f65119fcfdbb7b4
Update shared library flags used for Apple/Darwin

As submitted by Carlos Cabrera:

    We need to set the `-install_name` flag so that library consumers
    can find the linked libraries when installed outside the default
    dyld search path. This is the case, for example, when installed
    using the Homebrew package manager on Apple Silicon.

    I've removed the `-flat_namespace` flag because this flag is
    effectively deprecated, and can cause issues when using `dlopen`
    [1]. We also need to change `-undefined warning` to `-undefined
    dynamic_lookup`, since the former flag is not supported without
    `-flat_namespace`. Using `-undefined dynamic_lookup` instructs the
    dynamic loader to resolve undefined symbols at run/load-time.

    These are the flags used by Libtool on the newest versions of
    macOS, and we've applied similar patches to many other packages at
    Homebrew without any issues.

    [1] https://developer.apple.com/forums/thread/689991

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
lib/Makefile.darwin-lib