Skip to contentSkip to conversation

package/zstd: fix libzstd.pc without threads

PATCH New Yegor Yefremov via buildroot 1 participant 1 message Nov 19 Zstd

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 package/zstd: fix libzstd.pc without threads

Without thread support, zstd is built with the lib-nomt targets, but installed with install-pc, which regenerates libzstd.pc with the multi-threaded defaults, adding -pthread to Libs.private. Linking statically against libzstd then fails, as there is no libpthread, e.g. for gd through tiff:

ld: cannot find -lpthread: No such file or directory

Use install-pc-nomt (or install-pc-mt with threads), like for the build, so that libzstd.pc matches the library. With threads, -pthread now goes into Libs and Cflags, as upstream intends for the multi-threaded library.

This issue has been present since commit a5cb0ff4c90a ("package/zstd:
bump to version 1.5.1"), as zstd 1.5.1 added -pthread to the Libs.private of libzstd.pc. It therefore affects 2022.02 and later, and all maintenance branches.

Fixes:
https://autobuild.buildroot.org/results/713077327702dc2b8bb127fa8ad5c8e62f23a58a

Fixes a5cb0ff4c90a9fcb068d41262946ef6a9aef9f7d ("package/zstd: bump to version 1.5.1")
Assisted-by Claude:claude-opus-5-5
---
 package/zstd/zstd.mk | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
package/zstd/zstd.mk +4 -1
index b0fbf3a1a5..0c7ca13d21 100644
@@ -100,10 +100,13 @@ define ZSTD_BUILD_CMDS
 	$(ZSTD_BUILD_PZSTD)
 endef
 
+# install-pc regenerates libzstd.pc, so it needs the same thread suffix
+# as the build, otherwise -pthread ends up in it even without threads.
 define ZSTD_INSTALL_STAGING_CMDS
 	$(TARGET_MAKE_ENV) $(TARGET_CONFIGURE_OPTS) $(MAKE) $(ZSTD_OPTS) \
 		DESTDIR=$(STAGING_DIR) PREFIX=/usr -C $(@D)/lib \
-		install-pc install-includes $(ZSTD_INSTALL_LIBS)
+		install-pc$(ZSTD_BUILD_LIBS_THREAD_SUFFIX) install-includes \
+		$(ZSTD_INSTALL_LIBS)
 endef
 
 define ZSTD_INSTALL_TARGET_CMDS
Signature · 6 lines
2.34.1

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot