[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Bug#637777: zeromq: fix kFreeBSD build



On Sun, Aug 14, 2011 at 12:40:25PM +0200, Christoph Egger wrote:
> Package: src:zeromq
> Version: 2.1.7-1
> Severity: important
> Tags: patch
> User: debian-bsd@lists.debian.org
> Usertags: kfreebsd-porting
> 
> Hi!

Hi,

> Your package failed to build on kfreebsd as the uuid code is
> conditionalized on FreeBSD vs Linux while the code is actually GLIBC /
> BSDLibC specific. Attached patch fixes this problem and allows zeromq to
> build on kfreebsd

I have adapted your patch and, along with another one (see attached), zeromq
seems to compile fine on kfreebsd. The problem now is that the tests segfault.

All of them appear to have the same problem with "sigsuspend":

> (gdb) r
> Starting program: /home/ghedo/pkg-zeromq/tests/.libs/test_pair_inproc 
> 
> Program received signal ?, Unknown signal.
> __pthread_sigsuspend ()
>     at ../ports/sysdeps/unix/bsd/bsd4.4/kfreebsd/linuxthreads/pt-sigsuspend.S:24
> 24	../ports/sysdeps/unix/bsd/bsd4.4/kfreebsd/linuxthreads/pt-sigsuspend.S: No such file or directory.
> (gdb) bt
> #0  __pthread_sigsuspend ()
>     at ../ports/sysdeps/unix/bsd/bsd4.4/kfreebsd/linuxthreads/pt-sigsuspend.S:24
> #1  0x0000000800c643b8 in __pthread_wait_for_restart_signal (self=<optimized out>)
>     at pthread.c:1285
> #2  0x0000000800c6507c in suspend (self=<optimized out>) at restart.h:34
> #3  __pthread_create_2_1 (thread=0x604650, attr=<optimized out>, 
>     start_routine=<optimized out>, arg=<optimized out>) at pthread.c:882
> #4  0x000000080084380d in zmq::thread_t::start (this=<optimized out>, 
>     tfn_=<optimized out>, arg_=<optimized out>) at thread.cpp:84
> #5  0x000000080083006e in zmq::ctx_t::ctx_t (this=0x602cc0, io_threads_=1)
>     at ctx.cpp:59
> #6  0x0000000800847541 in zmq_init (io_threads_=1) at zmq.cpp:280
> #7  0x00000000004018ad in context_t (io_threads_=1, this=0x7fffffffe970)
>     at ../include/zmq.hpp:204
> #8  zmqtestutil::basic_tests (transport_=0x402236 "inproc://tester", t1_=0, t2_=0)
>     at testutil.hpp:82
> #9  0x0000000000401342 in main (argc=<optimized out>, argv=<optimized out>)
>     at test_pair_inproc.cpp:29

(this was run on asdfasdf.d.n using the package at [0])

Any idea on what may be causing this?

Cheers

[0] http://anonscm.debian.org/gitweb/?p=collab-maint/zeromq.git

-- 
perl -E '$_=q;$/= @{[@_]};and s;\S+;<inidehG ordnasselA>;eg;say~~reverse'
Description: Fix FTBFS on kfreebsd by adjusting uuid include paths
Origin: vendor
Bug-Debian: http://bugs.debian.org/637777
Author: Alessandro Ghedini <ghedo@debian.org>
Reviewed-by: Alessandro Ghedini <ghedo@debian.org>
Last-Update: 2012-05-21

--- a/src/uuid.cpp
+++ b/src/uuid.cpp
@@ -44,7 +44,8 @@
     return (char*) string_buf;
 }

-#elif defined ZMQ_HAVE_FREEBSD || defined ZMQ_HAVE_NETBSD || (defined ZMQ_HAVE_HPUX && defined HAVE_LIBDCEKT)
+#elif (defined ZMQ_HAVE_FREEBSD || defined ZMQ_HAVE_NETBSD ||\
+      (defined ZMQ_HAVE_HPUX && defined HAVE_LIBDCEKT)) && !defined __GLIBC__

 #include <stdlib.h>
 #ifdef ZMQ_HAVE_HPUX
@@ -79,7 +80,7 @@
 }

 #elif defined ZMQ_HAVE_LINUX || defined ZMQ_HAVE_SOLARIS ||\
-      defined ZMQ_HAVE_OSX || defined ZMQ_HAVE_CYGWIN
+      defined ZMQ_HAVE_OSX || defined ZMQ_HAVE_CYGWIN || defined __GLIBC__

 #include <uuid/uuid.h>

--- a/src/uuid.hpp
+++ b/src/uuid.hpp
@@ -24,12 +24,12 @@
 #include "platform.hpp"
 #include "stdint.hpp"

-#if defined ZMQ_HAVE_FREEBSD || defined ZMQ_HAVE_NETBSD
+#if (defined ZMQ_HAVE_FREEBSD || defined ZMQ_HAVE_NETBSD) && !defined __GLIBC__
 #include <uuid.h>
 #elif defined ZMQ_HAVE_HPUX && defined HAVE_LIBDCEKT
 #include <dce/uuid.h>
 #elif defined ZMQ_HAVE_LINUX || defined ZMQ_HAVE_SOLARIS ||\
-      defined ZMQ_HAVE_OSX || defined ZMQ_HAVE_CYGWIN
+      defined ZMQ_HAVE_OSX || defined ZMQ_HAVE_CYGWIN || defined __GLIBC__
 #include <uuid/uuid.h>
 #elif defined ZMQ_HAVE_WINDOWS
 #include "windows.hpp"
--- a/configure.in
+++ b/configure.in
@@ -123,6 +123,13 @@
         fi
         ;;
     *freebsd*)
+        case "${host_os}" in
+            *kfreebsd*)
+                AC_CHECK_LIB(uuid, uuid_generate, ,
+                    [AC_MSG_ERROR([cannot link with -luuid, install uuid-dev.])])
+            ;;
+        esac
+
         # Define on FreeBSD to enable all library features
         CPPFLAGS="-D__BSD_VISIBLE $CPPFLAGS"
         AC_DEFINE(ZMQ_HAVE_FREEBSD, 1, [Have FreeBSD OS])
--- a/configure
+++ b/configure
@@ -17116,6 +17217,58 @@
         fi
         ;;
     *freebsd*)
+        case "${host_os}" in
+            *kfreebsd*)
+                { $as_echo "$as_me:${as_lineno-$LINENO}: checking for uuid_generate in -luuid" >&5
+$as_echo_n "checking for uuid_generate in -luuid... " >&6; }
+if ${ac_cv_lib_uuid_uuid_generate+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-luuid  $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char uuid_generate ();
+int
+main ()
+{
+return uuid_generate ();
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_lib_uuid_uuid_generate=yes
+else
+  ac_cv_lib_uuid_uuid_generate=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_uuid_uuid_generate" >&5
+$as_echo "$ac_cv_lib_uuid_uuid_generate" >&6; }
+if test "x$ac_cv_lib_uuid_uuid_generate" = xyes; then :
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_LIBUUID 1
+_ACEOF
+
+  LIBS="-luuid $LIBS"
+
+else
+  as_fn_error $? "cannot link with -luuid, install uuid-dev." "$LINENO" 5
+fi
+
+            ;;
+        esac
+
         # Define on FreeBSD to enable all library features
         CPPFLAGS="-D__BSD_VISIBLE $CPPFLAGS"
Description: Check directly whether SO_NOSIGPIPE is available, instead of
 checking for the platform where it should be available.
Origin: vendor
Author: Alessandro Ghedini <ghedo@debian.org>
Reviewed-by: Alessandro Ghedini <ghedo@debian.org>
Last-Update: 2012-05-21

--- a/src/tcp_socket.cpp
+++ b/src/tcp_socket.cpp
@@ -162,7 +162,7 @@
         errno_assert (rc == 0);
     }

-#if defined ZMQ_HAVE_OSX || defined ZMQ_HAVE_FREEBSD
+#ifdef SO_NOSIGPIPE
     int set = 1;
     int rc = setsockopt (s, SOL_SOCKET, SO_NOSIGPIPE, &set, sizeof (int));
     errno_assert (rc == 0);

Attachment: signature.asc
Description: Digital signature


Reply to: