Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Thomas De Schampheleire <patrickdepinguin@gmail.com>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCHv2 1/2] package/zstd: build multithreaded library if supported
Date: Fri,  4 Dec 2020 10:57:01 +0100	[thread overview]
Message-ID: <20201204095703.4714-1-patrickdepinguin@gmail.com> (raw)

From: Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>

libzstd.so is built without multi-threading support by default.
The 'HAVE_THREAD' flag is not respected by lib/Makefile, only by
programs/Makefile.

Use the %-mt recipe in lib/Makefile to enable multithreading.

Signed-off-by: Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
---
v2: split off of next patch

 package/zstd/zstd.mk | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/package/zstd/zstd.mk b/package/zstd/zstd.mk
index 35002da332..37c1a8d687 100644
--- a/package/zstd/zstd.mk
+++ b/package/zstd/zstd.mk
@@ -48,6 +48,14 @@ ZSTD_BUILD_LIBS = libzstd.a libzstd
 ZSTD_INSTALL_LIBS = install-static install-shared
 endif
 
+# The HAVE_THREAD flag is read by the 'programs' makefile but not by  the 'lib'
+# one. Building a multi-threaded binary with a library (which defaults to
+# single-threaded) gives a runtime error when compressing files.
+# The 'lib' makefile provides specific '%-mt' targets for this purpose.
+ifeq ($(BR2_TOOLCHAIN_HAS_THREADS),y)
+ZSTD_BUILD_LIBS := $(addsuffix -mt,$(ZSTD_BUILD_LIBS))
+endif
+
 define ZSTD_BUILD_CMDS
 	$(TARGET_MAKE_ENV) $(TARGET_CONFIGURE_OPTS) $(MAKE) $(ZSTD_OPTS) \
 		-C $(@D)/lib $(ZSTD_BUILD_LIBS)
-- 
2.26.2

             reply	other threads:[~2020-12-04  9:57 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-04  9:57 Thomas De Schampheleire [this message]
2020-12-04  9:57 ` [Buildroot] [PATCHv2 2/2] package/zstd: link programs dynamically with libzstd to save space Thomas De Schampheleire
2021-01-17 14:31   ` Thomas Petazzoni
2021-01-02 17:49 ` [Buildroot] [PATCHv2 1/2] package/zstd: build multithreaded library if supported Thomas Petazzoni
2021-01-05 16:20   ` Thomas De Schampheleire
2021-01-05 16:36     ` Thomas Petazzoni
2021-01-05 16:47       ` Thomas De Schampheleire
2021-01-17 14:30 ` Thomas Petazzoni
2021-01-18 20:40   ` Thomas De Schampheleire

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201204095703.4714-1-patrickdepinguin@gmail.com \
    --to=patrickdepinguin@gmail.com \
    --cc=buildroot@busybox.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox