From: CaoRuichuang <create0818@163.com>
To: linux-trace-devel@vger.kernel.org
Cc: rostedt@goodmis.org, tz.stoyanov@gmail.com, create0818@163.com
Subject: [PATCH] libtraceevent: avoid racing recursive builds of both libraries
Date: Mon, 6 Apr 2026 06:21:02 +0800 [thread overview]
Message-ID: <20260405222102.9204-1-create0818@163.com> (raw)
A top-level parallel build currently starts separate recursive makes for
libtraceevent.a and libtraceevent.so. Both sub-makes rebuild the same
object files in the same output directory, which can corrupt the .o
files and make the final link fail with file format errors.
Make the default libs target descend into src/ only once and build the
shared library plus static archive from the same sub-make. Keep the
individual top-level library targets unchanged for direct use.
This reliably fixes repeated `make -j8` and `make -j8 libs` failures in a
Linux VM, where the unfixed tree reproduces the race within a few runs.
Link: https://bugzilla.kernel.org/show_bug.cgi?id=217428
Signed-off-by: CaoRuichuang <create0818@163.com>
---
Makefile | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/Makefile b/Makefile
index e1a10a0..faaeb6c 100644
--- a/Makefile
+++ b/Makefile
@@ -183,9 +183,9 @@ build := -f $(srctree)/build/Makefile.build dir=. obj
LIB_TARGET := libtraceevent.so libtraceevent.a
-CMD_TARGETS = $(LIB_TARGET) $(PKG_CONFIG_FILE)
+CMD_TARGETS = libs $(PKG_CONFIG_FILE)
-TARGETS = $(CMD_TARGETS)
+TARGETS = $(LIB_TARGET) $(PKG_CONFIG_FILE)
all: all_cmd plugins
@@ -206,7 +206,8 @@ all_cmd: $(CMD_TARGETS)
libtraceevent.a: $(bdir) $(LIBTRACEEVENT_STATIC)
libtraceevent.so: $(bdir) $(LIBTRACEEVENT_SHARED)
-libs: libtraceevent.a libtraceevent.so
+libs: $(bdir) force
+ $(Q)$(call descend,$(src)/src,libtraceevent.so $(LIBTRACEEVENT_STATIC))
$(LIBTRACEEVENT_STATIC): force
$(Q)$(call descend,$(src)/src,$@)
--
2.39.5 (Apple Git-154)
next reply other threads:[~2026-04-05 22:21 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-05 22:21 CaoRuichuang [this message]
2026-04-06 6:28 ` [PATCH v2] libtraceevent: avoid racing recursive builds of both libraries CaoRuichuang
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=20260405222102.9204-1-create0818@163.com \
--to=create0818@163.com \
--cc=linux-trace-devel@vger.kernel.org \
--cc=rostedt@goodmis.org \
--cc=tz.stoyanov@gmail.com \
/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