Bug 15463 - Build fails on Solaris because ctime_r requires three arguments
Summary: Build fails on Solaris because ctime_r requires three arguments
Status: RESOLVED FIXED
Alias: None
Product: cairo
Classification: Unclassified
Component: general (show other bugs)
Version: 1.6.2
Hardware: SPARC Solaris
: medium normal
Assignee: Carl Worth
QA Contact: cairo-bugs mailing list
URL:
Whiteboard:
Keywords:
: 15516 15566 (view as bug list)
Depends on:
Blocks:
 
Reported: 2008-04-11 16:53 UTC by David Hollenberg
Modified: 2008-04-25 10:53 UTC (History)
2 users (show)

See Also:
i915 platform:
i915 features:


Attachments
Patch to compile under Solaris 10 (559 bytes, patch)
2008-04-25 05:03 UTC, Sebastien Pouliot
Details | Splinter Review

Description David Hollenberg 2008-04-11 16:53:55 UTC
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 "="
Comment 1 Carl Worth 2008-04-15 09:13:37 UTC
*** Bug 15516 has been marked as a duplicate of this bug. ***
Comment 2 Carl Worth 2008-04-15 09:19:06 UTC
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

Should help

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.

-Carl
Comment 3 David Meleedy 2008-04-15 13:50:46 UTC
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.
Comment 4 Sebastien Pouliot 2008-04-25 05:03:33 UTC
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.
Comment 5 Chris Wilson 2008-04-25 10:53:38 UTC
commit 6135ee716b4f2567f578fd023ba2d85c86cb7fda
Author: Sebastien Pouliot <sebastien@ximian.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
    semantics.
    
    (Fixes https://bugs.freedesktop.org/show_bug.cgi?id=15463.)
Comment 6 Chris Wilson 2008-04-25 10:53:49 UTC
*** Bug 15566 has been marked as a duplicate of this bug. ***


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.