Package: udt
Version: 4.11+dfsg-1
Severity: important
Tags: patch
User: [email protected]
Usertags: origin-ubuntu saucy ubuntu-patch



In Ubuntu, the attached patch was applied to achieve the following:

  * 0001-Link-against-libpthread.patch: Fix linking with --as-needed.
  * 0002-Set-soname-on-shared-library.patch: Rebase against the above.

Now, by way of explanation, there were two different ways to fix this:

1) Move your -lpthread to the end of the linker line (so it comes after
   the objects that reference its symbols).
2) Switch from -lpthread (a linker call) to -pthread (a GCC switch that
   always links pthread).

Given that the second option was a 1-char patch, and we already KNOW we
need that library linked against pthread, the second option was the
simplest, but one could certainly argue that the first could be a bit
more correct, as it means --as-needed could drop pthread on the floor
if it wasn't actually referenced.  Purely an academic discussion, since
the library obviously uses pthread and doesn't seem likely to stop.

... Adam

-- System Information:
Debian Release: wheezy/sid
  APT prefers saucy-updates
  APT policy: (500, 'saucy-updates'), (500, 'saucy-security'), (500, 'saucy')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 3.11.0-5-generic (SMP w/4 CPU cores)
Locale: LANG=en_CA.UTF-8, LC_CTYPE=en_CA.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
diff -Nru udt-4.11+dfsg/debian/changelog udt-4.11+dfsg/debian/changelog
diff -Nru udt-4.11+dfsg/debian/patches/0001-Link-against-libpthread.patch udt-4.11+dfsg/debian/patches/0001-Link-against-libpthread.patch
--- udt-4.11+dfsg/debian/patches/0001-Link-against-libpthread.patch	2013-07-01 20:36:48.000000000 -0400
+++ udt-4.11+dfsg/debian/patches/0001-Link-against-libpthread.patch	2013-09-14 15:53:01.000000000 -0400
@@ -17,7 +17,7 @@
  libudt.so: $(OBJS)
  ifneq ($(os), OSX)
 -	$(C++) -shared -o $@ $^
-+	$(C++) -shared -lpthread -o $@ $^
++	$(C++) -shared -pthread -o $@ $^
  else
  	$(C++) -dynamiclib -o libudt.dylib -lstdc++ -lpthread -lm $^
  endif
diff -Nru udt-4.11+dfsg/debian/patches/0002-Set-soname-on-shared-library.patch udt-4.11+dfsg/debian/patches/0002-Set-soname-on-shared-library.patch
--- udt-4.11+dfsg/debian/patches/0002-Set-soname-on-shared-library.patch	2013-07-01 20:36:48.000000000 -0400
+++ udt-4.11+dfsg/debian/patches/0002-Set-soname-on-shared-library.patch	2013-09-14 15:53:52.000000000 -0400
@@ -16,8 +16,8 @@
  
  libudt.so: $(OBJS)
  ifneq ($(os), OSX)
--	$(C++) -shared -lpthread -o $@ $^
-+	$(C++) -shared -lpthread -Wl,-soname,libudt.so.0 -o $@ $^
+-	$(C++) -shared -pthread -o $@ $^
++	$(C++) -shared -pthread -Wl,-soname,libudt.so.0 -o $@ $^
  else
  	$(C++) -dynamiclib -o libudt.dylib -lstdc++ -lpthread -lm $^
  endif

Reply via email to