Project

General

Profile

Bug #239

Compilation failure on macOS 10.12 due to clock_gettime introduced by Apple

Added by Zhiming Wang over 2 years ago. Updated over 2 years ago.

Status:
Feedback
Priority:
Normal
Assignee:
-
Start date:
09/28/2016
Due date:
% Done:

90%


Description

clock_gettime is defined in <time.h> starting from macOS 10.12 Sierra. I have attached the man page. However, due to clock_gettime check disabled for Darwin in cmake/checks.cmake and redefinition

#ifdef __APPLE__

#include <mach/mach_time.h>

#define CLOCK_MONOTONIC 0
#define clockid_t int

static inline int clock_gettime_custom(clockid_t clk_id __attribute__((unused)), struct timespec *tp) {
    ...
}

#endif

in src/compat.h, compilation will fail:

...
/tmp/fastd-20160928-95103-ns3kuc/fastd-18/src/crypto/mac/uhash/builtin/../../../../compat.h:97:19: error: static declaration of 'clock_gettime' follows non-static declaration
...

clock_gettime.3.gz - man page of clock_gettime in macOS 10.12 (2.45 KB) Zhiming Wang, 09/28/2016 01:18 PM

History

#1 Updated by Matthias Schiffer over 2 years ago

Thanks for the report. I'll write a fix, but I probably won't be able to test it on a MacOS system myself.

#2 Updated by Zhiming Wang over 2 years ago

No problem, as long as there's a patch I can test it for you.

#3 Updated by Matthias Schiffer over 2 years ago

  • % Done changed from 0 to 90
  • Status changed from New to Feedback

I've pushed a patch that should fix your issue.

#4 Updated by Moritz Fago over 2 years ago

compiles on macOS Sierra 10.12.
should I create a patch in homebrew?
Maybe you could link to the homebrew formula?

#5 Updated by Zhiming Wang over 2 years ago

Sorry for the late reply, I've been too occupied lately. The patch works, thanks.

As for Homebrew, the formula will be fixed once https://github.com/Homebrew/homebrew-core/pull/6012 is CI-tested and merged.

#6 Updated by Zhiming Wang over 2 years ago

Moritz: FYI I shipped the patch in Homebrew.

Also available in: Atom PDF