Opened 12 months ago

Last modified 12 months ago

#68308 assigned defect

legacy-support clock update resulted in a bug: /opt/local/include/LegacySupport/time.h:83:27: error: unknown type name 'clockid_t'; did you mean 'clock_id_t'?

Reported by: barracuda156 Owned by: catap (Kirill A. Korinsky)
Priority: Normal Milestone:
Component: ports Version: 2.8.1
Keywords: Cc: mascguy (Christopher Nielsen), macportsraf
Port: legacy-support

Description

Just got the following with R-webfakes build:

/opt/local/bin/gcc-mp-12 -I"/opt/local/Library/Frameworks/R.framework/Resources/include" -DNDEBUG   -isystem/opt/local/include/LegacySupport -I/opt/local/include   -DNO_CGI -DNO_FILES -DARCH_IS_BIG_ENDIAN=1 -fPIC  -pipe -Os -arch ppc  -c civetweb.c -o civetweb.o
In file included from /usr/include/sys/time.h:197,
                 from /opt/local/include/LegacySupport/sys/time.h:25,
                 from civetweb.c:371:
/opt/local/include/LegacySupport/time.h:83:27: error: unknown type name 'clockid_t'; did you mean 'clock_id_t'?
   83 | extern int clock_gettime( clockid_t clk_id, struct timespec *ts );
      |                           ^~~~~~~~~
      |                           clock_id_t
/opt/local/include/LegacySupport/time.h:84:27: error: unknown type name 'clockid_t'; did you mean 'clock_id_t'?
   84 | extern int clock_getres ( clockid_t clk_id, struct timespec *ts );
      |                           ^~~~~~~~~
      |                           clock_id_t
make: *** [civetweb.o] Error 1
ERROR: compilation failed for package ‘webfakes’

See also #68213

Change History (6)

comment:1 Changed 12 months ago by barracuda156

If I change:

#define CLOCK_MONOTONIC (1)
#define CLOCK_REALTIME (2)

#include <mach/clock.h>
#include <mach/mach.h>
#include <mach/mach_time.h>
#include <sys/errno.h>
#include <sys/time.h>

to:

#include <mach/clock.h>
#include <mach/mach.h>
#include <mach/mach_time.h>
#include <sys/errno.h>
#include <sys/time.h>

#define CLOCK_MONOTONIC (1)
#define CLOCK_REALTIME (2)

the port builds, but complains:

/opt/local/bin/gcc-mp-12 -I"/opt/local/Library/Frameworks/R.framework/Resources/include" -DNDEBUG   -isystem/opt/local/include/LegacySupport -I/opt/local/include   -DNO_CGI -DNO_FILES -DARCH_IS_BIG_ENDIAN=1 -fPIC  -pipe -Os -arch ppc  -c civetweb.c -o civetweb.o
civetweb.c:370: warning: "CLOCK_MONOTONIC" redefined
  370 | #define CLOCK_MONOTONIC (1)
      | 
In file included from /usr/include/sys/time.h:197,
                 from /opt/local/include/LegacySupport/sys/time.h:25,
                 from civetweb.c:368:
/opt/local/include/LegacySupport/time.h:55: note: this is the location of the previous definition
   55 | #define CLOCK_MONOTONIC             6
      | 
civetweb.c:371: warning: "CLOCK_REALTIME" redefined
  371 | #define CLOCK_REALTIME (2)
      | 
/opt/local/include/LegacySupport/time.h:52: note: this is the location of the previous definition
   52 | #define CLOCK_REALTIME              0
      |

Finally, if I do this:

#include <mach/clock.h>
#include <mach/mach.h>
#include <mach/mach_time.h>
#include <sys/errno.h>
#include <sys/time.h>

#undef CLOCK_MONOTONIC
#undef CLOCK_REALTIME
#define CLOCK_MONOTONIC (1)
#define CLOCK_REALTIME (2)

it builds cleanly, but I am not sure this is the right thing to do :)

comment:2 in reply to:  1 ; Changed 12 months ago by catap (Kirill A. Korinsky)

Replying to barracuda156:

it builds cleanly, but I am not sure this is the right thing to do :)

Never redefine system's value with some random value. It is a good way to spend hours, days and probably weeks in attempts to understand wtf is going on.

comment:3 in reply to:  2 Changed 12 months ago by barracuda156

Replying to catap:

Replying to barracuda156:

it builds cleanly, but I am not sure this is the right thing to do :)

Never redefine system's value with some random value. It is a good way to spend hours, days and probably weeks in attempts to understand wtf is going on.

Should we raise this to R-webfakes upstream? Source which fails: https://github.com/r-lib/webfakes/blob/b10bfbfa1589d02b84d0e41c1f542b5df495b241/src/civetweb.c#L354-L433

comment:4 Changed 12 months ago by catap (Kirill A. Korinsky)

Yes. I doubt that current code will be build on modern macOS.

comment:5 in reply to:  4 Changed 12 months ago by barracuda156

Replying to catap:

Yes. I doubt that current code will be build on modern macOS.

Apparently it does, at least on CRAN: https://cran.r-project.org/web/checks/check_flavors.html#r-release-macos-x86_64

comment:6 Changed 12 months ago by barracuda156

But removing defines works fine for me: ` --- src/civetweb.c.orig 2023-10-01 02:51:01.000000000 +0800 +++ src/civetweb.c 2023-10-01 19:22:44.000000000 +0800 @@ -361,9 +361,6 @@

#endif #endif

-#define CLOCK_MONOTONIC (1) -#define CLOCK_REALTIME (2) -

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

`

Version 0, edited 12 months ago by barracuda156 (next)
Note: See TracTickets for help on using tickets.