After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 754875 - configure.ac: no socketpair() check causes unresolved reference
configure.ac: no socketpair() check causes unresolved reference
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gstreamer (core)
1.5.90
Other Neutrino
: Normal normal
: 1.5.91
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2015-09-11 11:08 UTC by Igor Rondarev
Modified: 2015-09-11 21:24 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
fixed missing dependency patch (1.23 KB, patch)
2015-09-11 15:06 UTC, Igor Rondarev
committed Details | Review

Description Igor Rondarev 2015-09-11 11:08:50 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.
Comment 1 Sebastian Dröge (slomo) 2015-09-11 13:05:19 UTC
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 :)
Comment 2 Igor Rondarev 2015-09-11 13:28:04 UTC
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 ****************************************
Comment 3 Sebastian Dröge (slomo) 2015-09-11 13:40:15 UTC
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.
Comment 4 Igor Rondarev 2015-09-11 14:11:50 UTC
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 =           \
Comment 5 Sebastian Dröge (slomo) 2015-09-11 14:24:24 UTC
Can you provide a patch in "git format-patch" format? Looks good otherwise
Comment 6 Igor Rondarev 2015-09-11 15:00:31 UTC
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
Comment 7 Sebastian Dröge (slomo) 2015-09-11 15:02:45 UTC
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 :)
Comment 8 Igor Rondarev 2015-09-11 15:06:25 UTC
Created attachment 311154 [details] [review]
fixed missing dependency patch
Comment 9 Sebastian Dröge (slomo) 2015-09-11 15:11:39 UTC
Comment on attachment 311154 [details] [review]
fixed missing dependency patch

Thanks, looks good. I'll merge that in a bit
Comment 10 Igor Rondarev 2015-09-11 15:13:00 UTC
Thank you!
Comment 11 Sebastian Dröge (slomo) 2015-09-11 21:24:37 UTC
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