From c1589c4e65292484a53aebd7b0f2eb49732d5dae Mon Sep 17 00:00:00 2001 From: Matthieu Longo Date: Mon, 24 Jul 2017 15:04:07 +0200 Subject: [PATCH 1/5] fix build errors triggered by -Werror=parentheses --- c/src/reactor/io/posix/io.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/c/src/reactor/io/posix/io.c b/c/src/reactor/io/posix/io.c index 5a0de3b10f..949fc8bd89 100644 --- a/c/src/reactor/io/posix/io.c +++ b/c/src/reactor/io/posix/io.c @@ -274,7 +274,7 @@ static ssize_t nosigpipe_send(int fd, const void *buffer, size_t size) { if (!sigpipeIsPending) { sigemptyset(&newSignals); sigaddset(&newSignals, SIGPIPE); - if (sigmaskErr = pthread_sigmask(SIG_BLOCK, (const sigset_t *)&newSignals, (sigset_t *)&oldSignals)) + if ((sigmaskErr = pthread_sigmask(SIG_BLOCK, (const sigset_t *)&newSignals, (sigset_t *)&oldSignals)) != 0) { errno = sigmaskErr; return -1; @@ -288,7 +288,7 @@ static ssize_t nosigpipe_send(int fd, const void *buffer, size_t size) { while (-1 == sigtimedwait(&newSignals, NULL, &(struct timespec){ 0, 0 }) && errno == EINTR) ; //do nothing } - if (sigmaskErr = pthread_sigmask(SIG_SETMASK, (const sigset_t *)&oldSignals, (sigset_t *)NULL)) + if ((sigmaskErr = pthread_sigmask(SIG_SETMASK, (const sigset_t *)&oldSignals, (sigset_t *)NULL)) != 0) { errno = sigmaskErr; return -1; From c83a4b8257c585fe2ab5ceb7dae0afed53136117 Mon Sep 17 00:00:00 2001 From: Matthieu Longo Date: Mon, 24 Jul 2017 15:17:38 +0200 Subject: [PATCH 2/5] [solaris] change linker's flags since GCC uses Solaris's default linker --- c/CMakeLists.txt | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/c/CMakeLists.txt b/c/CMakeLists.txt index 40b503746e..bb20bb5d4a 100644 --- a/c/CMakeLists.txt +++ b/c/CMakeLists.txt @@ -232,8 +232,13 @@ if (CMAKE_COMPILER_IS_GNUCC) endif (NOT BUILD_WITH_CXX) if (ENABLE_UNDEFINED_ERROR) - set (CATCH_UNDEFINED "-Wl,--no-undefined") - set (ALLOW_UNDEFINED "-Wl,--allow-shlib-undefined") + if (CMAKE_HOST_SOLARIS) + set (CATCH_UNDEFINED "-zdefs") + set (ALLOW_UNDEFINED "-znodefs") + else(CMAKE_HOST_SOLARIS) + set (CATCH_UNDEFINED "-Wl,--no-undefined") + set (ALLOW_UNDEFINED "-Wl,--allow-shlib-undefined") + endif(CMAKE_HOST_SOLARIS) endif (ENABLE_UNDEFINED_ERROR) if (ENABLE_LINKTIME_OPTIMIZATION) From 9aea4320ef3b1ff2af1ced238d1b1cc5ba0f284d Mon Sep 17 00:00:00 2001 From: Matthieu Longo Date: Wed, 26 Jul 2017 14:58:53 +0200 Subject: [PATCH 3/5] [solaris] add extra linker flag -lsocket --- c/CMakeLists.txt | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/c/CMakeLists.txt b/c/CMakeLists.txt index bb20bb5d4a..7f2b42b823 100644 --- a/c/CMakeLists.txt +++ b/c/CMakeLists.txt @@ -105,14 +105,19 @@ elseif (SASL_IMPL STREQUAL none) endif () # Set Compiler extra flags for Solaris when using SunStudio -if(CMAKE_CXX_COMPILER_ID STREQUAL "SunPro" ) - set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mt" ) +if (CMAKE_CXX_COMPILER_ID STREQUAL "SunPro") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mt") endif() -if(CMAKE_C_COMPILER_ID STREQUAL "SunPro" ) +if (CMAKE_C_COMPILER_ID STREQUAL "SunPro") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mt") endif() +# Set linker's extra flags for Solaris (used by SunStudio and GCC without discrimination) +if (CMAKE_HOST_SOLARIS) + set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -lsocket") +endif(CMAKE_HOST_SOLARIS) + # Link in openssl if present if (SSL_IMPL STREQUAL openssl) set (pn_ssl_impl src/ssl/openssl.c) From 44be647ee10299543a0cb1f02def7a6833e05417 Mon Sep 17 00:00:00 2001 From: Matthieu Longo Date: Wed, 26 Jul 2017 16:38:47 +0200 Subject: [PATCH 4/5] [solaris] fix -Werror=implicit-function-declaration on getopt() --- c/CMakeLists.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/c/CMakeLists.txt b/c/CMakeLists.txt index 7f2b42b823..3bf83bb41d 100644 --- a/c/CMakeLists.txt +++ b/c/CMakeLists.txt @@ -236,6 +236,10 @@ if (CMAKE_COMPILER_IS_GNUCC) set (COMPILE_WARNING_FLAGS "${CXX_WARNING_FLAGS}") endif (NOT BUILD_WITH_CXX) + if (CMAKE_HOST_SOLARIS) + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D__EXTENSIONS__") + endif (CMAKE_HOST_SOLARIS) + if (ENABLE_UNDEFINED_ERROR) if (CMAKE_HOST_SOLARIS) set (CATCH_UNDEFINED "-zdefs") From 61e55b7087c66c02901cee4583aa1b4754c54261 Mon Sep 17 00:00:00 2001 From: Matthieu Longo Date: Thu, 27 Jul 2017 15:55:47 +0200 Subject: [PATCH 5/5] [solaris][sunpro] -D_REENTRANT is not defined even if we specify -pthread --- c/CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/c/CMakeLists.txt b/c/CMakeLists.txt index 3bf83bb41d..0d7b315486 100644 --- a/c/CMakeLists.txt +++ b/c/CMakeLists.txt @@ -106,11 +106,11 @@ endif () # Set Compiler extra flags for Solaris when using SunStudio if (CMAKE_CXX_COMPILER_ID STREQUAL "SunPro") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mt") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mt -D_REENTRANT") endif() if (CMAKE_C_COMPILER_ID STREQUAL "SunPro") - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mt") + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mt -D_REENTRANT") endif() # Set linker's extra flags for Solaris (used by SunStudio and GCC without discrimination)