Subject: Re: Cannot find a working 64-bit integer type on Illumos

From: Andres Freund <[email-masked]>
Date: Fri, 22 Mar 2024 09:53:05 -0700

Hi,

On 2024-03-23 00:48:05 +0800, Japin Li wrote:
> When I try to configure PostgreSQL 16.2 on Illumos using the following command,
> it complains $subject.
> 
>     ./configure --enable-cassert --enable-debug --enable-nls --with-perl \
>       --with-python --without-tcl --without-gssapi --with-openssl \
>       --with-ldap --with-libxml --with-libxslt --without-systemd \
>       --with-readline --enable-thread-safety --enable-dtrace \
>       DTRACEFLAGS=-64 CFLAGS=-Werror
> 
> However, if I remove the `CFLAGS=-Werror`, it works fine.

Likely there's an unrelated warning triggering the configure test to
fail. We'd need to see config.log to see what that is.

Greetings,

Andres Freund

---

From: Japin Li <[email-masked]>
Date: Sat, 23 Mar 2024 01:11:31 +0800

> fail. We'd need to see config.log to see what that is.

Thanks for your quick reply. Attach the config.log.

---

From: Tom Lane <[email-masked]>
Date: Fri, 22 Mar 2024 13:25:56 -0400

> Thanks for your quick reply. Attach the config.log.

Yup:

conftest.c:139:5: error: no previous prototype for 'does_int64_work' [-Werror=missing-prototypes]
  139 | int does_int64_work()
      |     ^~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
configure:17003: $? = 1
configure: program exited with status 1

This warning is harmless normally, but breaks the configure probe if
you enable -Werror.

No doubt we could improve that test snippet so that it does not
trigger that warning.  But trying to make configure safe for -Werror
seems like a fool's errand, for these reasons:

* Do you really want to try to make all of configure's probes proof
against every compiler warning everywhere?

* Many of the test snippets aren't readily under our control, as they
are supplied by Autoconf.

* In the majority of cases, any such failures would be silent, as
configure would just conclude that the feature it is probing for
isn't there.  So even finding there's a problem would be difficult.

The short answer is that Autoconf is not designed to support -Werror
and it's not worth it to try to make it do so.

			regards, tom lane

---

From: Thomas Munro <[email-masked]>
Date: Sat, 23 Mar 2024 13:45:28 +1300

>   139 | int does_int64_work()

. o O ( int64_t, PRIdi64, etc were standardised a quarter of a century ago )

---

From: Tom Lane <[email-masked]>
Date: Fri, 22 Mar 2024 22:23:13 -0400

> . o O ( int64_t, PRIdi64, etc were standardised a quarter of a century ago )

Yeah.  Now that we require C99 it's probably reasonable to assume
that those things exist.  I wouldn't be in favor of ripping out our
existing notations like UINT64CONST, because the code churn would be
substantial and the gain minimal.  But we could imagine reimplementing
that stuff atop <stdint.h> and then getting rid of the configure-time
probes.

			regards, tom lane