aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTheodore Ts'o <tytso@mit.edu>2022-08-18 17:24:17 -0400
committerTheodore Ts'o <tytso@mit.edu>2022-08-18 17:24:17 -0400
commit558146c31d341faae62237eafc0c260bd785a2d7 (patch)
tree6f34050e13d3b4262463833298ee595081799627
parentdc79c2ad59bde8918b0cc1d53f65119fcfdbb7b4 (diff)
downloade2fsprogs-558146c31d341faae62237eafc0c260bd785a2d7.tar.gz
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>
-rw-r--r--lib/Makefile.darwin-lib3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/Makefile.darwin-lib b/lib/Makefile.darwin-lib
index 95cdd4b49..95e8ee066 100644
--- a/lib/Makefile.darwin-lib
+++ b/lib/Makefile.darwin-lib
@@ -24,7 +24,8 @@ image: $(BSD_LIB)
$(BSD_LIB): $(OBJS)
$(E) " GEN_BSD_SOLIB $(BSD_LIB)"
$(Q) (cd pic; $(CC) -dynamiclib -compatibility_version 1.0 -current_version $(BSDLIB_VERSION) \
- -flat_namespace -undefined warning -o $(BSD_LIB) $(OBJS))
+ -install_name $(BSDLIB_INSTALL_DIR)/$(BSD_LIB) \
+ -undefined dynamic_lookup -o $(BSD_LIB) $(OBJS))
$(Q) $(MV) pic/$(BSD_LIB) .
$(Q) $(RM) -f ../$(BSD_LIB)
$(Q) (cd ..; $(LN) $(LINK_BUILD_FLAGS) \