Cannot compile cyrus-2.2.2-BETA with Sun compiler (lib/imapopts.c)

Christos Soulios soulbros at noc.uoa.gr
Wed Nov 26 08:01:22 EST 2003


Quoting Paul Boven <p.boven at chello.nl>:

This is caused because of the fact that Sun compiler is stricter on C standards.
 Ansi C forbids the type casting to a union. However, it is implemented as an
extension by gcc. In my opinion this is wrong, because it violates some C
standards. 

In this case you may compile cyrus 2.2.2-BETA if you remove the '(union
config_value)' from all the lines of imapopts.c

Then the compilation will continue throwing only some warnings until it breaks
later in file lib/libcyr_cfg.c where there is another union type cast. (
(union cyrus_config_value))

You must remove this too and the compilation will end normally. 

For the time being removing these union castings is harmless for the binaries
and cyrus function, but there are cases when this may break things down. And I
am afraid that this will happen in some future release.

I think that the cyrus developers should deal with this problem, other than gcc
compilers are excluded. 

Regards,
  Christos




> L.S.,
> 
> Build system is a Solaris 9 with SunOne aka Forte 7 compiler collection. 
> Both compiler and OS patches were updated before I began this project.
> 
> While trying to build cyrus-imapd-2.2.2-BETA I run into the following 
> problem:
> 
> cc -c -I.. -I/usr/local/BerkeleyDB.4.1//include  -I/usr/local/include 
> -I./../et -I/usr/local/include -DHAVE_CONFIG_H -I. -I. -g \
> imapopts.c
> "imapopts.c", line 35: invalid cast expression
> "imapopts.c", line 35: initialization type mismatch
> "imapopts.c", line 36: invalid cast expression
> "imapopts.c", line 36: initialization type mismatch
> "imapopts.c", line 37: invalid cast expression
> "imapopts.c", line 37: initialization type mismatch
> ...
> "imapopts.c", line 141: invalid cast expression
> "imapopts.c", line 141: initialization type mismatch
> "imapopts.c", line 142: invalid cast expression
> "imapopts.c", line 142: initialization type mismatch
> cc: acomp failed for imapopts.c
> make[1]: *** [imapopts.o] Error 2
> 
> Every line of 'struct imapopts' causes the compiler to fail. Compiling 
> cyrus with GCC does work, but would cause a performance penalty. I 
> assume the (union config_value)((const char *) entries are to blame. 
> This is a bit beyond my level of C expertise, could someone suggest a 
> less compiler-dependent version of this construction?
> 
> Regards, Paul Boven.
> 

-- 
/**
 * Christos Soulios
 * University of Athens
 * e-mail : soulbros(AT)noc.uoa.gr
 */





More information about the Info-cyrus mailing list