[ 
https://issues.apache.org/jira/browse/ZOOKEEPER-1077?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Chris Nauroth updated ZOOKEEPER-1077:
-------------------------------------
    Attachment: ZOOKEEPER-1077.001.patch

I'm attaching a patch that gets the trunk native code building on Solaris.  In 
addition to the issues already mentioned, I found another problem introduced by 
ZOOKEEPER-827.
# configure.ac now uses the {{AC_CANONICAL_HOST}} macro to determine if it's 
running on Solaris.
# Makefile.am uses that OS detection to add the extra compiler and linker flags 
required on Solaris.
# In zk_log.c, cast the pid to {{long}} for use by the {{snprintf}} format 
string.
# In zookeeper.c, set the socket {{send}} flags to 0, because neither 
{{MSG_NOSIGNAL}} nor {{SO_NOSIGPIPE}} is defined.  This part isn't entirely 
correct, because it means an application on Solaris could fall victim to 
{{SIGPIPE}} generated from within the ZooKeeper library.  I believe the only 
full solution for Solaris is to conditionally compile in some extra code to do 
our own signal handling.  (See links below for examples of how other projects 
have done this.)  Before I go down the path of adding signal handling code, I'd 
like to gauge if there is general community interest in this approach.

https://redmine.openinfosecfoundation.org/issues/862

https://github.com/kroki/XProbes/blob/1447f3d93b6dbf273919af15e59f35cca58fcc23/src/libxprobes.c#L156

There is an earlier patch attached here to deal with a naming conflict on the 
{{htonll}} function.  At this point, that conflict has been fixed in 
ZOOKEEPER-2049.


> C client lib doesn't build on Solaris
> -------------------------------------
>
>                 Key: ZOOKEEPER-1077
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-1077
>             Project: ZooKeeper
>          Issue Type: Bug
>          Components: build, c client
>    Affects Versions: 3.3.4
>         Environment: uname -a: SunOS [redacted] 5.10 Generic_142910-17 i86pc 
> i386 i86pc
> GNU toolchain (gcc 3.4.3, GNU Make etc.)
>            Reporter: Tadeusz Andrzej Kadłubowski
>            Assignee: Justin SB
>            Priority: Critical
>             Fix For: 3.5.2, 3.6.0
>
>         Attachments: ZOOKEEPER-1077.001.patch, zookeeper.patch
>
>
> Hello,
> Some minor trouble with building ZooKeeper C client library on 
> Sun^H^H^HOracle Solaris 5.10.
> 1. You need to link against "-lnsl -lsocket"
> 2. ctime_r needs a buffer size. The signature is: "char *ctime_r(const time_t 
> *clock, char *buf, int buflen)"
> 3. In zk_log.c you need to manually cast pid_t to int (-Werror can be 
> cumbersome ;) )
> 4. getpwuid_r()returns pointer to struct passwd, which works as the last 
> parameter on Linux.
> Solaris signature: struct passwd *getpwuid_r(uid_t  uid,  struct  passwd  
> *pwd, char *buffer, int  buflen); 
> Linux signature: int getpwuid_r(uid_t uid, struct passwd *pwd, char *buf, 
> size_t buflen, struct passwd **result);



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to