[PATCH v2] libtraceevent: avoid racing recursive builds of both libraries
CaoRuichuang <[email protected]> Mon, 6 Apr 2026 14:28:55 +0800
| Newsgroups | org.kernel.vger.linux-trace-devel |
|---|---|
| Message-ID | <[email protected]> |
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. The src/ Makefile already builds libtraceevent.so as part of the libtraceevent.a target. Reflect that at the top level too by making the shared library target depend on the static library target, so parallel requests for either or both libraries funnel through a single recursive make. This fixes repeated `make -j8`, `make -j8 libs`, and `make -j8 libtraceevent.a libtraceevent.so` 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 <[email protected]> --- Makefile | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Makefile b/Makefile index e1a10a0..6649303 100644 --- a/Makefile +++ b/Makefile @@ -211,8 +211,7 @@ libs: libtraceevent.a libtraceevent.so $(LIBTRACEEVENT_STATIC): force $(Q)$(call descend,$(src)/src,$@) -$(LIBTRACEEVENT_SHARED): force - $(Q)$(call descend,$(src)/src,libtraceevent.so) +$(LIBTRACEEVENT_SHARED): $(LIBTRACEEVENT_STATIC) $(bdir)/libtraceevent.so: $(bdir)/libtraceevent.so.$(EP_VERSION) @ln -sf $(<F) $@ -- 2.39.5 (Apple Git-154)