Trying to compile with SUN's cc compiler.
Here is the results after running make. I had to change this in the configure file: if test $enable_debug = "yes"; then CFLAGS="-Wall -g" else # CFLAGS="-Wall -O2" CFLAGS="-w -fast" fi -fast is optimzed. -w is supress warnings. The offending line in objbase.h is: #ifdef DEBUG_ALLOC struct ol_string_header { int magic; /* For a sentinel value */ }; #else /* !DEBUG_ALLOC */ struct ol_string_header {}; <--------------Line 67. #endif /* !DEBUG_ALLOC */ My C is a little old. I'll have to crack out my very old Kernigan book. Can you create a null pointer to a struct like that? Is this a picky compiler and should ignore it? I was able to get this compiled using. gcc. I HAVE to get this compiled with the SUN compiler. Yes I am brave. Making all in utils sed -e "s,_SCSH_,," make_class.in >make_class chmod +x make_class Making all in src /bin/sh ../libtool --mode=compile cc -DHAVE_CONFIG_H -I. -I/export/epm/syslog-ng/libol-0.3.9/src -I. -D_GNU_SOURCE -w -fast -c format.c rm -f .libs/format.lo cc -DHAVE_CONFIG_H -I. -I/export/epm/syslog-ng/libol-0.3.9/src -I. -D_GNU_SOURCE -w -fast -c format.c -KPIC -DPIC -o format.o cc: Warning: -xarch=native has been explicitly specified, or implicitly specified by a macro option, -xarch=native on this architecture implies -xarch=v8plusa which generates code that does not run on pre-UltraSPARC processors "./objbase.h", line 67: syntax error before or at: } "./objbase.h", line 73: incomplete struct/union/enum ol_string_header: header "./objbase.h", line 81: cannot recover from previous errors cc: acomp failed for format.c *** Error code 1 make: Fatal error: Command failed for target `format.lo' Current working directory /export/epm/syslog-ng/libol-0.3.9/src *** Error code 1 make: Fatal error: Command failed for target `all-recursive' -- Jay Davis Cell: 443-253-0469
On Tue, Apr 29, 2003 at 01:56:20PM -0400, Jay Davis wrote:
Here is the results after running make.
I had to change this in the configure file: if test $enable_debug = "yes"; then CFLAGS="-Wall -g" else # CFLAGS="-Wall -O2" CFLAGS="-w -fast" fi
-fast is optimzed. -w is supress warnings.
The offending line in objbase.h is:
#ifdef DEBUG_ALLOC
struct ol_string_header { int magic; /* For a sentinel value */ };
#else /* !DEBUG_ALLOC */
struct ol_string_header {}; <--------------Line 67.
#endif /* !DEBUG_ALLOC */
My C is a little old. I'll have to crack out my very old Kernigan book. Can you create a null pointer to a struct like that? Is this a picky compiler and should ignore it? I was able to get this compiled using. gcc. I HAVE to get this compiled with the SUN compiler. Yes I am brave.
try this patch: Index: objbase.h =================================================================== RCS file: /var/cvs/syslog-ng/libol/src/objbase.h,v retrieving revision 1.3 diff -u -r1.3 objbase.h --- objbase.h 10 Jul 1999 13:23:09 -0000 1.3 +++ objbase.h 30 Apr 2003 08:08:52 -0000 @@ -57,26 +57,27 @@ #ifdef DEBUG_ALLOC -struct ol_string_header +struct ol_string { - int magic; /* For a sentinel value */ + int magic; + UINT32 use_cnt; + /* NOTE: The allocated size may be larger than the string length. */ + UINT32 length; + UINT8 data[1]; }; -#else /* !DEBUG_ALLOC */ - -struct ol_string_header {}; -#endif /* !DEBUG_ALLOC */ +#else /* !DEBUG_ALLOC */ struct ol_string { - struct ol_string_header header; - UINT32 use_cnt; /* NOTE: The allocated size may be larger than the string length. */ UINT32 length; UINT8 data[1]; }; + +#endif /* !DEBUG_ALLOC */ struct ol_string *ol_string_alloc(UINT32 length); void ol_string_free(struct ol_string *s); Index: xalloc.c =================================================================== RCS file: /var/cvs/syslog-ng/libol/src/xalloc.c,v retrieving revision 1.9 diff -u -r1.9 xalloc.c --- xalloc.c 16 Sep 2002 08:23:22 -0000 1.9 +++ xalloc.c 30 Apr 2003 08:08:52 -0000 @@ -211,7 +211,7 @@ struct ol_string *s = xalloc(sizeof(struct ol_string) - 1 + length); #ifdef DEBUG_ALLOC - s->header.magic = -1717; + s->magic = -1717; #endif s->length = length; s->use_cnt = 1; @@ -229,9 +229,9 @@ assert(s->use_cnt); if (--s->use_cnt == 0) { #ifdef DEBUG_ALLOC - if (s->header.magic != -1717) + if (s->magic != -1717) fatal("ol_string_free: Not string!\n"); - s->header.magic = 9999; + s->magic = 9999; #endif ol_free(s); } -- Bazsi PGP info: KeyID 9AF8D0A9 Fingerprint CD27 CFB0 802C 0944 9CFD 804E C82C 8EB1
participants (2)
-
Balazs Scheidler
-
Jay Davis