From 3945f27f6d4fd7bcc803ff4a36fc5db239ce2eac Mon Sep 17 00:00:00 2001 From: Luca Boccassi Date: Tue, 12 Apr 2016 23:52:34 +0100 Subject: [PATCH 1/4] Problem: pragma diagnostic is new in GCC 4.2 Solution: check for GCC version before using pragma diagnostic in tweetnacl to avoid an additional warning. --- tweetnacl/contrib/randombytes/randombytes.h | 2 +- tweetnacl/src/tweetnacl_base.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tweetnacl/contrib/randombytes/randombytes.h b/tweetnacl/contrib/randombytes/randombytes.h index d724f4a2..68407d3e 100644 --- a/tweetnacl/contrib/randombytes/randombytes.h +++ b/tweetnacl/contrib/randombytes/randombytes.h @@ -11,7 +11,7 @@ Public domain. Disable warnings for this source only, rather than for the whole codebase when building with C99 or with Microsoft's compiler */ -#if defined __GNUC__ && __STDC_VERSION__ < 201112L +#if defined __GNUC__ && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 2)) && __STDC_VERSION__ < 201112L # pragma GCC diagnostic ignored "-Wsign-compare" #elif defined _MSC_VER # pragma warning (disable:4018 4244 4146) diff --git a/tweetnacl/src/tweetnacl_base.h b/tweetnacl/src/tweetnacl_base.h index 42b99726..7d38af8f 100644 --- a/tweetnacl/src/tweetnacl_base.h +++ b/tweetnacl/src/tweetnacl_base.h @@ -5,7 +5,7 @@ Disable warnings for this source only, rather than for the whole codebase when building with C99 or with Microsoft's compiler */ -#if defined __GNUC__ && __STDC_VERSION__ < 201112L +#if defined __GNUC__ && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 2)) && __STDC_VERSION__ < 201112L # pragma GCC diagnostic ignored "-Wsign-compare" #elif defined _MSC_VER # pragma warning (disable:4018 4244 4146) From b2eddf9746c58b0a870a90f0d57dea03fce5b06a Mon Sep 17 00:00:00 2001 From: Luca Boccassi Date: Tue, 12 Apr 2016 23:53:17 +0100 Subject: [PATCH 2/4] Problem: -lssp causes build failure on Solaris Solution: add -lssp on Solaris only when libsodium is enabled and has been found. Also disable pedantic and Werror, as libsodium headers use pragma diagnostic which are not available in gcc 3.4. --- configure.ac | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index ecc3c0a3..42cf00b4 100644 --- a/configure.ac +++ b/configure.ac @@ -182,8 +182,6 @@ case "${host_os}" in if test "x$solaris_has_atomic" = "xno"; then AC_DEFINE(ZMQ_FORCE_MUTEXES, 1, [Force to use mutexes]) fi - # ssp library is required for libsodium on Solaris-like systems - LDFLAGS="-lssp $LDFLAGS" CPPFLAGS="$CPPFLAGS -Wno-long-long" ;; *freebsd*) @@ -419,6 +417,8 @@ elif test "x$with_libsodium" = "xyes"; then case "${host_os}" in *solaris*) LDFLAGS="-lssp $LDFLAGS" + libzmq_pedantic="no" + libzmq_werror="no" ;; esac else From 02d71a88ab0794799a40f8d08240d73028176815 Mon Sep 17 00:00:00 2001 From: Luca Boccassi Date: Wed, 13 Apr 2016 00:05:26 +0100 Subject: [PATCH 3/4] Problem: missing () after sizeof cause build fail Solution: use sizeof () to avoid build failure on Solaris 10 with gcc 3.4 --- src/tcp_address.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tcp_address.cpp b/src/tcp_address.cpp index 0c699e3a..86fa617f 100644 --- a/src/tcp_address.cpp +++ b/src/tcp_address.cpp @@ -86,7 +86,7 @@ int zmq::tcp_address_t::resolve_nic_name (const char *nic_, bool ipv6_, bool is_ // Find the interface with the specified name and AF_INET family. bool found = false; lifreq *ifrp = ifc.lifc_req; - for (int n = 0; n < (int) (ifc.lifc_len / sizeof lifreq); + for (int n = 0; n < (int) (ifc.lifc_len / sizeof (lifreq)); n ++, ifrp ++) { if (!strcmp (nic_, ifrp->lifr_name)) { rc = ioctl (fd, SIOCGLIFADDR, (char*) ifrp); From e488df7892dda78564c7086bee0c10dd6d4ad88d Mon Sep 17 00:00:00 2001 From: Luca Boccassi Date: Wed, 13 Apr 2016 00:22:22 +0100 Subject: [PATCH 4/4] Update NEWS for fix #1866 --- NEWS | 2 ++ 1 file changed, 2 insertions(+) diff --git a/NEWS b/NEWS index 11f6dcb0..8184cc97 100644 --- a/NEWS +++ b/NEWS @@ -19,6 +19,8 @@ * Fixed #1887 - zmq_bind IPv4 fallback still tries IPv6 +* Fixed #1866 - fails to build on SunOS 5.10 / Solaris 10 + 0MQ version 4.1.4 stable, released on 2015/12/18 ================================================