bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#37483: [PATCH] macOS build error (aligned_alloc)


From: Mattias Engdegård
Subject: bug#37483: [PATCH] macOS build error (aligned_alloc)
Date: Tue, 24 Sep 2019 13:08:41 +0200

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 via email to

[Prev in Thread] Current Thread [Next in Thread]