Compiling Cyrus with Sun Studio on Solaris
Marty Lee
marty at maui-systems.co.uk
Sat Aug 22 03:28:48 EDT 2015
Hi,
I’m finally getting around to building the newer versions of Cyrus for our Solaris
platform, and the Sun Studio compiler is complaining about lib/imapopts.c - using
google, it seems the C standard Stuido uses won’t accept type-casting to a union
and that it’s a gcc specific feature.
To get things to compile with just warnings, I’ve added:
/* Sun C Compilers are more strict that GNU and won't allow type
* casting to a union
*/
#if defined(__SUNPRO_C) || defined(__SUNPRO_CC)
#define U_CFG_V
#else
#define U_CFG_V (union config_value)
#endif
to the top of the file, and then the option constructs change from
{ IMAPOPT_ADDRESSBOOKPREFIX, "addressbookprefix", 0, OPT_STRING,
(union config_value)((const char *) "#addressbooks"),
(union config_value)((const char *) "#addressbooks"),
{ { NULL, IMAP_ENUM_ZERO } } },
to
{ IMAPOPT_ADDRESSBOOKPREFIX, "addressbookprefix", 0, OPT_STRING,
U_CFG_V((const char *) "#addressbooks"),
U_CFG_V((const char *) "#addressbooks"),
{ { NULL, IMAP_ENUM_ZERO } } },
Patch file for 2.5.5 attached that does it this way which allows it
to compile on Solaris with the Sun Studio compilers.
I also then had a look at 3.0.0 b1, just for a bit of fun and
to check out while I was in ‘cyrus-testing’ mode on our platform.
Same error with ‘lib/imapopts.c’, but out of curiosity, I went a
step further and tried to remove the warnings; these are on the
options that use ‘(long)’ and ‘(enum)’ casting. To make them
go away completely, you need to specify which part of the
structure in the union is being set, i.e.
{ IMAPOPT_ANYONEUSERACL, "anyoneuseracl", 0, OPT_SWITCH,
NULL, IMAPOPT_ZERO,
(union config_value)((long) 1),
(union config_value)((long) 1),
{ { NULL, IMAP_ENUM_ZERO } } },
becomes
{ IMAPOPT_ANYONEUSERACL, "anyoneuseracl", 0, OPT_SWITCH,
NULL, IMAPOPT_ZERO,
.val.i = ((long) 1),
.def.i = ((long) 1),
{ { NULL, IMAP_ENUM_ZERO } } },
Similar needed for the ‘enums’ that are within the opt structures.
Clearly doing it this way is a lot more work to change all the items
and make sure they are done right, so I only did enough to prove
I was on the right track and stopped (hence no patch file!).
The 3.0.0 b1 compile then failed as it was missing ‘httpd.h’,
so I’m guessing there is another dependency that configure isn’t
picking up.
libtool: compile: cc -DHAVE_CONFIG_H -I. -I./com_err/et -I. -I./lib -I. -I./lib -DLIBEXEC_DIR=\"/opt/cyrus/libexec\" -DSBIN_DIR=\"/opt/cyrus/sbin\" -DSYSCONF_DIR=\"/etc/cyrus\" -DHAVE_CONFIG_H -I/opt/sasl2/include -I/opt/openssl/include -I/opt/openldap/include -I/opt/gnu/include/libxml2 -I/opt/sqlite/include -I/opt/gnu/include -I/opt/gnu/include -I/opt/sqlite/include -I/opt/gnu/include -g -c imap/caldav_alarm.c -KPIC -DPIC -o imap/.libs/imap_libcyrus_imap_la-caldav_alarm.o
"lib/util.h", line 275: warning: attribute "format" is unknown, ignored
"imap/caldav_alarm.c", line 54: cannot find include file: "httpd.h"
"imap/caldav_alarm.c", line 55: cannot find include file: "http_dav.h"
"imap/caldav_alarm.c", line 494: warning: implicit function declaration: caldav_get_period
What is supposed to provide ‘httpd.h’ and ‘http_dav.h’ files for
caldav_alarm? As I build everything from source myself, it’s not that
I don’t have a ‘-dev’ package missing; more likely its an entire
library and configure didn’t alert me to it (or I missed the message!)
Lastly, 3.0.0 b1 imap/notify.c line 163 tries to return a value from
a void function. Solaris compilers complain and abort about this. I’ve
split it into a call to the function, followed by an empty return
statement.
Simple patch attached for that one.
I’ll start playing/testing the 2.5.5 build on our Solaris platform over
the next couple of days; if there are any other issues, I’ll let people
know. In the meantime, if anyone can point me at what else I need for
3.0.0 b1 to compile, that would be useful.
Cheers
marty
-------------- next part --------------
A non-text attachment was scrubbed...
Name: imapopts.c.patch
Type: application/octet-stream
Size: 147006 bytes
Desc: not available
Url : http://lists.andrew.cmu.edu/pipermail/cyrus-devel/attachments/20150822/f520e891/attachment-0002.obj
-------------- next part --------------
A non-text attachment was scrubbed...
Name: notify.c.patch
Type: application/octet-stream
Size: 754 bytes
Desc: not available
Url : http://lists.andrew.cmu.edu/pipermail/cyrus-devel/attachments/20150822/f520e891/attachment-0003.obj
-------------- next part --------------
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 203 bytes
Desc: Message signed with OpenPGP using GPGMail
Url : http://lists.andrew.cmu.edu/pipermail/cyrus-devel/attachments/20150822/f520e891/attachment-0001.bin
More information about the Cyrus-devel
mailing list