Re: Error running configure on Mac

From: Andres Freund <andres(at)anarazel(dot)de>
To: samay sharma <smilingsamay(at)gmail(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: Error running configure on Mac
Date: 2022-01-24 08:09:27
Message-ID: 20220124080927.7lvubnvtgeik6jah@alap3.anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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?

Greetings,

Andres Freund

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 2022-01-24 08:11:52 Re: PSA: Autoconf has risen from the dead
Previous Message Noah Misch 2022-01-24 08:02:43 Re: XLogReadRecord() error in XlogReadTwoPhaseData()