GNU bug report logs - #79951
31.0.50; [PATCH] Recent commit breaks compilation on pre macOS 11 versions

Previous Next

Package: emacs;

Reported by: David Caldwell <david <at> porkrind.org>

Date: Fri, 5 Dec 2025 19:52:01 UTC

Severity: normal

Tags: patch

Found in version 31.0.50

Done: Eli Zaretskii <eliz <at> gnu.org>

To reply to this bug, email your comments to 79951 AT debbugs.gnu.org.
There is no need to reopen the bug first.

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#79951; Package emacs. (Fri, 05 Dec 2025 19:52:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to David Caldwell <david <at> porkrind.org>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Fri, 05 Dec 2025 19:52:02 GMT) Full text and rfc822 format available.

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

From: David Caldwell <david <at> porkrind.org>
To: bug-gnu-emacs <at> gnu.org
Subject: 31.0.50; [PATCH] Recent commit breaks compilation on pre macOS 11
 versions
Date: Fri, 5 Dec 2025 11:51:31 -0800
[Message part 1 (text/plain, inline)]
--text follows this line--

Hi, I'm getting this compiling the latest master branch on Mac OS 10.14:

  CC       nsterm.o
nsterm.m:9570:22: warning: extra tokens at end of #ifdef directive 
[-Wextra-tokens]
#ifdef NS_IMPL_COCOA && MAC_OS_X_VERSION_MAX_ALLOWED >= 110000
                     ^
                     //
nsterm.m:9571:9: warning: instance method '-setToolbarStyle:' not found 
(return type defaults to 'id') [-Wobjc-method-access]
  [self setToolbarStyle: NSWindowToolbarStyleExpanded];
        ^~~~~~~~~~~~~~~
./nsterm.h:419:12: note: receiver is instance of class declared here
@interface EmacsWindow : NSWindow
           ^
nsterm.m:9571:26: error: use of undeclared identifier 
'NSWindowToolbarStyleExpanded'
  [self setToolbarStyle: NSWindowToolbarStyleExpanded];
                         ^
nsterm.m:9571:9: warning: instance method '-setToolbarStyle:' not found 
(return type defaults to 'id') [-Wobjc-method-access]
  [self setToolbarStyle: NSWindowToolbarStyleExpanded];
        ^~~~~~~~~~~~~~~
./nsterm.h:419:12: note: receiver is instance of class declared here
@interface EmacsWindow : NSWindow
           ^
3 warnings and 1 error generated.
make: *** [Makefile:446: nsterm.o] Error 1

Looks to be caused by cbf9c5873056657865c5a149ece5122a8d03011a. Here is
a patch to fix it:

From 7c2b16e8b3b70a2bf96a36e2f6775ae031148193 Mon Sep 17 00:00:00 2001
From: David Caldwell <david <at> porkrind.org>
Date: Fri, 5 Dec 2025 11:33:52 -0800
Subject: [PATCH] NS: Fix compilation on pre macOS 11 macs.

; * src/nsterm.m ([EmacsWindow initWithEmacsFrame:fullscreen:screen:]):
  Add a compile check around setToolbarStyle since it is not available
  until macOS 11.0.
---
 src/nsterm.m | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/nsterm.m b/src/nsterm.m
index 200b006d6fa..0c01bc88296 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -9567,7 +9567,7 @@ - (instancetype) initWithEmacsFrame: (struct frame 
*) f
         on Mac OS 11+ where the toolbar style is decided by the system
         (which is unpredictable) and the newfangled "compact" toolbar
         may be chosen (which is undesirable).  */
-#ifdef NS_IMPL_COCOA
+#if defined (NS_IMPL_COCOA) && MAC_OS_X_VERSION_MAX_ALLOWED >= 110000
   [self setToolbarStyle: NSWindowToolbarStyleExpanded];
 #endif
     }
--
2.50.1

I'll also attach it since last time I tried to send a patch my mailer
messed it up. You can also grab it from:

git fetch https://github.com/caldwell/emacs.git david-fix-macos-10-14

Thanks,
  David
[0001-NS-Fix-compilation-on-pre-macOS-11-macs.patch (text/plain, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#79951; Package emacs. (Sat, 06 Dec 2025 17:29:01 GMT) Full text and rfc822 format available.

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

From: David Caldwell <david <at> porkrind.org>
To: 79951 <at> debbugs.gnu.org
Subject: Re: 31.0.50; [PATCH] Recent commit breaks compilation on pre macOS 11
 versions
Date: Sat, 6 Dec 2025 09:28:21 -0800
[Message part 1 (text/plain, inline)]
I was thinking about this as I lay in bed last night and I realized it 
also needs a runtime check in case it was compiled on a macOS >= 11.0 
(with the -mmacosx-version-min=... option) and then run on a pre 11.0 macOS.

Attached is a new version of the patch that incorporates the compile 
time and run-time check.

It's also here if that's more convenient:

git fetch https://github.com/caldwell/emacs.git david-fix-macos-10-14_2

Thanks,
David
[0002-NS-Fix-compilation-on-pre-macOS-11-macs.patch (text/plain, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#79951; Package emacs. (Sat, 06 Dec 2025 18:35:02 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: David Caldwell <david <at> porkrind.org>
Cc: 79951 <at> debbugs.gnu.org
Subject: Re: bug#79951: 31.0.50;
 [PATCH] Recent commit breaks compilation on pre macOS 11 versions
Date: Sat, 06 Dec 2025 20:34:24 +0200
> Date: Sat, 6 Dec 2025 09:28:21 -0800
> From: David Caldwell <david <at> porkrind.org>
> 
> I was thinking about this as I lay in bed last night and I realized it 
> also needs a runtime check in case it was compiled on a macOS >= 11.0 
> (with the -mmacosx-version-min=... option) and then run on a pre 11.0 macOS.
> 
> Attached is a new version of the patch that incorporates the compile 
> time and run-time check.

Thanks.  However, given the history of that commit, and how everyone
was reassuring that it's okay to install it, how on Earth can I be
sure that your proposed patch won't break someone else's build?  It
looks like we don't have anyone on board who could reliably test
macOS-specific changes and verify they don't break some configuration.

Any suggestions?  Anyone?

Do we even support pre 11.0 macOS?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#79951; Package emacs. (Sat, 06 Dec 2025 20:34:02 GMT) Full text and rfc822 format available.

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

From: David Caldwell <david <at> porkrind.org>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 79951 <at> debbugs.gnu.org
Subject: Re: bug#79951: 31.0.50; [PATCH] Recent commit breaks compilation on
 pre macOS 11 versions
Date: Sat, 6 Dec 2025 12:32:57 -0800
[Message part 1 (text/plain, inline)]
On 12/6/25 10:34 AM, Eli Zaretskii wrote:
> Thanks.  However, given the history of that commit, and how everyone
> was reassuring that it's okay to install it, how on Earth can I be
> sure that your proposed patch won't break someone else's build?

In this particular case I built Emacs on 10.12 (x86_64) and also 26 
(aarch64). On 10.12 I was content that it compiled at all (which means 
the code was absent). On 26 I tested by commenting out the entire call 
to see what emacs looked like originally (see the attached "NoPatches" 
screenshot) and after the 0002 patch ("WithPatches" screenshot). The 
fact that the screenshots were different and appeared to match what the 
code was supposed to do told me I had the if-statement correct.

I didn't go fine grained in between those 2 macOS versions since it 
seemed like before and after macOS 11 would be good enough to exercise 
the code paths.

Parenthetically, one of the error messages I reported in this bug was:

> nsterm.m:9571:9: warning: instance method '-setToolbarStyle:' not found 
> (return type defaults to 'id')

which tells me this line in the 0002 patch:

>       if ([self respondsToSelector:@selector(setToolbarStyle:)])

will return nil on pre os 11 macs. Since I verified that the patch was 
working on macOS 26 it didn't seem worth testing that the if statement 
correctly returns false on old macs (given that above error message).

> It
> looks like we don't have anyone on board who could reliably test
> macOS-specific changes and verify they don't break some configuration.
> 
> Any suggestions?  Anyone?
I build nightly versions of Emacs on 10.12, 10.14, and 14 vms (you can 
see them here: https://emacsformacos.com/builds). So I notice when they 
break since I get CI emails.

An option might be for my CI scripts to also build some new branch from 
the emacs git, and have the status of those builds get sent to an email 
or a web page or something. That way emacs devs could push to that 
branch before putting the changes on master.

> Do we even support pre 11.0 macOS?

That's a good question. As I said I'm currently building as far back as 
10.12, but I don't really know what the user base is running. From the 
emacsformacos web site logs I can see that in November 2.4% of the page 
views had 10.12 in their user-agent. 10.14 showed 5%. Then again, around 
30% were said either Windows 10 or Windows 7, so I kind of take those 
numbers with a grain of salt.

-David
[Screenshot NoPatches.png (image/png, attachment)]
[Screenshot WithPatches.png (image/png, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#79951; Package emacs. (Sun, 07 Dec 2025 10:22:01 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: David Caldwell <david <at> porkrind.org>
Cc: 79951 <at> debbugs.gnu.org
Subject: Re: bug#79951: 31.0.50; [PATCH] Recent commit breaks compilation on
 pre macOS 11 versions
Date: Sun, 07 Dec 2025 12:21:38 +0200
> Date: Sat, 6 Dec 2025 12:32:57 -0800
> Cc: 79951 <at> debbugs.gnu.org
> From: David Caldwell <david <at> porkrind.org>
> 
> On 12/6/25 10:34 AM, Eli Zaretskii wrote:
> > Thanks.  However, given the history of that commit, and how everyone
> > was reassuring that it's okay to install it, how on Earth can I be
> > sure that your proposed patch won't break someone else's build?
> 
> In this particular case I built Emacs on 10.12 (x86_64) and also 26 
> (aarch64). On 10.12 I was content that it compiled at all (which means 
> the code was absent). On 26 I tested by commenting out the entire call 
> to see what emacs looked like originally (see the attached "NoPatches" 
> screenshot) and after the 0002 patch ("WithPatches" screenshot). The 
> fact that the screenshots were different and appeared to match what the 
> code was supposed to do told me I had the if-statement correct.
> 
> I didn't go fine grained in between those 2 macOS versions since it 
> seemed like before and after macOS 11 would be good enough to exercise 
> the code paths.
> 
> Parenthetically, one of the error messages I reported in this bug was:
> 
> > nsterm.m:9571:9: warning: instance method '-setToolbarStyle:' not found 
> > (return type defaults to 'id')
> 
> which tells me this line in the 0002 patch:
> 
> >       if ([self respondsToSelector:@selector(setToolbarStyle:)])
> 
> will return nil on pre os 11 macs. Since I verified that the patch was 
> working on macOS 26 it didn't seem worth testing that the if statement 
> correctly returns false on old macs (given that above error message).
> 
> > It
> > looks like we don't have anyone on board who could reliably test
> > macOS-specific changes and verify they don't break some configuration.
> > 
> > Any suggestions?  Anyone?
> I build nightly versions of Emacs on 10.12, 10.14, and 14 vms (you can 
> see them here: https://emacsformacos.com/builds). So I notice when they 
> break since I get CI emails.
> 
> An option might be for my CI scripts to also build some new branch from 
> the emacs git, and have the status of those builds get sent to an email 
> or a web page or something. That way emacs devs could push to that 
> branch before putting the changes on master.

Someone just reported in

  https://lists.gnu.org/archive/html/emacs-devel/2025-12/msg00148.html

that the current code fails to compile on macOS HS 13.6 as well.  Does
it mean your proposed check of version 11 or later is insufficient?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#79951; Package emacs. (Sun, 07 Dec 2025 17:14:02 GMT) Full text and rfc822 format available.

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

From: Angelo Graziosi <angelo.g0 <at> libero.it>
To: 79951 <at> debbugs.gnu.org
Subject: Re: Recent commit breaks compilation on, pre macOS 11 versions
Date: Sun, 7 Dec 2025 18:13:34 +0100
>> Do we even support pre 11.0 macOS?
> 
> That's a good question.

If I remember correctly, Emacs still support MSDOS and WIN95. Why do you 
want stop support for macOS < 11?

It would be like adhering to Apple's policy.






Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#79951; Package emacs. (Sun, 07 Dec 2025 17:34:02 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: Angelo Graziosi <angelo.g0 <at> libero.it>
Cc: 79951 <at> debbugs.gnu.org
Subject: Re: bug#79951: Recent commit breaks compilation on,
 pre macOS 11 versions
Date: Sun, 07 Dec 2025 19:33:10 +0200
> Date: Sun, 7 Dec 2025 18:13:34 +0100
> From: Angelo Graziosi <angelo.g0 <at> libero.it>
> 
> >> Do we even support pre 11.0 macOS?
> > 
> > That's a good question.
> 
> If I remember correctly, Emacs still support MSDOS and WIN95. Why do you 
> want stop support for macOS < 11?
> 
> It would be like adhering to Apple's policy.

Who said I want to stop it?  I asked whether we are still supporting
it, that's all.  There's no need to read into it something that isn't
there.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#79951; Package emacs. (Sun, 07 Dec 2025 17:43:02 GMT) Full text and rfc822 format available.

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

From: Angelo Graziosi <angelo.g0 <at> libero.it>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 79951 <at> debbugs.gnu.org
Subject: Re: bug#79951: Recent commit breaks compilation on, pre macOS 11
 versions
Date: Sun, 7 Dec 2025 18:42:15 +0100
Il 07/12/2025 18:33, Eli Zaretskii ha scritto:
>> Date: Sun, 7 Dec 2025 18:13:34 +0100
>> From: Angelo Graziosi <angelo.g0 <at> libero.it>
>>
>>>> Do we even support pre 11.0 macOS?
>>>
>>> That's a good question.
>>
>> If I remember correctly, Emacs still support MSDOS and WIN95. Why do you
>> want stop support for macOS < 11?
>>
>> It would be like adhering to Apple's policy.
> 
> Who said I want to stop it?  I asked whether we are still supporting
> it, that's all.  There's no need to read into it something that isn't
> there.
 Ok, maybe I misinterpreted.

BTW, the path propose in this bug report has been applied to master? If 
so it does not fix the builds for macOS < 11....

If not, which is exactly the file to test?






Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#79951; Package emacs. (Sun, 07 Dec 2025 17:56:01 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: Angelo Graziosi <angelo.g0 <at> libero.it>
Cc: 79951 <at> debbugs.gnu.org
Subject: Re: bug#79951: Recent commit breaks compilation on, pre macOS 11
 versions
Date: Sun, 07 Dec 2025 19:55:44 +0200
> Date: Sun, 7 Dec 2025 18:42:15 +0100
> Cc: 79951 <at> debbugs.gnu.org
> From: Angelo Graziosi <angelo.g0 <at> libero.it>
> 
> BTW, the path propose in this bug report has been applied to master?

No, not yet.

And AFAIU, it would not necessarily help you, because your OS version
is above 11.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#79951; Package emacs. (Sun, 07 Dec 2025 18:06:03 GMT) Full text and rfc822 format available.

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

From: Angelo Graziosi <angelo.g0 <at> libero.it>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 79951 <at> debbugs.gnu.org
Subject: Re: bug#79951: Recent commit breaks compilation on, pre macOS 11
 versions
Date: Sun, 7 Dec 2025 19:05:00 +0100
Il 07/12/2025 18:55, Eli Zaretskii ha scritto:
>> Date: Sun, 7 Dec 2025 18:42:15 +0100
>> Cc: 79951 <at> debbugs.gnu.org
>> From: Angelo Graziosi <angelo.g0 <at> libero.it>
>>
>> BTW, the path propose in this bug report has been applied to master?
> 
> No, not yet.
> 
> And AFAIU, it would not necessarily help you, because your OS version
> is above 11.

 Maybe there is some confusion here. The OP should clarify.

For macOS 11 I mean Big Sur, which is the third after the mine, HS 13.6 
aka High Sierra 10.13.6.

The "11" before mine means El Capitan, 10.11.

See https://en.wikipedia.org/wiki/MacOS_version_history#Overview.





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#79951; Package emacs. (Sun, 07 Dec 2025 18:23:01 GMT) Full text and rfc822 format available.

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

From: David Caldwell <david <at> porkrind.org>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 79951 <at> debbugs.gnu.org
Subject: Re: bug#79951: 31.0.50; [PATCH] Recent commit breaks compilation on
 pre macOS 11 versions
Date: Sun, 7 Dec 2025 10:22:37 -0800
On 12/7/25 2:21 AM, Eli Zaretskii wrote:
> Someone just reported in
> 
>    https://lists.gnu.org/archive/html/emacs-devel/2025-12/msg00148.html
> 
> that the current code fails to compile on macOS HS 13.6 as well.  Does
> it mean your proposed check of version 11 or later is insufficient?

That's odd. Apple's documentation [1] claims it's available in macOS 
11.0 and the header file on my macOS 13 VM agrees:

> /// Specifies how the titlebar area of the window should appear when the window displays an NSToolbar
> @property NSWindowToolbarStyle toolbarStyle API_AVAILABLE(macos(11.0));
Is it possible that the reporter is confused about the macOS version? 
They say "macOS HS 13.6" but I'm not familiar with "HS". Searching for 
that leads to people abbreviating "High Sierra" to "HS". "High Sierra" 
was macOS 10.13 (not 13) and the latest release of it was 10.13.6 [2] 
which matches the "13.6". Actual MacOS 13's latest release was 13.7.8 [3].

-David

[1] 
https://developer.apple.com/documentation/appkit/nswindow/toolbarstyle-swift.property?language=objc
[2] https://en.wikipedia.org/wiki/MacOS_High_Sierra
[3] https://en.wikipedia.org/wiki/MacOS_Ventura




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#79951; Package emacs. (Sun, 07 Dec 2025 19:09:01 GMT) Full text and rfc822 format available.

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

From: Angelo Graziosi <angelo.g0 <at> libero.it>
To: 79951 <at> debbugs.gnu.org
Subject: Re: bug#79951: Recent commit breaks compilation on, pre macOS 11
 versions
Date: Sun, 7 Dec 2025 20:07:57 +0100
> Is it possible that the reporter is confused about the macOS version?

Usually, "HS 13.6 macOS" should be enough to mean High Sierra 10.13.6 
macOS. It is an abbreviated form used also in other mailing lists which 
macOS people understand.

Any way, on macOS 10.13.6 (High Sierra), master fails to build with:


[...]
 CC       nsselect.o
  CC       nsimage.o
nsterm.m:9571:9: warning: instance method '-setToolbarStyle:' not found 
(return type defaults to 'id') [-Wobjc-method-access]
  [self setToolbarStyle: NSWindowToolbarStyleExpanded];
        ^~~~~~~~~~~~~~~
./nsterm.h:419:12: note: receiver is instance of class declared here
@interface EmacsWindow : NSWindow
           ^
nsterm.m:9571:26: error: use of undeclared identifier 
'NSWindowToolbarStyleExpanded'
  [self setToolbarStyle: NSWindowToolbarStyleExpanded];
                         ^
1 warning and 1 error generated.
make[2]: *** [nsterm.o] Error 1
make[2]: *** Waiting for unfinished jobs....
make[1]: *** [src] Error 2
make[1]: *** Waiting for unfinished jobs....
***
*** "make all" failed with exit status 2.
***
*** You could try to:
*** - run "make bootstrap", which might fix the problem
*** - run "make V=1", which displays the full commands invoked by make,
***   to further investigate the problem
***
make[1]: *** [advice-on-failure] Error 2
make: *** [all] Error 2
Error: Failure running MAKE




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#79951; Package emacs. (Sun, 07 Dec 2025 20:31:02 GMT) Full text and rfc822 format available.

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

From: Angelo Graziosi <angelo.g0 <at> libero.it>
To: 79951 <at> debbugs.gnu.org
Cc: Eli Zaretskii <eliz <at> gnu.org>
Subject: Re: bug#79951: Recent commit breaks compilation on, pre macOS 11
 versions
Date: Sun, 7 Dec 2025 21:29:55 +0100
Ok, applying patch 0002* allow for the build to be completed on macOS 
High Sierra 10.13.6, and Emacs seems to work.





Reply sent to Eli Zaretskii <eliz <at> gnu.org>:
You have taken responsibility. (Mon, 08 Dec 2025 14:26:01 GMT) Full text and rfc822 format available.

Notification sent to David Caldwell <david <at> porkrind.org>:
bug acknowledged by developer. (Mon, 08 Dec 2025 14:26:02 GMT) Full text and rfc822 format available.

Message #46 received at 79951-done <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Angelo Graziosi <angelo.g0 <at> libero.it>
Cc: 79951-done <at> debbugs.gnu.org
Subject: Re: bug#79951: 31.0.50;
 Recent commit breaks compilation on, pre macOS 11 versions
Date: Mon, 08 Dec 2025 16:25:37 +0200
> Date: Sun, 7 Dec 2025 21:29:55 +0100
> From: Angelo Graziosi <angelo.g0 <at> libero.it>
> Cc: Eli Zaretskii <eliz <at> gnu.org>
> 
> Ok, applying patch 0002* allow for the build to be completed on macOS 
> High Sierra 10.13.6, and Emacs seems to work.

Thanks, I've now installed that change on the master branch, and I'm
closing this bug.




This bug report was last modified 2 days ago.

Previous Next


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