HAVE_MONOTONIC_CLOCK on macOS
I believe I'm hitting a related issue on macOS. I notice that it is possible to build dbus 1.15.0 on macOS with CMake, but not with Meson. I believe this has to do with HAVE_MONOTONIC_CLOCK
being defined in Meson on macOS. I didn't see the option in any CMake-related files, which is probably why compilation was previously successful on macOS.
Here's the snippet of the build failure. The full log is available here.
clang -Idbus/libdbus-1.3.dylib.p -Idbus -I../src/dbus -I. -I../src -fcolor-diagnostics -Wall -Winvalid-pch -O0 -g -D_GNU_SOURCE -fno-strict-aliasing -D__USE_MINGW_ANSI_STDIO=0 -fno-common -Wno-missing-field-initializers -Wno-unused-parameter -Warray-bounds -Wcast-align -Wchar-subscripts -Wdouble-promotion -Wfloat-equal -Wformat-nonliteral -Wformat-security -Wformat=2 -Winit-self -Winline -Wmissing-declarations -Wmissing-format-attribute -Wmissing-include-dirs -Wmissing-noreturn -Wnull-dereference -Wpacked -Wpointer-arith -Wredundant-decls -Wreturn-type -Wshadow -Wsign-compare -Wstrict-aliasing -Wswitch-default -Wswitch-enum -Wundef -Wwrite-strings -Wdeclaration-after-statement -Wimplicit-function-declaration -Wmissing-prototypes -Wnested-externs -Wold-style-definition -Wpointer-sign -Wstrict-prototypes -isysroot /Applications/conan/xcode/13/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.3.sdk -arch x86_64 -Ddbus_1_EXPORTS -MD -MQ dbus/libdbus-1.3.dylib.p/dbus-sysdeps-pthread.c.o -MF dbus/libdbus-1.3.dylib.p/dbus-sysdeps-pthread.c.o.d -o dbus/libdbus-1.3.dylib.p/dbus-sysdeps-pthread.c.o -c ../src/dbus/dbus-sysdeps-pthread.c
../src/dbus/dbus-sysdeps-pthread.c:188:5: error: implicit declaration of function 'pthread_condattr_setclock' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
pthread_condattr_setclock (&attr, CLOCK_MONOTONIC);
^
../src/dbus/dbus-sysdeps-pthread.c:188:5: note: did you mean 'pthread_condattr_destroy'?
/Applications/conan/xcode/13/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.3.sdk/usr/include/pthread.h:315:5: note: 'pthread_condattr_destroy' declared here
int pthread_condattr_destroy(pthread_condattr_t *);
^
1 error generated.
It appears that macOS does not provide a pthread_condattr_setclock
function at all. Perhaps macOS requires using an alternative function?
See follow up on separate issue here. A new issue has been opened here.