[vlc-commits] contrib: upnp: fix pthread linking (fixes #16390)

Rémi Denis-Courmont git at videolan.org
Sat Aug 6 10:59:20 CEST 2016


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sat Aug  6 11:58:28 2016 +0300| [bc59186dc3ae6668a7656d3005daa335b644a53c] | committer: Rémi Denis-Courmont

contrib: upnp: fix pthread linking (fixes #16390)

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=bc59186dc3ae6668a7656d3005daa335b644a53c
---

 contrib/src/upnp/libpthread.patch | 15 +++++++++++++++
 contrib/src/upnp/rules.mak        |  3 +--
 2 files changed, 16 insertions(+), 2 deletions(-)

diff --git a/contrib/src/upnp/libpthread.patch b/contrib/src/upnp/libpthread.patch
new file mode 100644
index 0000000..e306759
--- /dev/null
+++ b/contrib/src/upnp/libpthread.patch
@@ -0,0 +1,15 @@
+On GNU/Linux, -pthread does not work properly when linking a static
+library that depends on POSIX threads. -lpthread must be checked first.
+
+diff -Nru upnp.orig/m4/acx_pthread.m4 upnp/m4/acx_pthread.m4
+--- upnp.orig/m4/acx_pthread.m4	2016-08-06 11:54:20.990800226 +0300
++++ upnp/m4/acx_pthread.m4	2016-08-06 11:54:37.909800395 +0300
+@@ -123,7 +123,7 @@
+ # which indicates that we try without any flags at all, and "pthread-config"
+ # which is a program returning the flags for the Pth emulation library.
+ 
+-acx_pthread_flags="pthreads none -Kthread -kthread lthread -pthread -pthreads -mthreads pthread --thread-safe -mt pthread-config"
++acx_pthread_flags="pthreads none -Kthread -kthread lthread -lpthread -pthread -pthreads -mthreads pthread --thread-safe -mt pthread-config"
+ 
+ # The ordering *is* (sometimes) important.  Some notes on the
+ # individual items follow:
diff --git a/contrib/src/upnp/rules.mak b/contrib/src/upnp/rules.mak
index eddc291..9636036 100644
--- a/contrib/src/upnp/rules.mak
+++ b/contrib/src/upnp/rules.mak
@@ -37,6 +37,7 @@ ifdef HAVE_WINSTORE
 	$(APPLY) $(SRC)/upnp/winrt-inet.patch
 endif
 endif
+	$(APPLY) $(SRC)/upnp/libpthread.patch
 	$(APPLY) $(SRC)/upnp/libupnp-ipv6.patch
 	$(APPLY) $(SRC)/upnp/miniserver.patch
 	$(APPLY) $(SRC)/upnp/missing_win32.patch
@@ -47,9 +48,7 @@ endif
 	$(MOVE)
 
 .upnp: upnp
-ifdef HAVE_WIN32
 	$(RECONF)
-endif
 	cd $< && $(HOSTVARS) CFLAGS="$(CFLAGS) -DUPNP_STATIC_LIB $(LIBUPNP_ECFLAGS)" ./configure --disable-samples --without-documentation $(CONFIGURE_ARGS) $(HOSTCONF)
 	cd $< && $(MAKE) install
 	touch $@



More information about the vlc-commits mailing list