Skip to content

Unable to compile on solaris since 2.8.10 due to ctime_r missing arguments #1837

Closed

Description

@AndLindemann

Due to a change in sentinel.c, redis no longer compiles on Solaris since Redis 2.8.10.

sentinel.c: In function 'sentinelStartFailoverIfNeeded':
sentinel.c:3354:13: error: too few arguments to function 'ctime_r'
/usr/include/time.h:300:14: note: declared here

I believe ctime_r requires 3 arguments on Solaris.

Activity

  1. mattsta commented on Jun 26, 2014

    @mattsta
    Contributor

    From some documentation: we need to set define _POSIX_C_SOURCE to get correct functions on Solaris.

    define the _POSIX_C_SOURCE flag with a value >= 199506L.

    from http://www.unix.com/man-page/opensolaris/3c/ctime_r/

  2. AndLindemann commented on Jun 30, 2014

    @AndLindemann
    Author

    Just adding that other than this, redis has been running perfectly fine without errors or interruptions on Solaris for many months on our systems now. So hopefully this issue can be solved so that we can update from 2.8.9 to a recent build.

  3. antirez commented on Jun 30, 2014

    @antirez
    Contributor

    @AndLindemann please could you try if the following patch works?

    diff --git a/src/fmacros.h b/src/fmacros.h
    index c16f5e2..44e378a 100644
    --- a/src/fmacros.h
    +++ b/src/fmacros.h
    @@ -46,6 +46,10 @@
     #define _XOPEN_SOURCE
     #endif
    
    +#if defined(__sun)
    +#define _POSIX_C_SOURCE 199506L
    +#endif
    +
     #define _LARGEFILE_SOURCE
     #define _FILE_OFFSET_BITS 64
  4. AndLindemann commented on Jun 30, 2014

    @AndLindemann
    Author

    Applied and compiled successfully.

    Server

    redis_version:2.8.12
    redis_git_sha1:00000000
    redis_git_dirty:0
    redis_build_id:fd9346685c48d0b5
    redis_mode:standalone
    os:SunOS 5.10 sun4u
    arch_bits:64

  5. antirez commented on Jun 30, 2014

    @antirez
    Contributor

    Great, committing into all branches.

  6. antirez commented on Jun 30, 2014

    @antirez
    Contributor

    Thanks to @mattsta for providing the solution to the problem. Closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions