GNU bug report logs -
#37483
[PATCH] macOS build error (aligned_alloc)
Previous Next
Reported by: Mattias Engdegård <mattiase <at> acm.org>
Date: Sun, 22 Sep 2019 17:26:02 UTC
Severity: normal
Tags: notabug, patch
Done: Mattias Engdegård <mattiase <at> acm.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 37483 in the body.
You can then email your comments to 37483 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#37483
; Package
emacs
.
(Sun, 22 Sep 2019 17:26:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Mattias Engdegård <mattiase <at> acm.org>
:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org
.
(Sun, 22 Sep 2019 17:26:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
After upgrading the macOS system dev tools, building Emacs fails because aligned_alloc is present in the system headers and can be linked with but isn't actually in the dynamic library (macOS 10.14, Xcode 11).
This means that the configure check for that function needs to be strengthened a bit. Proposed patch attached; please say if it breaks on a different platform. I'm not the greatest fan of autoconf, and am likely to have made mistakes.
[0001-More-thorough-check-for-aligned_alloc-on-macOS.patch (application/octet-stream, attachment)]
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#37483
; Package
emacs
.
(Sun, 22 Sep 2019 20:15:01 GMT)
Full text and
rfc822 format available.
Message #8 received at 37483 <at> debbugs.gnu.org (full text, mbox):
> After upgrading the macOS system dev tools, building Emacs fails because
> aligned_alloc is present in the system headers and can be linked with but
> isn't actually in the dynamic library (macOS 10.14, Xcode 11).
You would need to install the Command Line Developer Tools with
"xcode-select --install". In general this is necessary when the
macOS version is older than the newest one Xcode supports. In
the case of Xcode 11, it is macOS 10.15.
Actually you don't need Xcode for building Emacs, but the Command
Line Developer Tools would be sufficient.
YAMAMOTO Mitsuharu
mituharu <at> math.s.chiba-u.ac.jp
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#37483
; Package
emacs
.
(Mon, 23 Sep 2019 09:16:02 GMT)
Full text and
rfc822 format available.
Message #11 received at 37483 <at> debbugs.gnu.org (full text, mbox):
22 sep. 2019 kl. 22.14 skrev mituharu <at> math.s.chiba-u.ac.jp:
>
> You would need to install the Command Line Developer Tools with
> "xcode-select --install". In general this is necessary when the
> macOS version is older than the newest one Xcode supports. In
> the case of Xcode 11, it is macOS 10.15.
>
> Actually you don't need Xcode for building Emacs, but the Command
> Line Developer Tools would be sufficient.
Thank you, this is useful to know.
Even so, doesn't it make sense to make the configure script work with tools that support newer OS versions? After all, we are not talking about cross-tools or tools that can only generate code for newer versions. If I want to use the most recent toolchain for my OS, these (Xcode 11) tools are the ones to use.
I first tried some other workarounds: configuring with -Werror=unguarded-availability-new in CFLAGS will prevent HAVE_DECL_ALIGNED_ALLOC from being defined, but HAVE_ALIGNED_ALLOC is not affected because its config check doesn't include the standard header (by design).
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#37483
; Package
emacs
.
(Mon, 23 Sep 2019 18:38:01 GMT)
Full text and
rfc822 format available.
Message #14 received at 37483 <at> debbugs.gnu.org (full text, mbox):
On Mon, Sep 23, 2019 at 11:14:55AM +0200, Mattias Engdegård wrote:
> 22 sep. 2019 kl. 22.14 skrev mituharu <at> math.s.chiba-u.ac.jp:
> >
> > You would need to install the Command Line Developer Tools with
> > "xcode-select --install". In general this is necessary when the
> > macOS version is older than the newest one Xcode supports. In
> > the case of Xcode 11, it is macOS 10.15.
> >
> > Actually you don't need Xcode for building Emacs, but the Command
> > Line Developer Tools would be sufficient.
>
> Thank you, this is useful to know.
>
> Even so, doesn't it make sense to make the configure script work
> with tools that support newer OS versions? After all, we are not
> talking about cross-tools or tools that can only generate code for
> newer versions. If I want to use the most recent toolchain for my
> OS, these (Xcode 11) tools are the ones to use.
The command line tools are closely related to XCode, they’re not old
or obsolete.
--
Alan Third
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#37483
; Package
emacs
.
(Mon, 23 Sep 2019 19:54:02 GMT)
Full text and
rfc822 format available.
Message #17 received at 37483 <at> debbugs.gnu.org (full text, mbox):
23 sep. 2019 kl. 20.37 skrev Alan Third <alan <at> idiocy.org>:
>
> The command line tools are closely related to XCode, they’re not old
> or obsolete.
I didn't mean to imply they were. Yet a newer compiler version is likely to produce better code than an older. It should be possible to build Emacs with the latest set of command line tools, shouldn't it?
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#37483
; Package
emacs
.
(Mon, 23 Sep 2019 20:03:01 GMT)
Full text and
rfc822 format available.
Message #20 received at 37483 <at> debbugs.gnu.org (full text, mbox):
I'm not seeing why this patch is needed. If you build with tools that
expect a macOS version N library, Emacs can't be expected to run on a
system that has older libraries.
Put it another way: if we install this patch, for consistency shouldn't
we install a similar patch for every other function that 'configure'
checks for, and have 'configure' do a run-time test instead of just a
link-time test for the function?
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#37483
; Package
emacs
.
(Tue, 24 Sep 2019 11:09:02 GMT)
Full text and
rfc822 format available.
Message #23 received at 37483 <at> debbugs.gnu.org (full text, mbox):
tags 37483 notabug
close 37483
stop
23 sep. 2019 kl. 22.02 skrev Paul Eggert <eggert <at> cs.ucla.edu>:
>
> I'm not seeing why this patch is needed. If you build with tools that expect a macOS version N library, Emacs can't be expected to run on a system that has older libraries.
I don't think it's accurate to say that the tools expect a macOS 10.15 library; they are perfectly able to build code for 10.14, and that is the default when running on such a system. Since aligned_alloc will be available in 10.15, the header file contains an annotated prototype of that function, so that the compiler can warn on attempts to use it when building for 10.14:
conftest.c:151:9: warning: 'aligned_alloc' is only available on macOS 10.15 or newer [-Wunguarded-availability-new]
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/malloc/_malloc.h:50:10: note: 'aligned_alloc' has been marked as being introduced in macOS 10.15 here, but the deployment target is macOS 10.14.0
AC_CHECK_FUNCS supplies a made-up prototype for aligned_alloc instead of including <stdlib.h>, and then compilation and linking will proceed without diagnostics. The run-time linker will complain and abort.
However, I followed Alan's advice and used 'xcode-select --install' to install SDKs specifically for 10.14, and now clang uses a different header file tree that does not include aligned_alloc at all. I'm happy, because the compiler and associated tools are still of version 11. I must admit I'm not entirely sure how about the exact mechanics behind it all; 'xcode-select -p' still returns the same path, but the compiler now uses headers from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk.
At any rate, it's good enough to withdraw the patch for now. Thank you for your patience.
> Put it another way: if we install this patch, for consistency shouldn't we install a similar patch for every other function that 'configure' checks for, and have 'configure' do a run-time test instead of just a link-time test for the function?
That's a legitimate question. AC_CHECK_FUNCS & friends make Unix-centric assumptions that aren't correct in all build environments, but not running a test binary is slightly faster and makes cross-builds easier.
(Should you ever consider replacing autoconf for Emacs with something faster, you will find in me a fervent supporter.)
Added tag(s) notabug.
Request was from
Mattias Engdegård <mattiase <at> acm.org>
to
control <at> debbugs.gnu.org
.
(Tue, 24 Sep 2019 11:09:03 GMT)
Full text and
rfc822 format available.
bug closed, send any further explanations to
37483 <at> debbugs.gnu.org and Mattias Engdegård <mattiase <at> acm.org>
Request was from
Mattias Engdegård <mattiase <at> acm.org>
to
control <at> debbugs.gnu.org
.
(Tue, 24 Sep 2019 11:09:03 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
.
(Tue, 22 Oct 2019 11:24:11 GMT)
Full text and
rfc822 format available.
This bug report was last modified 5 years and 238 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.