unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: "Mattias Engdegård" <mattiase@acm.org>
To: Paul Eggert <eggert@cs.ucla.edu>
Cc: 37483@debbugs.gnu.org, Alan Third <alan@idiocy.org>
Subject: bug#37483: [PATCH] macOS build error (aligned_alloc)
Date: Tue, 24 Sep 2019 13:08:41 +0200	[thread overview]
Message-ID: <1BCE5F0D-AC05-4301-9D5C-F5AA6B283C33@acm.org> (raw)
In-Reply-To: <c377e07e-176e-b9ba-6607-39612262fc34@cs.ucla.edu>

tags 37483 notabug
close 37483
stop

23 sep. 2019 kl. 22.02 skrev Paul Eggert <eggert@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.)






      reply	other threads:[~2019-09-24 11:08 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-22 17:25 bug#37483: [PATCH] macOS build error (aligned_alloc) Mattias Engdegård
2019-09-22 20:14 ` mituharu
2019-09-23  9:14   ` Mattias Engdegård
2019-09-23 18:37     ` Alan Third
2019-09-23 19:53       ` Mattias Engdegård
2019-09-23 20:02 ` Paul Eggert
2019-09-24 11:08   ` Mattias Engdegård [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1BCE5F0D-AC05-4301-9D5C-F5AA6B283C33@acm.org \
    --to=mattiase@acm.org \
    --cc=37483@debbugs.gnu.org \
    --cc=alan@idiocy.org \
    --cc=eggert@cs.ucla.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).