GNU bug report logs - #26398
26.0.50; GNU LIB build fails on macOS 10.12.4

Previous Next

Package: emacs;

Reported by: Harald Maier <Harald <at> Maierh.de>

Date: Sat, 8 Apr 2017 07:15:02 UTC

Severity: normal

Found in version 26.0.50

Done: Paul Eggert <eggert <at> cs.ucla.edu>

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 26398 in the body.
You can then email your comments to 26398 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#26398; Package emacs. (Sat, 08 Apr 2017 07:15:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Harald Maier <Harald <at> Maierh.de>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Sat, 08 Apr 2017 07:15:02 GMT) Full text and rfc822 format available.

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

From: Harald Maier <Harald <at> Maierh.de>
To: bug-gnu-emacs <at> gnu.org
Subject: 26.0.50; GNU LIB build fails on macOS 10.12.4
Date: Sat, 8 Apr 2017 09:14:25 +0200
The latest git checkout fails on mac OS 10.12.4.

  CC       fstatat.o
In file included from fstatat.c:45:
In file included from ./fcntl.h:67:
In file included from ./unistd.h:135:
In file included from ./getopt_pfx_core.h:52:
./getopt_core.h:91:79: error: expected ';' after top level declarator
extern int getopt (int ___argc, char *const *___argv, const char *__shortopts)
                                                                              ^
./getopt_core.h:92:28: error: expected identifier or '('
       __THROW __nonnull ((2, 3));
                           ^
./getopt_core.h:92:28: error: expected ')'
./getopt_core.h:92:27: note: to match this '('
       __THROW __nonnull ((2, 3));
                          ^
3 errors generated.
make[2]: *** [fstatat.o] Error 1
make[1]: *** [lib] Error 2

$ gcc -v
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 8.0.0 (clang-800.0.38)
Target: x86_64-apple-darwin16.5.0


In GNU Emacs 26.0.50 (build 2, x86_64-apple-darwin16.4.0, X toolkit, Xaw3d scroll bars)
 of 2017-03-26 built on ate.maierh
Repository revision: 082e2cb3f40b717e4c00d31532927c9693b7cb9b
Windowing system distributor 'The X.Org Foundation', version 11.0.11804000
Recent messages:
Omitting...
Omitted 54 lines.
Mark saved where search started
Updating buffer list...
Formats have changed, recompiling...done
Updating buffer list...done
Commands: m, u, t, RET, g, k, S, D, Q; q to quit; h for help
Mark set
previous-line: Beginning of buffer
Mark saved where search started
Quit [2 times]
Configured using:
 'configure --without-ns --with-x-toolkit=lucid
 --x-includes=/opt/X11/include --x-libraries=/opt/X11/lib --without-pop
 --without-gsettings --with-jpeg=no --with-png=no --with-gif=no
 --with-tiff=no'





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#26398; Package emacs. (Sat, 08 Apr 2017 08:25:02 GMT) Full text and rfc822 format available.

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

From: Paul Eggert <eggert <at> cs.ucla.edu>
To: Harald Maier <Harald <at> Maierh.de>
Cc: Gnulib bugs <bug-gnulib <at> gnu.org>, Zack Weinberg <zackw <at> panix.com>,
 26398 <at> debbugs.gnu.org
Subject: Re: GNU LIB build fails on macOS 10.12.4
Date: Sat, 8 Apr 2017 01:24:46 -0700
[Following up on http://bugs.gnu.org/26398 and CC'ing bug-gnulib and Zack Weinberg.]

> In file included from ./unistd.h:135:
> In file included from ./getopt_pfx_core.h:52:
> ./getopt_core.h:91:79: error: expected ';' after top level declarator
> extern int getopt (int ___argc, char *const *___argv, const char *__shortopts)

Can you please send the preprocessor output for the failed compilation?
That is, try running "make V=1". If the failed command looks like this:

   clang -c -Dthis -Dthat -Dtheother fstatat.c

then run this command:

   clang -E -Dthis -Dthat -Dtheother fstatat.c >fstatat.i

and send a copy of fstatat.i as an attachment.

Also, can you find out which .h file defined __THROW and __nonnull in your 
environment? I have the sneaking suspicion that it's some .h file other than 
getopt_cdefs.h.

Thanks.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#26398; Package emacs. (Sat, 08 Apr 2017 08:45:02 GMT) Full text and rfc822 format available.

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

From: Harald Maier <Harald <at> Maierh.de>
To: Paul Eggert <eggert <at> cs.ucla.edu>
Cc: Gnulib bugs <bug-gnulib <at> gnu.org>, Zack Weinberg <zackw <at> panix.com>,
 26398 <at> debbugs.gnu.org
Subject: Re: GNU LIB build fails on macOS 10.12.4
Date: Sat, 8 Apr 2017 10:43:44 +0200
[Message part 1 (text/plain, inline)]
They __THROW and __nonnull are defined in „getopt_cdefs.h“.

The gcc command is

gcc -c    -MMD -MF deps/fstatat.d -MP    -g3 -O2 -I. -I../src -I. -I./../src  fstatat.c

The output from -E




> Am 08.04.2017 um 10:24 schrieb Paul Eggert <eggert <at> cs.ucla.edu>:
> 
> [Following up on http://bugs.gnu.org/26398 and CC'ing bug-gnulib and Zack Weinberg.]
> 
>> In file included from ./unistd.h:135:
>> In file included from ./getopt_pfx_core.h:52:
>> ./getopt_core.h:91:79: error: expected ';' after top level declarator
>> extern int getopt (int ___argc, char *const *___argv, const char *__shortopts)
> 
> Can you please send the preprocessor output for the failed compilation?
> That is, try running "make V=1". If the failed command looks like this:
> 
>   clang -c -Dthis -Dthat -Dtheother fstatat.c
> 
> then run this command:
> 
>   clang -E -Dthis -Dthat -Dtheother fstatat.c >fstatat.i
> 
> and send a copy of fstatat.i as an attachment.
> 
> Also, can you find out which .h file defined __THROW and __nonnull in your environment? I have the sneaking suspicion that it's some .h file other than getopt_cdefs.h.
> 
> Thanks.

[Message part 2 (text/html, inline)]
[fstatat.i (application/octet-stream, attachment)]
[Message part 4 (text/html, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#26398; Package emacs. (Sat, 08 Apr 2017 09:39:02 GMT) Full text and rfc822 format available.

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

From: Paul Eggert <eggert <at> cs.ucla.edu>
To: Harald Maier <Harald <at> Maierh.de>
Cc: Gnulib bugs <bug-gnulib <at> gnu.org>, Zack Weinberg <zackw <at> panix.com>,
 26398 <at> debbugs.gnu.org
Subject: Re: GNU LIB build fails on macOS 10.12.4
Date: Sat, 8 Apr 2017 02:38:21 -0700
[Message part 1 (text/plain, inline)]
Harald Maier wrote:
> They __THROW and __nonnull are defined in „getopt_cdefs.h“.

Thanks, I think I see the problem. Either the compiler or some macOS header does 
"#define __nonnull _Nonnull", and this collides with glibc's use of __nonnull. 
Presumably Clang uses _Nonnull as a type qualifier and some Clang headers use 
__nonnull as an alias for _Nonnull.

Please try the attached patch against Emacs master. If it works I plan to 
install it into Emacs and propagate it into Gnulib.
[emacs.diff (text/x-diff, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#26398; Package emacs. (Sat, 08 Apr 2017 10:32:01 GMT) Full text and rfc822 format available.

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

From: Harald Maier <Harald <at> Maierh.de>
To: Paul Eggert <eggert <at> cs.ucla.edu>
Cc: Gnulib bugs <bug-gnulib <at> gnu.org>, Zack Weinberg <zackw <at> panix.com>,
 26398 <at> debbugs.gnu.org
Subject: Re: GNU LIB build fails on macOS 10.12.4
Date: Sat, 8 Apr 2017 12:31:11 +0200
Yes, this fixes the problem and compilation works without errors.

Harald

> Am 08.04.2017 um 11:38 schrieb Paul Eggert <eggert <at> cs.ucla.edu>:
> 
> Harald Maier wrote:
>> They __THROW and __nonnull are defined in „getopt_cdefs.h“.
> 
> Thanks, I think I see the problem. Either the compiler or some macOS header does "#define __nonnull _Nonnull", and this collides with glibc's use of __nonnull. Presumably Clang uses _Nonnull as a type qualifier and some Clang headers use __nonnull as an alias for _Nonnull.
> 
> Please try the attached patch against Emacs master. If it works I plan to install it into Emacs and propagate it into Gnulib.
> <emacs.diff>





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#26398; Package emacs. (Sat, 08 Apr 2017 15:25:01 GMT) Full text and rfc822 format available.

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

From: Zack Weinberg <zackw <at> panix.com>
To: Paul Eggert <eggert <at> cs.ucla.edu>
Cc: GNU C Library <libc-alpha <at> sourceware.org>, Gnulib bugs <bug-gnulib <at> gnu.org>,
 26398 <at> debbugs.gnu.org
Subject: Re: GNU LIB build fails on macOS 10.12.4
Date: Sat, 8 Apr 2017 11:24:54 -0400
> Please try the attached patch against Emacs master.
> If it works I plan to install it into Emacs and propagate
> it into Gnulib.

This patch is incomplete.  If gnulib cannot use __nonnull in
getopt_{core,ext}.h, then there is no point trying to define it in
getopt_cdefs.h.  And you're going to need to put snippet/arg-nonnull
back in the module file for this to work at all, aren't you?

From glibc's point of view, I think it would be better if
getopt_core.h and getopt_ext.h simply assumed _GL_ARG_NONNULL to be
available; we can add it to either our getopt.h wrapper or to
sys/cdefs.h - I don't want to make that call unilaterally.  (Do you
know of a complete list of _GL_ macros that may appear in _public_
header files?)

zw




Reply sent to Paul Eggert <eggert <at> cs.ucla.edu>:
You have taken responsibility. (Sun, 09 Apr 2017 08:04:02 GMT) Full text and rfc822 format available.

Notification sent to Harald Maier <Harald <at> Maierh.de>:
bug acknowledged by developer. (Sun, 09 Apr 2017 08:04:02 GMT) Full text and rfc822 format available.

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

From: Paul Eggert <eggert <at> cs.ucla.edu>
To: Zack Weinberg <zackw <at> panix.com>
Cc: 26398-done <at> debbugs.gnu.org, Harald Maier <Harald <at> Maierh.de>,
 GNU C Library <libc-alpha <at> sourceware.org>, Gnulib bugs <bug-gnulib <at> gnu.org>
Subject: Re: GNU LIB build fails on macOS 10.12.4
Date: Sun, 9 Apr 2017 01:03:30 -0700
[Message part 1 (text/plain, inline)]
Zack Weinberg wrote:

> This patch is incomplete.

Yes, it was the Emacs patch, not the Gnulib patch. I'll attach a complete Gnulib 
patch.

> If gnulib cannot use __nonnull in
> getopt_{core,ext}.h, then there is no point trying to define it in
> getopt_cdefs.h.

Good point, I've removed that in the attached.

> And you're going to need to put snippet/arg-nonnull
> back in the module file for this to work at all, aren't you?

Yes, that's in the attached patch.

> From glibc's point of view, I think it would be better if
> getopt_core.h and getopt_ext.h simply assumed _GL_ARG_NONNULL to be
> available; we can add it to either our getopt.h wrapper or to
> sys/cdefs.h - I don't want to make that call unilaterally.

By "our getopt.h wrapper" do you mean a file in glibc but not in Gnulib? If so, 
this doesn't affect Gnulib. I suspect _GL_ARG_NONNULL logically belongs in 
sys/cdefs.h but it should also work to put it into the getopt.h wrapper.

> (Do you
> know of a complete list of _GL_ macros that may appear in _public_
> header files?)

I don't know of an explicit list. You can look at all the .h files listed in the 
Files: sections of gnulib/modules/snippet/*. For example, the 
snippet/arg-nonnull module defines _GL_ARG_NONNULL, the snippet/_Noreturn module 
defines _Noreturn, and so forth. There are quite a few such macros, and (as 
_Noreturn indicates) they don't all begin with _GL_.

I installed the attached into Gnulib and merged it into Emacs, and am boldly 
marking the Emacs bug (Bug#26398) as done. I think there still needs to be some 
changes done on the proposed change to glibc, to define _GL_ARG_NONNULL 
somewhere for glibc.
[0001-getopt-port-recent-getopt-changes-to-macOS.patch (text/x-diff, attachment)]

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

This bug report was last modified 6 years and 348 days ago.

Previous Next


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