zeromq / libzmq

ZeroMQ core engine in C++, implements ZMTP/3.1

Home Page:https://www.zeromq.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[macOS/Macports] Build error: unknown type name 'clockid_t'; did you mean 'clock_id_t'?

barracuda156 opened this issue · comments

We have now build failure for zmq on 10.11 and below:

/opt/local/var/macports/build/_opt_bblocal_var_buildworker_ports_build_ports_devel_zmq/zmq-devel/work/libzmq-8c725093ac4b44a97e6cb64566989ef12b71986c/src/clock.cpp
In file included from /opt/local/var/macports/build/_opt_bblocal_var_buildworker_ports_build_ports_devel_zmq/zmq-devel/work/libzmq-8c725093ac4b44a97e6cb64566989ef12b71986c/src/clock.cpp:31:
In file included from /opt/local/var/macports/build/_opt_bblocal_var_buildworker_ports_build_ports_devel_zmq/zmq-devel/work/libzmq-8c725093ac4b44a97e6cb64566989ef12b71986c/src/clock.hpp:48:
/opt/local/include/LegacySupport/time.h:83:27: error: unknown type name 'clockid_t'; did you mean 'clock_id_t'?
extern int clock_gettime( clockid_t clk_id, struct timespec *ts );
                          ^
/usr/include/mach/clock_types.h:53:13: note: 'clock_id_t' declared here
typedef int     clock_id_t;                     /* clock identification type */
                ^

Both zmq 4.3.4 and devel build fail likewise.

The following patch fixes the build (and does not affect the build on newer macOS):

--- a/src/clock.hpp	2023-08-27 04:19:35.000000000 +0700
+++ b/src/clock.hpp	2023-09-24 23:52:51.000000000 +0700
@@ -7,14 +7,6 @@
 #include "stdint.hpp"

 #if defined ZMQ_HAVE_OSX
-// TODO this is not required in this file, but condition_variable.hpp includes
-// clock.hpp to get these definitions
-#ifndef CLOCK_REALTIME
-#define CLOCK_REALTIME 0
-#endif
-#ifndef HAVE_CLOCK_GETTIME
-#define HAVE_CLOCK_GETTIME
-#endif

 #include <mach/clock.h>
 #include <mach/mach.h>

Is it the correct solution, or what would you suggest instead?

See also: https://trac.macports.org/ticket/68213
macports/macports-ports#20574
Logs for 4.3.4 on all macOS versions 10.6+ can be found on: https://ports.macports.org/port/zmq/details