Re: Fix for configure error in 9.5/9.6 on macOS 11.0 Big Sur

From: Jesse Zhang <sbjesse(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com>, Thomas Gilligan <thomas(dot)gilligan(at)icloud(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Fix for configure error in 9.5/9.6 on macOS 11.0 Big Sur
Date: 2020-09-03 15:52:51
Message-ID: CAGf+fX7CMmNxY33VDuZb3SL94LKrqZ_v2cvdNCygq6WLDyOAYg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi Tom and Peter,

On Wed, Sep 2, 2020 at 10:40 PM Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>
> Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com> writes:
> > On 2020-09-02 22:43, Jesse Zhang wrote:
> >> | conftest.c:184:3: error: implicitly declaring library function
> >> 'exit' with type 'void (int) __attribute__((noreturn))'
> >> [-Werror,-Wimplicit-function-declaration]
>
> > Where did the -Werror come from?
>
> Peter wasn't entirely explicit here, but note the advice at the end of
>
> https://www.postgresql.org/docs/devel/install-procedure.html
>
> that you cannot include -Werror in any CFLAGS you tell configure
> to use. It'd be nice if autoconf was more robust about that,
> but it is not our bug to fix.
>
> regards, tom lane

If you noticed the full invocation of clang, you'd notice that Werror is
nowhere on the command line, even though the error message suggests
otherwise. I think this is a behavior from the new AppleClang, here's
the minimal repro:

int main() { exit(0); }

And boom!

$ clang -c c.c
c.c:1:14: error: implicitly declaring library function 'exit' with
type 'void (int) __attribute__((noreturn))'
[-Werror,-Wimplicit-function-declaration]
int main() { exit(0); }
^
c.c:1:14: note: include the header <stdlib.h> or explicitly provide a
declaration for 'exit'
1 error generated.

My environment:

$ uname -rsv
Darwin 20.0.0 Darwin Kernel Version 20.0.0: Fri Aug 14 00:25:13 PDT
2020; root:xnu-7195.40.44.151.1~4/RELEASE_X86_64
$ clang --version
Apple clang version 12.0.0 (clang-1200.0.31.1)
Target: x86_64-apple-darwin20.0.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin

I've heard reports of the same under the latest Xcode 12 on macOS
Catalina, but I don't have my hands on such an env.

Cheers,
Jesse

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Dave Page 2020-09-03 15:54:37 Re: Kerberos support broken on MSVC builds for Windows x64?
Previous Message Mark Dilger 2020-09-03 15:49:56 Re: factorial function/phase out postfix operators?