[Asterisk-code-review] pjproject: Fix race condition when building with parallel make (asterisk[17])

Friendly Automation asteriskteam at digium.com
Mon May 11 16:57:53 CDT 2020


Friendly Automation has submitted this change. ( https://gerrit.asterisk.org/c/asterisk/+/14395 )

Change subject: pjproject: Fix race condition when building with parallel make
......................................................................

pjproject: Fix race condition when building with parallel make

Pjproject makefiles miss some dependencies which can cause race
conditions when building with parallel make processes. This patch
adds such dependencies correctly.

ASTERISK-28879 #close
Reported-by: Dmitry Wagin <dmitry.wagin at ya.ru>

Change-Id: Ie1b0dc365dafe4a84c5248097fe8d73804043c22
---
A third-party/pjproject/patches/0050-fix-race-parallel-build.patch
1 file changed, 72 insertions(+), 0 deletions(-)

Approvals:
  Joshua Colp: Looks good to me, but someone else must approve
  Kevin Harwell: Looks good to me, approved
  George Joseph: Looks good to me, but someone else must approve
  Friendly Automation: Approved for Submit



diff --git a/third-party/pjproject/patches/0050-fix-race-parallel-build.patch b/third-party/pjproject/patches/0050-fix-race-parallel-build.patch
new file mode 100644
index 0000000..674baa2
--- /dev/null
+++ b/third-party/pjproject/patches/0050-fix-race-parallel-build.patch
@@ -0,0 +1,72 @@
+From 78683646c8bc670ec730a42494e075f671a08e28 Mon Sep 17 00:00:00 2001
+From: Guido Falsi <mad at madpilot.net>
+Date: Mon, 11 May 2020 08:50:39 +0200
+Subject: [PATCH] Fix race condition in parallel builds (#2426)
+
+* Some targets residing in `OBJDIRS` are missing a dependency on that directory, which results in a race condition, causing build to fail sometimes due to the directory not existing when running parallel builds.
+
+* The `PJSUA_LIB` variable is not defined anywhere, resulting in an empty value, and no correct dependency on the pjsua shared library for `pjsua2`. The correct variable seems to be `PJSUA_LIB_LIB`, defined at the start of this same `Makefile`.
+---
+ build/rules.mak      | 12 ++++++------
+ pjsip/build/Makefile |  2 +-
+ 2 files changed, 7 insertions(+), 7 deletions(-)
+
+diff --git a/build/rules.mak b/build/rules.mak
+index 8fa98655e..912199c41 100644
+--- a/build/rules.mak
++++ b/build/rules.mak
+@@ -129,7 +129,7 @@ endif
+ $(OBJDIR)/$(app).o: $(OBJDIRS) $(OBJS)
+ 	$(CROSS_COMPILE)ld -r -o $@ $(OBJS)
+ 
+-$(OBJDIR)/$(app).ko: $(OBJDIR)/$(app).o
++$(OBJDIR)/$(app).ko: $(OBJDIR)/$(app).o | $(OBJDIRS)
+ 	@echo Creating kbuild Makefile...
+ 	@echo "# Our module name:" > $(OBJDIR)/Makefile
+ 	@echo 'obj-m += $(app).o' >> $(OBJDIR)/Makefile
+@@ -154,27 +154,27 @@ $(OBJDIR)/$(app).ko: $(OBJDIR)/$(app).o
+ ../lib/$(app).ko: $(LIB) $(OBJDIR)/$(app).ko
+ 	cp $(OBJDIR)/$(app).ko ../lib
+ 
+-$(OBJDIR)/%$(OBJEXT): $(SRCDIR)/%.m
++$(OBJDIR)/%$(OBJEXT): $(SRCDIR)/%.m | $(OBJDIRS)
+ 	$(CC) $($(APP)_CFLAGS) \
+ 		$(CC_OUT)$(subst /,$(HOST_PSEP),$@) \
+ 		$(subst /,$(HOST_PSEP),$<) 
+ 
+-$(OBJDIR)/%$(OBJEXT): $(SRCDIR)/%.c
++$(OBJDIR)/%$(OBJEXT): $(SRCDIR)/%.c | $(OBJDIRS)
+ 	$(CC) $($(APP)_CFLAGS) \
+ 		$(CC_OUT)$(subst /,$(HOST_PSEP),$@) \
+ 		$(subst /,$(HOST_PSEP),$<) 
+ 
+-$(OBJDIR)/%$(OBJEXT): $(SRCDIR)/%.S
++$(OBJDIR)/%$(OBJEXT): $(SRCDIR)/%.S | $(OBJDIRS)
+ 	$(CC) $($(APP)_CFLAGS) \
+ 		$(CC_OUT)$(subst /,$(HOST_PSEP),$@) \
+ 		$(subst /,$(HOST_PSEP),$<) 
+ 
+-$(OBJDIR)/%$(OBJEXT): $(SRCDIR)/%.cpp
++$(OBJDIR)/%$(OBJEXT): $(SRCDIR)/%.cpp | $(OBJDIRS)
+ 	$(CXX) $($(APP)_CXXFLAGS) \
+ 		$(CC_OUT)$(subst /,$(HOST_PSEP),$@) \
+ 		$(subst /,$(HOST_PSEP),$<)
+ 
+-$(OBJDIR)/%$(OBJEXT): $(SRCDIR)/%.cc
++$(OBJDIR)/%$(OBJEXT): $(SRCDIR)/%.cc | $(OBJDIRS)
+ 	$(CXX) $($(APP)_CXXFLAGS) \
+ 		$(CC_OUT)$(subst /,$(HOST_PSEP),$@) \
+ 		$(subst /,$(HOST_PSEP),$<)
+diff --git a/pjsip/build/Makefile b/pjsip/build/Makefile
+index b85c7817a..20777909f 100644
+--- a/pjsip/build/Makefile
++++ b/pjsip/build/Makefile
+@@ -262,7 +262,7 @@ $(PJSUA_LIB_LIB) $(PJSUA_LIB_SONAME): $(PJSIP_LIB) $(PJSIP_SONAME) $(PJSIP_SIMPL
+ 
+ pjsua2-lib: $(PJSUA2_LIB_LIB)
+ $(PJSUA2_LIB_SONAME): $(PJSUA2_LIB_LIB)
+-$(PJSUA2_LIB_LIB) $(PJSUA2_LIB_SONAME): $(PJSUA_LIB) $(PSJUA_LIB_SONAME) $(PJSIP_LIB) $(PJSIP_SONAME) $(PJSIP_SIMPLE_LIB) $(PJSIP_SIMPLE_SONAME) $(PJSIP_UA_LIB) $(PJSIP_UA_SONAME)
++$(PJSUA2_LIB_LIB) $(PJSUA2_LIB_SONAME): $(PJSUA_LIB_LIB) $(PJSUA_LIB_SONAME) $(PJSIP_LIB) $(PJSIP_SONAME) $(PJSIP_SIMPLE_LIB) $(PJSIP_SIMPLE_SONAME) $(PJSIP_UA_LIB) $(PJSIP_UA_SONAME)
+ 	$(MAKE) -f $(RULES_MAK) APP=PJSUA2_LIB app=pjsua2-lib $(subst /,$(HOST_PSEP),$(LIBDIR)/$@)
+ 
+ pjsip-test: $(TEST_EXE)

-- 
To view, visit https://gerrit.asterisk.org/c/asterisk/+/14395
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: 17
Gerrit-Change-Id: Ie1b0dc365dafe4a84c5248097fe8d73804043c22
Gerrit-Change-Number: 14395
Gerrit-PatchSet: 3
Gerrit-Owner: Guido Falsi <madpilot at freebsd.org>
Gerrit-Reviewer: Friendly Automation
Gerrit-Reviewer: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Joshua Colp <jcolp at sangoma.com>
Gerrit-Reviewer: Kevin Harwell <kharwell at digium.com>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20200511/91a03333/attachment.html>


More information about the asterisk-code-review mailing list