Re: Fix for configure error in 9.5/9.6 on macOS 11.0 Big Sur - Mailing list pgsql-hackers

From Jesse Zhang
Subject Re: Fix for configure error in 9.5/9.6 on macOS 11.0 Big Sur
Date
Msg-id CAGf+fX7CMmNxY33VDuZb3SL94LKrqZ_v2cvdNCygq6WLDyOAYg@mail.gmail.com
Whole thread Raw
In response to Re: Fix for configure error in 9.5/9.6 on macOS 11.0 Big Sur  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Fix for configure error in 9.5/9.6 on macOS 11.0 Big Sur  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
Hi Tom and Peter,

On Wed, Sep 2, 2020 at 10:40 PM Tom Lane <tgl@sss.pgh.pa.us> wrote:
>
> Peter Eisentraut <peter.eisentraut@2ndquadrant.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



pgsql-hackers by date:

Previous
From: Mark Dilger
Date:
Subject: Re: factorial function/phase out postfix operators?
Next
From: Dave Page
Date:
Subject: Re: Kerberos support broken on MSVC builds for Windows x64?