GNU bug report logs - #57346
undeclared identifier 'CLOCK_MONOTONIC'

Previous Next

Package: emacs;

Reported by: Glenn Morris <rgm <at> gnu.org>

Date: Mon, 22 Aug 2022 20:47:02 UTC

Severity: normal

Found in version 29.0.50

Fixed in version 29.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 57346 in the body.
You can then email your comments to 57346 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#57346; Package emacs. (Mon, 22 Aug 2022 20:47:03 GMT) Full text and rfc822 format available.

Message #3 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Glenn Morris <rgm <at> gnu.org>
To: submit <at> debbugs.gnu.org
Subject: undeclared identifier 'CLOCK_MONOTONIC'
Date: Mon, 22 Aug 2022 16:46:51 -0400
Package: emacs
Version: 29.0.50

OS X Clang build failing for three weeks. Ref:
https://hydra.nixos.org/build/186116177
https://hydra.nixos.org/build/188132926

xterm.c:6659:3: warning: implicit declaration of function
'clock_gettime' is invalid in C99 [-Wimplicit-function-declaration]
  clock_gettime (CLOCK_MONOTONIC, &time);
  ^
xterm.c:6659:18: error: use of undeclared identifier 'CLOCK_MONOTONIC'
  clock_gettime (CLOCK_MONOTONIC, &time);




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#57346; Package emacs. (Tue, 23 Aug 2022 00:49:01 GMT) Full text and rfc822 format available.

Message #6 received at 57346 <at> debbugs.gnu.org (full text, mbox):

From: Po Lu <luangruo <at> yahoo.com>
To: Glenn Morris <rgm <at> gnu.org>
Cc: 57346 <at> debbugs.gnu.org
Subject: Re: bug#57346: undeclared identifier 'CLOCK_MONOTONIC'
Date: Tue, 23 Aug 2022 08:48:29 +0800
Glenn Morris <rgm <at> gnu.org> writes:

> Package: emacs
> Version: 29.0.50
>
> OS X Clang build failing for three weeks. Ref:
> https://hydra.nixos.org/build/186116177
> https://hydra.nixos.org/build/188132926
>
> xterm.c:6659:3: warning: implicit declaration of function
> 'clock_gettime' is invalid in C99 [-Wimplicit-function-declaration]
>   clock_gettime (CLOCK_MONOTONIC, &time);
>   ^
> xterm.c:6659:18: error: use of undeclared identifier 'CLOCK_MONOTONIC'
>   clock_gettime (CLOCK_MONOTONIC, &time);

Right, the internet says OS X doesn't have clock_gettime.

Does gnulib provide it? Failing that, I'd rather just make vsync
conditional on clock_gettime being available, since the mechanism it
uses cannot possibly work on OS X.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#57346; Package emacs. (Tue, 23 Aug 2022 02:40:02 GMT) Full text and rfc822 format available.

Message #9 received at 57346 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Po Lu <luangruo <at> yahoo.com>
Cc: rgm <at> gnu.org, 57346 <at> debbugs.gnu.org
Subject: Re: bug#57346: undeclared identifier 'CLOCK_MONOTONIC'
Date: Tue, 23 Aug 2022 05:39:20 +0300
> Cc: 57346 <at> debbugs.gnu.org
> Date: Tue, 23 Aug 2022 08:48:29 +0800
> From:  Po Lu via "Bug reports for GNU Emacs,
>  the Swiss army knife of text editors" <bug-gnu-emacs <at> gnu.org>
> 
> Right, the internet says OS X doesn't have clock_gettime.
> 
> Does gnulib provide it?

Not AFAICT.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#57346; Package emacs. (Tue, 23 Aug 2022 06:44:01 GMT) Full text and rfc822 format available.

Message #12 received at 57346 <at> debbugs.gnu.org (full text, mbox):

From: Gerd Möllmann <gerd.moellmann <at> gmail.com>
To: Po Lu <luangruo <at> yahoo.com>
Cc: Glenn Morris <rgm <at> gnu.org>, 57346 <at> debbugs.gnu.org
Subject: Re: bug#57346: undeclared identifier 'CLOCK_MONOTONIC'
Date: Tue, 23 Aug 2022 08:43:21 +0200
Po Lu <luangruo <at> yahoo.com> writes:

>
> Glenn Morris <rgm <at> gnu.org> writes:
>
>> Package: emacs
>> Version: 29.0.50
>>
>> OS X Clang build failing for three weeks. Ref:
>> https://hydra.nixos.org/build/186116177
>> https://hydra.nixos.org/build/188132926
>>
>> xterm.c:6659:3: warning: implicit declaration of function
>> 'clock_gettime' is invalid in C99 [-Wimplicit-function-declaration]
>>   clock_gettime (CLOCK_MONOTONIC, &time);
>>   ^
>> xterm.c:6659:18: error: use of undeclared identifier 'CLOCK_MONOTONIC'
>>   clock_gettime (CLOCK_MONOTONIC, &time);
>
> Right, the internet says OS X doesn't have clock_gettime.

I don't know what version Glenn is building (it just says x86_74-darwin,
AFAICT), so maybe this is not useful, so just in case...

On my system it says for 'man clock_gettime'

DESCRIPTION
...
     CLOCK_MONOTONIC    clock that increments monotonically, tracking the time since an arbitrary point, and will
                        continue to increment while the system is asleep.
...
HISTORY
     These functions first appeared in Mac OSX 10.12





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#57346; Package emacs. (Tue, 23 Aug 2022 07:13:02 GMT) Full text and rfc822 format available.

Message #15 received at 57346 <at> debbugs.gnu.org (full text, mbox):

From: Po Lu <luangruo <at> yahoo.com>
To: Gerd Möllmann <gerd.moellmann <at> gmail.com>
Cc: Glenn Morris <rgm <at> gnu.org>, 57346 <at> debbugs.gnu.org
Subject: Re: bug#57346: undeclared identifier 'CLOCK_MONOTONIC'
Date: Tue, 23 Aug 2022 15:12:23 +0800
Gerd Möllmann <gerd.moellmann <at> gmail.com> writes:

> I don't know what version Glenn is building (it just says x86_74-darwin,
> AFAICT), so maybe this is not useful, so just in case...
>
> On my system it says for 'man clock_gettime'
>
> DESCRIPTION
> ...
>      CLOCK_MONOTONIC    clock that increments monotonically, tracking the time since an arbitrary point, and will
>                         continue to increment while the system is asleep.
> ...
> HISTORY
>      These functions first appeared in Mac OSX 10.12

So I guess OS X 10.12 is relatively new, and the information I saw is
out of date.  We support much older versions anyway, so if nobody has
any better ideas I will make the vsync support conditional on
clock_gettime.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#57346; Package emacs. (Tue, 23 Aug 2022 07:25:02 GMT) Full text and rfc822 format available.

Message #18 received at 57346 <at> debbugs.gnu.org (full text, mbox):

From: Gerd Möllmann <gerd.moellmann <at> gmail.com>
To: Po Lu <luangruo <at> yahoo.com>
Cc: Glenn Morris <rgm <at> gnu.org>, 57346 <at> debbugs.gnu.org
Subject: Re: bug#57346: undeclared identifier 'CLOCK_MONOTONIC'
Date: Tue, 23 Aug 2022 09:24:45 +0200
Po Lu <luangruo <at> yahoo.com> writes:

> So I guess OS X 10.12 is relatively new, and the information I saw is
> out of date.  We support much older versions anyway

FWIW, 10.12 was released 2016, and doesn't get security updates since
November 30, 2019.  Not really advisable to use something like this.
Just saying...




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#57346; Package emacs. (Tue, 23 Aug 2022 10:58:02 GMT) Full text and rfc822 format available.

Message #21 received at 57346 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Po Lu <luangruo <at> yahoo.com>
Cc: Gerd Möllmann <gerd.moellmann <at> gmail.com>,
 Glenn Morris <rgm <at> gnu.org>, 57346 <at> debbugs.gnu.org
Subject: Re: bug#57346: undeclared identifier 'CLOCK_MONOTONIC'
Date: Tue, 23 Aug 2022 12:57:19 +0200
Po Lu <luangruo <at> yahoo.com> writes:

> So I guess OS X 10.12 is relatively new, and the information I saw is
> out of date.  We support much older versions anyway, so if nobody has
> any better ideas I will make the vsync support conditional on
> clock_gettime.

Sounds good.  But I wonder what the OS X version nixos is using, anyway?
I had a look at the log file, and it says:

Configured for 'x86_64-apple-darwin17.7.0'.

But I don't know what that is.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#57346; Package emacs. (Tue, 23 Aug 2022 11:30:02 GMT) Full text and rfc822 format available.

Message #24 received at 57346 <at> debbugs.gnu.org (full text, mbox):

From: Gregory Heytings <gregory <at> heytings.org>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: Po Lu <luangruo <at> yahoo.com>, rgm <at> gnu.org, 57346 <at> debbugs.gnu.org
Subject: Re: bug#57346: undeclared identifier 'CLOCK_MONOTONIC'
Date: Tue, 23 Aug 2022 11:29:06 +0000
>> Right, the internet says OS X doesn't have clock_gettime.
>>
>> Does gnulib provide it?
>
> Not AFAICT.
>

It should be easy to emulate it with what Mac OS X/macOS provides, 
however:

int
clock_gettime (clockid_t ignored /* assuming CLOCK_MONOTONIC */,
               struct timespec *tp)
{
  clock_serv_t cs;
  mach_timespec_t mts;
  kern_return_t ret;
  host_get_clock_service (mach_host_self (), SYSTEM_CLOCK, &cs);
  ret = clock_get_time (cs, &mts);
  mach_port_deallocate(mach_task_self (), cs);
  if (ret) return ret;
  tp->tv_sec = mts.tv_sec;
  tp->tv_nsec = mts.tv_nsec;
}




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#57346; Package emacs. (Tue, 23 Aug 2022 12:27:02 GMT) Full text and rfc822 format available.

Message #27 received at 57346 <at> debbugs.gnu.org (full text, mbox):

From: Po Lu <luangruo <at> yahoo.com>
To: Gregory Heytings <gregory <at> heytings.org>
Cc: rgm <at> gnu.org, Eli Zaretskii <eliz <at> gnu.org>, 57346 <at> debbugs.gnu.org
Subject: Re: bug#57346: undeclared identifier 'CLOCK_MONOTONIC'
Date: Tue, 23 Aug 2022 20:25:42 +0800
Gregory Heytings <gregory <at> heytings.org> writes:

> It should be easy to emulate it with what Mac OS X/macOS provides,
> however:

In that case I'd rather remove the code entirely.  vsync in the X port
can't work on Macintosh X servers anyway (or over a network connection),
and the use of CLOCK_MONOTONIC makes no sense, since the X sample server
will use its internal clock if clock_gettime is not available.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#57346; Package emacs. (Tue, 23 Aug 2022 12:56:02 GMT) Full text and rfc822 format available.

Message #30 received at 57346 <at> debbugs.gnu.org (full text, mbox):

From: Po Lu <luangruo <at> yahoo.com>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: Gerd Möllmann <gerd.moellmann <at> gmail.com>,
 Glenn Morris <rgm <at> gnu.org>, 57346 <at> debbugs.gnu.org
Subject: Re: bug#57346: undeclared identifier 'CLOCK_MONOTONIC'
Date: Tue, 23 Aug 2022 20:55:05 +0800
Lars Ingebrigtsen <larsi <at> gnus.org> writes:

> Po Lu <luangruo <at> yahoo.com> writes:
>
>> So I guess OS X 10.12 is relatively new, and the information I saw is
>> out of date.  We support much older versions anyway, so if nobody has
>> any better ideas I will make the vsync support conditional on
>> clock_gettime.
>
> Sounds good.  But I wonder what the OS X version nixos is using, anyway?
> I had a look at the log file, and it says:

Now done.  Please let me know once problem is also resolved on the nixos
build bot, I will close this bug.

> Configured for 'x86_64-apple-darwin17.7.0'.
>
> But I don't know what that is.

Unfortunately I don't know either.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#57346; Package emacs. (Tue, 23 Aug 2022 13:24:01 GMT) Full text and rfc822 format available.

Message #33 received at 57346 <at> debbugs.gnu.org (full text, mbox):

From: Gregory Heytings <gregory <at> heytings.org>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: Po Lu <luangruo <at> yahoo.com>,
 Gerd Möllmann <gerd.moellmann <at> gmail.com>,
 57346 <at> debbugs.gnu.org, Glenn Morris <rgm <at> gnu.org>
Subject: Re: bug#57346: undeclared identifier 'CLOCK_MONOTONIC'
Date: Tue, 23 Aug 2022 13:23:49 +0000
>
> Configured for 'x86_64-apple-darwin17.7.0'.
>
> But I don't know what that is.
>

See https://github.com/apple/darwin-xnu.

Darwin is the roughly speaking the kernel of all Apple operating systems 
(macOS, iOS, ...).  More precisely, XNU is the kernel of Darwin, and 
Darwin is the core operating system on which Apple operating systems are 
based.  Darwin 17.7.0 is the basis of macOS 10.13.6.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#57346; Package emacs. (Tue, 23 Aug 2022 15:05:01 GMT) Full text and rfc822 format available.

Message #36 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Howard Melman <hmelman <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: Re: bug#57346: undeclared identifier 'CLOCK_MONOTONIC'
Date: Tue, 23 Aug 2022 11:03:50 -0400
Gregory Heytings <gregory <at> heytings.org> writes:

>> Configured for 'x86_64-apple-darwin17.7.0'.
>>
>> But I don't know what that is.
>>
>
> See https://github.com/apple/darwin-xnu.
>
> Darwin is the roughly speaking the kernel of all Apple operating
> systems (macOS, iOS, ...).  More precisely, XNU is the kernel of
> Darwin, and Darwin is the core operating system on which Apple
> operating systems are based.  Darwin 17.7.0 is the basis of macOS
> 10.13.6.

Nice mapping of versions here:
https://en.wikipedia.org/wiki/Darwin_(operating_system)#Darwin_16_%E2%80%93_19;_OS_X_rebranded_into_macOS

-- 

Howard





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#57346; Package emacs. (Tue, 23 Aug 2022 17:46:01 GMT) Full text and rfc822 format available.

Message #39 received at 57346 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Po Lu <luangruo <at> yahoo.com>
Cc: Gerd Möllmann <gerd.moellmann <at> gmail.com>,
 Glenn Morris <rgm <at> gnu.org>, 57346 <at> debbugs.gnu.org
Subject: Re: bug#57346: undeclared identifier 'CLOCK_MONOTONIC'
Date: Tue, 23 Aug 2022 19:45:39 +0200
Po Lu <luangruo <at> yahoo.com> writes:

> Now done.  Please let me know once problem is also resolved on the nixos
> build bot, I will close this bug.

Hm...  looks like that job is failing, but due to an internal Hydra
error?

 [31;1merror:[0m cannot connect to ‘[35;1mroot <at> e461fe17.packethost.net[0m’: [35;1mroot <at> e461fe17.packethost.net: Permission denied (publickey).[

  https://hydra.nixos.org/eval/1777547

Perhaps they'll have Hydra tomorrow so that we can see whether your fix
did the trick.  :-/





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#57346; Package emacs. (Sun, 04 Sep 2022 11:53:02 GMT) Full text and rfc822 format available.

Message #42 received at 57346 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Po Lu <luangruo <at> yahoo.com>
Cc: Gerd Möllmann <gerd.moellmann <at> gmail.com>,
 Glenn Morris <rgm <at> gnu.org>, 57346 <at> debbugs.gnu.org
Subject: Re: bug#57346: undeclared identifier 'CLOCK_MONOTONIC'
Date: Sun, 04 Sep 2022 13:52:16 +0200
Lars Ingebrigtsen <larsi <at> gnus.org> writes:

> Hm...  looks like that job is failing, but due to an internal Hydra
> error?

And hydra hasn't been running these tests for a week now, so it sounds
like it's semi-permanently wedged.  So I'm closing this bug report.  If
the problem still exists, please respond to the debbugs address and
we'll reopen.





bug marked as fixed in version 29.1, send any further explanations to 57346 <at> debbugs.gnu.org and Glenn Morris <rgm <at> gnu.org> Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Sun, 04 Sep 2022 11:53:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Mon, 03 Oct 2022 11:24:07 GMT) Full text and rfc822 format available.

This bug report was last modified 1 year and 199 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.