I am building libfaketime in the official CentOS7 container. Works fine for Intel. When I build it on an M1 MacBook, I get:
libfaketime.c:2300:5: error: conflicting types for ‘gettimeofday’
int gettimeofday(struct timeval *tv, void *tz)
^
In file included from /usr/include/sys/procfs.h:32:0,
from /usr/include/sys/ucontext.h:26,
from /usr/include/signal.h:360,
from libfaketime.c:79:
/usr/include/sys/time.h:72:12: note: previous declaration of ‘gettimeofday’ was here
extern int gettimeofday (struct timeval *__restrict __tv,
^
The reason is that signal.h eventually includes sys/time.h, which results in a conflict between the gettimeofday() there and the one in libfaketime.c. The Intel version of the CentOS container does not have this problem because sys/time.h does not end up getting included there.
I have a solution that is working for me but I wanted to create a ticket to attach a PR to.
I am building libfaketime in the official CentOS7 container. Works fine for Intel. When I build it on an M1 MacBook, I get:
The reason is that
signal.h
eventually includessys/time.h
, which results in a conflict between thegettimeofday()
there and the one inlibfaketime.c
. The Intel version of the CentOS container does not have this problem becausesys/time.h
does not end up getting included there.I have a solution that is working for me but I wanted to create a ticket to attach a PR to.