Fix libzstd error on MacOS>=15.4
PATCH 1/1 Fix libzstd error on MacOS>=15.4
From: Etienne Cordonnier <[email protected]>
libzstd duplicates the LDFLAGS when compiling libzstd, and the dynamic loader of MacOS version 15.4 treats this duplicated LC_RPATH (two LC_RPATH pointing to the same path) as an error and refuses to load the library.
Reported upstream as https://github.com/facebook/zstd/issues/4369
Signed-off-by Etienne Cordonnier <[email protected]>
--- ...ix-duplicate-LC_RPATH-error-on-MacOS.patch | 48 +++++++++++++++++++ recipes-extended/zstd/zstd_%.bbappend | 2 + 2 files changed, 50 insertions(+) create mode 100644 recipes-extended/zstd/zstd/0001-Fix-duplicate-LC_RPATH-error-on-MacOS.patch
recipes-extended/zstd/zstd/0001-Fix-duplicate-LC_RPATH-error-on-MacOS.patch new file +48 -0
@@ -0,0 +1,48 @@ +From 30a4af206739e37d6203747792a6b15bf952483d Mon Sep 17 00:00:00 2001 +From: Etienne Cordonnier <[email protected]> +Date: Fri, 18 Apr 2025 14:37:50 +0200 +Subject: [PATCH] Fix duplicate LC_RPATH error on MacOS + +After the update to MacOS 15.4, the dynamic loader dyld treats duplicated LC_RPATH as an error. +The `FLAGS` variable already contains `LDFLAGS`, thus using both `FLAGS` and `LDFLAGS` +duplicates all `LDFLAGS`, including `-Wl,rpath` parameters. + +The duplicate LC_RPATH causes this kind of errors: + +``` +dyld[29361]: Library not loaded: @loader_path/../lib/libzstd.1.dylib + Referenced from: <7131C877-3CF0-33AC-AA05-257BA4FDD770> /Users/foobar/... + Reason: tried: '/Users/foobar/..../lib/libzstd.1.dylib' (duplicate LC_RPATH '/usr/mypath.../lib') +``` + +Upstream-Status: Pending +Signed-off-by: Etienne Cordonnier <[email protected]> +--- + lib/Makefile | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/lib/Makefile b/lib/Makefile +index a4cf61ab..e1ffba91 100644 +--- a/lib/Makefile ++++ b/lib/Makefile +@@ -160,7 +160,7 @@ $(ZSTD_DYNLIB): $(ZSTD_DYNLIB_OBJ) + $(if $(filter -DZSTD_MULTITHREAD,$(CPPFLAGS)),\ + @echo compiling multi-threaded dynamic library $(LIBVER),\ + @echo compiling single-threaded dynamic library $(LIBVER)) +- $(CC) $(FLAGS) $^ $(LDFLAGS) $(SONAME_FLAGS) -o $@ ++ $(CC) $(FLAGS) $^ $(SONAME_FLAGS) -o $@ + @echo creating versioned links + ln -sf $@ libzstd.$(SHARED_EXT_MAJOR) + ln -sf $@ libzstd.$(SHARED_EXT) +@@ -236,7 +236,7 @@ libzstd-nomt: LDFLAGS += -shared + libzstd-nomt: $(ZSTD_NOMT_FILES) + @echo compiling single-thread dynamic library $(LIBVER) + @echo files : $(ZSTD_NOMT_FILES) +- $(CC) $(FLAGS) $^ $(LDFLAGS) $(SONAME_FLAGS) -o $@ ++ $(CC) $(FLAGS) $^ $(SONAME_FLAGS) -o $@ + + .PHONY: clean + clean: +-- +2.43.0 +
recipes-extended/zstd/zstd_%.bbappend +2 -0
@@ -1,3 +1,5 @@ FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:" EXTRA_OEMAKE:append:darwin21 = " UNAME='Darwin'" + +SRC_URI:append:class-nativesdk = " file://0001-Fix-duplicate-LC_RPATH-error-on-MacOS.patch"
Signature · 1 line
2.43.0