Skip to content

[BUG] KeyDB 6.2.1 does not compile on macOS #384

@alebcay

Description

@alebcay

Describe the bug
Building KeyDB 6.2.1 results in the following error on macOS:

clang -o luac  luac.o print.o liblua.a -lm 
      CC ae.o
      CC adlist.o
      CC quicklist.o
      CC anet.o
      CC server.o
      CC dict.o
      CC sds.o
      CC zmalloc.o
      CC lzf_c.o
      CC lzf_d.o
      CC pqsort.o
      CC zipmap.o
      CC sha1.o
      CC ziplist.o
      CC release.o
      CC networking.o
      CC util.o
      CC object.o
      CC db.o
      CC replication.o
      CC rdb.o
  server.cpp:6565:9: error: use of undeclared identifier 'clock_nanosleep'
          clock_nanosleep(CLOCK_MONOTONIC, 0, &delay, NULL);
          ^
  1 error generated.
  make[1]: *** [server.o] Error 1
  make[1]: *** Waiting for unfinished jobs....
  make: *** [install] Error 2

To reproduce

Download and unpack the source for KeyDB 6.2.1, then make install PREFIX=<an arbitrary dir>.

Expected behavior

The build should succeed and KeyDB 6.2.1 should be installed to the specified prefix.

Additional information

This issue seems to stem from b03eab2, when a usage of clock_nanosleep() was introduced in src/server.cpp, which is not available on macOS. It looks like macOS does have a nanosleep() function and a mach_wait_until() function available but it's unclear to me if either are a drop-in replacement.

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