[syslog-ng] Compiling 1.9.11 on Solaris 9

Balazs Scheidler bazsi at balabit.hu
Fri May 26 21:31:10 CEST 2006


On Thu, 2006-05-25 at 18:16 -0500, Albert Chin wrote:
> I tried building syslog-ng 1.9.11 on Solaris 9 with the Sun C
> compiler. It failed with the following:
>   cc -DHAVE_CONFIG_H -I. -I. -I..
>   -DPATH_SYSCONFDIR=\"/etc/opt/TWWfsw/syslogng1911\"
>   -DPATH_LOCALSTATEDIR=\"/var/opt/TWWfsw/syslogng1911\"
>   -I/opt/TWWfsw/libglib26/include -I/opt/TWWfsw/libglib26/lib/include
>   -I/opt/TWWfsw/gettext014/include
>   -I/opt/TWWfsw/syslogng198/include/eventlog   -D_GNU_SOURCE  -mr -Qn
>   -xstrconst -xO2 -xtarget=ultra2 -xarch=v8plusa -c afinet.c
>   "afinet.c", line 81: warning: implicit function declaration: memset
>   "afinet.c", line 156: undefined symbol: SOL_IP
>   "afinet.c", line 162: undefined symbol: SOL_IP
>   "afinet.c", line 169: undefined symbol: SOL_IP
>   "afinet.c", line 172: undefined symbol: SOL_IP
>   "afinet.c", line 181: warning: left operand of "->" must be pointer to struct/union
>   "afinet.c", line 188: undefined symbol: SOL_IPV6
>   "afinet.c", line 194: undefined symbol: SOL_IPV6
>   "afinet.c", line 200: undefined symbol: SOL_IPV6
>   cc: acomp failed for afinet.c
>   gmake[2]: *** [afinet.o] Error 2
>   gmake[2]: Leaving directory `/opt/build/syslog-ng-1.9.11/src'
> 
> The prototype for memset() is in <string.h>.
> 
> Solaris 9 doesn't have SOL_IP anywhere in /usr/include. From
> setsockopt(3SOCKET) on Solaris 9:
>      When manipulating socket options, the  level  at  which  the
>      option resides and the name of the option must be specified.
>      To manipulate options at the "socket" level, level is speci-
>      fied  as  SOL_SOCKET.  To  manipulate  options  at any other
>      level, level is the protocol number  of  the  protocol  that
>      controls the option. For example, to indicate that an option
>      is to be interpreted by the TCP protocol, level  is  set  to
>      the TCP protocol number .  See getprotobyname(3SOCKET).
> 
> AIX 5.3 doesn't build for the same reason:
>   "afinet.c", line 157.32: 1506-045 (S) Undeclared identifier SOL_IP.
>   "afinet.c", line 182.13: 1506-021 (S) Expecting struct or union.
>   "afinet.c", line 189.32: 1506-045 (S) Undeclared identifier SOL_IPV6.
>   gmake[2]: *** [afinet.o] Error 1
>   gmake[2]: Leaving directory `/opt/build/syslog-ng-1.9.11/src'
> 
> Ditto for HP-UX 11.23/PA and 11.23/IA.
> 

Here's the patch, which I have just commited (or use tomorrow's
snapshot):

--- orig/src/afinet.c
+++ mod/src/afinet.c
@@ -28,6 +28,16 @@
 #include <arpa/inet.h>
 #include <netdb.h>

+#include <string.h>
+
+#ifndef SOL_IP
+#define SOL_IP IPPROTO_IP
+#endif
+
+#ifndef SOL_IPV6
+#define SOL_IPV6 IPPROTO_IPV6
+#endif
+

 static void
 afinet_set_port(GSockAddr *addr, gint port, gchar *service, gchar *proto)
@@ -243,9 +253,13 @@ afinet_sd_new(gint af, gchar *host, gint
     }
   else
     {
+#if ENABLE_IPV6
       self->super.bind_addr = g_sockaddr_inet6_new("::", port);
       if (!host)
         host = "::";
+#else
+      g_assert_not_reached();
+#endif
     }
   afinet_resolve_name(self->super.bind_addr, host);
   self->super.setup_socket = afinet_sd_setup_socket;
@@ -300,8 +314,12 @@ afinet_dd_new(gint af, gchar *host, gint
     }
   else
     {
+#if ENABLE_IPV6
       self->super.bind_addr = g_sockaddr_inet6_new("::", 0);
       self->super.dest_addr = g_sockaddr_inet6_new("::", port);
+#else
+      g_assert_not_reached();
+#endif
     }
   afinet_resolve_name(self->super.dest_addr, host);
   self->super.setup_socket = afinet_dd_setup_socket;





-- 
Bazsi



More information about the syslog-ng mailing list