Subject: Re: Error running configure on Mac

From: samay sharma <[email-masked]>
Date: Mon, 24 Jan 2022 08:41:39 -0800

Hey,

On Mon, Jan 24, 2022 at 12:09 AM Andres Freund <[email-masked]> wrote:

> Hi,
>
> On 2022-01-23 23:44:11 -0800, samay sharma wrote:
> > I also see many more error messages in config.log when I grep for error.
> > So, I've attached the entire file in case any other output is useful.
>
> The important lines seem to be:
>
> configure:4591: gcc  -c -g -O2  conftest.c >&5
> In file included from conftest.c:21:
> In file included from
> /Library/Developer/CommandLineTools/SDKs/MacOSX12.1.sdk/usr/include/stdlib.h:66:
> In file included from
> /Library/Developer/CommandLineTools/SDKs/MacOSX12.1.sdk/usr/include/sys/wait.h:110:
> /Library/Developer/CommandLineTools/SDKs/MacOSX12.1.sdk/usr/include/sys/resource.h:202:2:
> error: unknown type name 'uint8_t'
>         uint8_t  ri_uuid[16];
>
> I.e. that for some reason on your system stdlib.h is not standalone. Which
> is
> quite bizarre.
>
>
> Grepping through headers on an m1 mini running monterey, I see
>
> sys/resource.h:
> #include <sys/cdefs.h>
> ...
> #if __DARWIN_C_LEVEL >= __DARWIN_C_FULL
> #include <stdint.h>
> #endif /* __DARWIN_C_LEVEL >= __DARWIN_C_FULL */
>
> sys/cdefs.h:
> #if   defined(_ANSI_SOURCE)
> #define __DARWIN_C_LEVEL        __DARWIN_C_ANSI
> #elif defined(_POSIX_C_SOURCE) && !defined(_DARWIN_C_SOURCE) &&
> !defined(_NONSTD_SOURCE)
> #define __DARWIN_C_LEVEL        _POSIX_C_SOURCE
> #else
> #define __DARWIN_C_LEVEL        __DARWIN_C_FULL
> #endif
>
> So it seems that the problem is that for some reason your environment ends
> up
> with __DARWIN_C_LEVEL being set to something too low?
>
> It's interesting that all the _POSIX_C_SOURCE values are smaller than
> __DARWIN_C_LEVEL, which seems to indicate that the above include of
> stdint.h
> won't be made if _POSIX_C_SOURCE is set?
>
>
> Could you create a test.c file like:
> #include <stdarg.h>
> #include <stdbool.h>
> #include <stdlib.h>
> #include <wchar.h>
> #include <stdio.h>
>
> and then run
>
> gcc -v -E -dD test.c -o test.i
>
> and then share both the output of that and test.i?
>

Here's the output of running gcc -v -E -dD test.c -o test.i for that
program.

Apple clang version 13.0.0 (clang-1300.0.27.3)

Target: x86_64-apple-darwin21.2.0

Thread model: posix

InstalledDir: /Library/Developer/CommandLineTools/usr/bin

 "/Library/Developer/CommandLineTools/usr/bin/clang" -cc1 -triple
x86_64-apple-macosx12.0.0 -Wundef-prefix=TARGET_OS_
-Wdeprecated-objc-isa-usage -Werror=deprecated-objc-isa-usage
-Werror=implicit-function-declaration -E -disable-free
-disable-llvm-verifier -discard-value-names -main-file-name test.c
-mrelocation-model pic -pic-level 2 -mframe-pointer=all -fno-strict-return
-fno-rounding-math -munwind-tables -target-sdk-version=12.1
-fvisibility-inlines-hidden-static-local-var -target-cpu penryn -tune-cpu
generic -debugger-tuning=lldb -target-linker-version 710.1 -v -resource-dir
/Library/Developer/CommandLineTools/usr/lib/clang/13.0.0 -isysroot
/Library/Developer/CommandLineTools/SDKs/MacOSX12.1.sdk
-I/usr/local/include -internal-isystem
/Library/Developer/CommandLineTools/SDKs/MacOSX12.1.sdk/usr/local/include
-internal-isystem
/Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include
-internal-externc-isystem
/Library/Developer/CommandLineTools/SDKs/MacOSX12.1.sdk/usr/include
-internal-externc-isystem /Library/Developer/CommandLineTools/usr/include
-Wno-reorder-init-list -Wno-implicit-int-float-conversion
-Wno-c99-designator -Wno-final-dtor-non-final-class -Wno-extra-semi-stmt
-Wno-misleading-indentation -Wno-quoted-include-in-framework-header
-Wno-implicit-fallthrough -Wno-enum-enum-conversion
-Wno-enum-float-conversion -Wno-elaborated-enum-base
-fdebug-compilation-dir /Users/sash/PostgreSQL_Dev -ferror-limit 19
-stack-protector 1 -fstack-check -mdarwin-stkchk-strong-link -fblocks
-fencode-extended-block-signature -fregister-global-dtors-with-atexit
-fgnuc-version=4.2.1 -fmax-type-align=16 -fcommon -fcolor-diagnostics -dD
-clang-vendor-feature=+nullptrToBoolConversion
-clang-vendor-feature=+messageToSelfInClassMethodIdReturnType
-clang-vendor-feature=+disableInferNewAvailabilityFromInit
-clang-vendor-feature=+disableNeonImmediateRangeCheck
-clang-vendor-feature=+disableNonDependentMemberExprInCurrentInstantiation
-fno-odr-hash-protocols -clang-vendor-feature=+revert09abecef7bbf -mllvm
-disable-aligned-alloc-awareness=1 -mllvm -enable-dse-memoryssa=0 -o test.i
-x c test.c

clang -cc1 version 13.0.0 (clang-1300.0.27.3) default target
x86_64-apple-darwin21.2.0

ignoring nonexistent directory
"/Library/Developer/CommandLineTools/SDKs/MacOSX12.1.sdk/usr/local/include"

ignoring nonexistent directory
"/Library/Developer/CommandLineTools/SDKs/MacOSX12.1.sdk/Library/Frameworks"

#include "..." search starts here:

#include <...> search starts here:

 /usr/local/include

 /Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include

 /Library/Developer/CommandLineTools/SDKs/MacOSX12.1.sdk/usr/include

 /Library/Developer/CommandLineTools/usr/include

 /Library/Developer/CommandLineTools/SDKs/MacOSX12.1.sdk/System/Library/Frameworks
(framework directory)

End of search list.

I've also attached the test.i file.

Regards,
Samay

> Greetings,
> Andres Freund