GNOME Bugzilla – Bug 754875
configure.ac: no socketpair() check causes unresolved reference
Last modified: 2015-09-11 21:24:37 UTC
Package version: gstreamer-1.5.90.tar.xz OS: QNX Neutrino 6.5.0 Problem description: libgstreamer-1.0.so: undefined reference to `socketpair' Reason: libgstreamer-1.0.so (gst/gstpoll.c:568) uses socketpair() function which is in libsocket library and not in libc in QNX Neutrino (same problem should probably have place in Solaris OS). And, by default, build process doesn't use -lsocket option. As a result, libgstreamer-1.0.so.590 lacks libsocket dependency, and all the following linkage attempts (e.g. building gst-plugins-good) come to 'undefined reference' result. Possible solution (configure.ac): dnl check for socketpair() AC_CHECK_FUNC(socketpair, [], [ AC_CHECK_LIB(socket, socketpair, [ LIBS="$LIBS -lsocket" ]) ]) But, unfortunately, seems that libtool doesn't use LIBS variable when building libgstreamer-1.0.so library. I've also tried to use GST_ALL_LIBS="$GST_ALL_LIBS -lsocket" same manner (although it doesn't seem to look like a good solution), but with no success.
Sounds like a reasonable approach. Define a new LIBS variable, like SOCKET_LIBS, and use that in gst/Makefile.am for linking. Can you provide an updated patch that is tested to work for you? I don't think any GStreamer developer has a working QNX installation :)
My current patch for this issue (libtool uses LIBS variable indeed, that was my mistake): diff -crBN gstreamer-1.5.90.orig/configure.ac gstreamer-1.5.90/configure.ac *** gstreamer-1.5.90.orig/configure.ac 2015-08-19 11:41:23.000000000 +0300 --- gstreamer-1.5.90/configure.ac 2015-09-11 16:01:27.845970250 +0300 *************** *** 620,625 **** --- 620,632 ---- AC_CHECK_FUNCS([ppoll]) AC_CHECK_FUNCS([pselect]) + dnl check for socketpair() + AC_CHECK_FUNC(socketpair, [], [ + AC_CHECK_LIB(socket, socketpair, [ + LIBS="$LIBS -lsocket" + ]) + ]) + dnl **************************************** dnl *** GLib POLL* compatibility defines *** dnl ****************************************
Please put it in a different variable and use that only in the places where socketpair is actually used. Otherwise we would unnecessarily link everything with -lsocket.
Sure, you're right. diff -crBN gstreamer-1.5.90.orig/configure.ac gstreamer-1.5.90/configure.ac *** gstreamer-1.5.90.orig/configure.ac 2015-08-19 11:41:23.000000000 +0300 --- gstreamer-1.5.90/configure.ac 2015-09-11 17:05:21.121516897 +0300 *************** *** 620,625 **** --- 620,633 ---- AC_CHECK_FUNCS([ppoll]) AC_CHECK_FUNCS([pselect]) + dnl check for socketpair() + AC_CHECK_FUNC(socketpair, [], [ + AC_CHECK_LIB(socket, socketpair, [ + SOCKET_LIBS="-lsocket" + AC_SUBST(SOCKET_LIBS) + ]) + ]) + dnl **************************************** dnl *** GLib POLL* compatibility defines *** dnl **************************************** diff -crBN gstreamer-1.5.90.orig/gst/Makefile.am gstreamer-1.5.90/gst/Makefile.am *** gstreamer-1.5.90.orig/gst/Makefile.am 2015-06-19 16:01:53.000000000 +0300 --- gstreamer-1.5.90/gst/Makefile.am 2015-09-11 17:04:55.657519301 +0300 *************** *** 151,156 **** --- 151,157 ---- $(GST_PRINTF_LA) \ $(GST_ALL_LIBS) \ $(WIN32_LIBS) \ + $(SOCKET_LIBS) \ $(LIBM) libgstreamer_@GST_API_VERSION@_la_LDFLAGS = \
Can you provide a patch in "git format-patch" format? Looks good otherwise
I'm not familiar with Git, so take a look, is everything OK? From 2da4cba2204cd0790565efaeeab9b0f87d167ead Mon Sep 17 00:00:00 2001 From: Igor Rondarev <igor.rondarev@gmail.com> Date: Fri, 11 Sep 2015 17:58:48 +0300 Subject: [PATCH] fixed missing dependency for socketpair() function; some systems (e.g. QNX) have this fuction in libsocket library, not in libc. --- configure.ac | 8 ++++++++ gst/Makefile.am | 1 + 2 files changed, 9 insertions(+) diff --git a/configure.ac b/configure.ac index bd18632..2792744 100644 --- a/configure.ac +++ b/configure.ac @@ -620,6 +620,14 @@ AC_CHECK_FUNCS([poll]) AC_CHECK_FUNCS([ppoll]) AC_CHECK_FUNCS([pselect]) +dnl check for socketpair() +AC_CHECK_FUNC(socketpair, [], [ + AC_CHECK_LIB(socket, socketpair, [ + SOCKET_LIBS="-lsocket" + AC_SUBST(SOCKET_LIBS) + ]) +]) + dnl **************************************** dnl *** GLib POLL* compatibility defines *** dnl **************************************** diff --git a/gst/Makefile.am b/gst/Makefile.am index a117d97..213e3fd 100644 --- a/gst/Makefile.am +++ b/gst/Makefile.am @@ -151,6 +151,7 @@ libgstreamer_@GST_API_VERSION@_la_LIBADD = \ $(GST_PRINTF_LA) \ $(GST_ALL_LIBS) \ $(WIN32_LIBS) \ + $(SOCKET_LIBS) \ $(LIBM) libgstreamer_@GST_API_VERSION@_la_LDFLAGS = \ -- 2.1.4
Looks perfect, but can you attach it as a file instead of pasting it here? Copying patches from the browser usually ends up in GIT complaining :)
Created attachment 311154 [details] [review] fixed missing dependency patch
Comment on attachment 311154 [details] [review] fixed missing dependency patch Thanks, looks good. I'll merge that in a bit
Thank you!
commit 6972e7a9267fa3cf7441919f92b8e64b93252cd0 Author: Igor Rondarev <igor.rondarev@gmail.com> Date: Fri Sep 11 17:58:48 2015 +0300 configure: Check for socketpair() in -lsocket too On e.g. QNX it is in an external library, not libc. https://bugzilla.gnome.org/show_bug.cgi?id=754875