Building cairo on Solaris 10 fails, when compiled with Sun Studio 12.
The error is:
"cairo-ps-surface.c", line 110: prototype mismatch: 2 args passed, 3 expected
Line 110 is:
ctime_r (&now, ctime_buf)
On Solaris, ctime_r takes a third argument. Prototype is:
char *ctime_r(const time_t *clock, char *buf, int buflen);
So on Solaris the correct call is:
ctime_r (&now, ctime_buf, 26)
After I made this change, everything compiled, though there were a lot of
warnings like this (in many source files):
"cairo-ps-surface.c", line 389: warning: enum type mismatch: op "="
*** Bug 15516 has been marked as a duplicate of this bug. ***
This issue came up on the cairo mailing list, and Andreas Tobler suggested the following:
You might try to compile with:
-D_POSIX_PTHREAD_SEMANTICS | -D_POSIX_C_SOURCE=199506L
Nobody has yet suggested any change to cairo to make things more portable here.
I'd still be happy if someone can make such a suggestion.
I was able to verify that defining my CFLAGS as:
setenv CFLAGS "-O3 -D_POSIX_PTHREAD_SEMANTICS"
fixed the compilation issues I was seeing on both Solaris 8 & 10.
The only suggestion I can make for fixing this is setting up the
configure script to automatically add in this CFLAGS option for
Solaris builds, but I'm not a configure script expert.
Created attachment 16177 [details] [review]
Patch to compile under Solaris 10
This is the patch that libgdiplus is now using to build Cairo on Solaris 10 x86 (our other Solaris bots, 8 and SPARC, are currently down). All (libgdiplus) unit tests pass.
Author: Sebastien Pouliot <email@example.com>
Date: Fri Apr 25 18:43:01 2008 +0100
[configure.in] Build fails on Solaris due to non-POSIX ctime_r()
Check for a Solaris build host and adjust the CFLAGS to force POSIX
*** Bug 15566 has been marked as a duplicate of this bug. ***