Hi, this is a solution to a bug that was reported 2008-12-08 (quoted 
below)...

Compiling cfengine on Solaris 10, with Sun's compiler, you get: (among 
other errors)
"do.c", line 2847: syntax error before or at: :

This is caused by ?: on line 2487 on do.c:
snprintf(lock,CF_BUFSIZE-1,"%s_%d_%s_%d_%s_%s", name, ptr->cmp, ptr->ver 
?: "" ,ptr->action, ptr->defines ?: "", ptr->elsedef ?: "");

Gcc allows "x ?: y" instead of the strictly correct "x ? x : y". (More 
info: http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_4.html#SEC70 )

We were able to compile by changing line 2847 in do.c to:

snprintf(lock,CF_BUFSIZE-1,"%s_%d_%s_%d_%s_%s", name, ptr->cmp, ptr-ver 
? ptr->ver : "", ptr->action, ptr->defines ? ptr->defines : "", 
ptr->elsedef ? ptr->elsedef : "");

We also found that cfengine required GNU flex in order to successfully 
compile on Solaris 10 using the Sun compiler, else we got symbol 
referencing errors for "yyless" and "yywrap".

Also, good news, gcc 4.4.0 does compile on Solaris 10. It's not 
officially released yet, but you can download the latest build if you're 
feeling lucky.

Hope that helps.

- Nada O'Neal, Columbia University

On Mon Dec 8 21:55:53 CET 2008 Chris wrote:
> Hello again...I running into some trouble compiling the latest 
> cfengine-2 trunk from SVN this time under Solaris 10. It runs for a 
> while and eventually builds libcfengine.la but then gets into trouble 
> (see output below).
> 
> I am using Sun's C compiler:
> 
> $ cc -V
> cc: Sun C 5.8 Patch 121015-06 2007/10/03
> 
> I had the same error on Solaris 9 but it compiled successfully with gcc 
> 3.3.2. Unfortunately gcc chokes very early on if I try to compile on 
> Solaris 10. Any ideas?
> 
> 
> Thanks,
> 
> Chris
> 
>> source='do.c' object='do.o' libtool=no \
>> DEPDIR=.deps depmode=none /bin/bash ../depcomp \
>> cc -DHAVE_CONFIG_H -I. -I. -I. -I/common/include -I/common/include   
>> -D_REENTRANT  -D_REENTRANT  -g -I/common/include -D_LARGEFILE_SOURCE 
>> -D_FILE_OFFSET_BITS=64 -D_REENTRANT  -g -I/common/include 
>> -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -c do.c
>> "do.c", line 2847: syntax error before or at: :
>> "do.c", line 2935: cannot recover from previous errors
>> cc: acomp failed for do.c
>> *** Error code 2
>> make: Fatal error: Command failed for target `do.o'
>> Current working directory /disk/managed/common/pkg/cfengine-2.2.9b1/src/src
>> *** Error code 1
>> make: Fatal error: Command failed for target `all'
>> Current working directory /disk/managed/common/pkg/cfengine-2.2.9b1/src/src
>> *** Error code 1
>> The following command caused the error:
>> failcom='exit 1'; \
>> for f in x $MAKEFLAGS; do \
>>   case $f in \
>>     *=* | --[!k]*);; \
>>     *k*) failcom='fail=yes';; \
>>   esac; \
>> done; \
>> dot_seen=no; \
>> target=`echo all-recursive | sed s/-recursive//`; \
>> list='pub src contrib inputs '; for subdir in $list; do \
>>   echo "Making $target in $subdir"; \
>>   if test "$subdir" = "."; then \
>>     dot_seen=yes; \
>>     local_target="$target-am"; \
>>   else \
>>     local_target="$target"; \
>>   fi; \
>>   (cd $subdir && make  $local_target) \
>>   || eval $failcom; \
>> done; \
>> if test "$dot_seen" = "no"; then \
>>   make  "$target-am" || exit 1; \
>> fi; test -z "$fail"
>> make: Fatal error: Command failed for target `all-recursive'
_______________________________________________
Bug-cfengine mailing list
[email protected]
https://cfengine.org/mailman/listinfo/bug-cfengine

Reply via email to