Subject: Re: 27.0.50; linking error in git head on macos: _aligned_alloc

From: Sam Steingold <[email-masked]>
Date: Tue, 11 Jun 2019 16:14:25 -0400

$ gcc e.c
e.c:6:13: warning: 'aligned_alloc' is only available on macOS 10.15 or newer
      [-Wunguarded-availability-new]
  char *p = aligned_alloc (8, 1);
            ^~~~~~~~~~~~~
/Library/Developer/CommandLineTools/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
void    *aligned_alloc(size_t __alignment, size_t __size)
__result_use_check __alloc_size(...
         ^
e.c:6:13: note: enclose 'aligned_alloc' in a __builtin_available check
to silence this warning
  char *p = aligned_alloc (8, 1);
            ^~~~~~~~~~~~~
e.c:7:13: warning: 'aligned_alloc' is only available on macOS 10.15 or newer
      [-Wunguarded-availability-new]
  char *q = aligned_alloc (8, 2);
            ^~~~~~~~~~~~~
/Library/Developer/CommandLineTools/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
void    *aligned_alloc(size_t __alignment, size_t __size)
__result_use_check __alloc_size(...
         ^
e.c:7:13: note: enclose 'aligned_alloc' in a __builtin_available check
to silence this warning
  char *q = aligned_alloc (8, 2);
            ^~~~~~~~~~~~~
2 warnings generated.

my system is 10.14.5

On Tue, 11 Jun 2019 at 16:08, Paul Eggert <[email-masked]> wrote:
>
> 'configure' says you have aligned_alloc, because it successfully built
> an executable that calls aligned_alloc. However, the dynamic linker
> fails, in that when temacs runs and calls aligned_alloc, its dynamic
> linker fails to find an implementation. Please figure out why that is.
> For example, you can compile and run this program with the same flags
> you use to compile Emacs:
>
>    #include <stdlib.h>
>
>    int
>    main (int argc, char **argv)
>    {
>      char *p = aligned_alloc (8, 1);
>      char *q = aligned_alloc (8, 2);
>      return p && q && p == q;
>    }
>
> If it compiles and runs successfully, you can then investigate why it
> works but temacs doesn't. Otherwise, you can investigate why it doesn't
> work.
>

-- 
Sam Steingold <http://sds.podval.org> <http://www.childpsy.net>
<http://steingoldpsychology.com>