BUG #18026: compile error / fe-auth.c:807:64: error: 'CHAR_BIT' undeclared (first use in this function)
BUG #18026: compile error / fe-auth.c:807:64: error: 'CHAR_BIT' undeclared (first use in this function)
От:
PG Bug reporting form <noreply@postgresql.org>
Дата:
The following bug has been logged on the website:
Bug reference: 18026
Logged by: Marcel Hofstetter
Email address: hofstetter@jomasoft.ch
PostgreSQL version: 16beta2
Operating system: Solaris 11.4 SPARC
Description:
...
gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement
-Werror=vla -Wendif-labels -Wmissing-format-attribute
-Wimplicit-fallthrough=3 -Wcast-function-type -Wshadow=compatible-local
-Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard
-Wno-format-truncation -Wno-stringop-truncation -O2
-D_POSIX_PTHREAD_SEMANTICS -pthread -D_REENTRANT -D_THREAD_SAFE -fPIC -I.
-I../../../src/include -D_POSIX_PTHREAD_SEMANTICS -I../../../src/port
-I../../../src/port -DSO_MAJOR_VERSION=5 -c -o fe-auth.o fe-auth.c
In file included from ../../../src/include/postgres_fe.h:25,
from fe-auth.c:23:
fe-auth.c: In function 'check_expected_areq':
fe-auth.c:807:64: error: 'CHAR_BIT' undeclared (first use in this
function)
807 | StaticAssertDecl((sizeof(conn->allowed_auth_methods) *
CHAR_BIT) > AUTH_REQ_MAX,
|
^~~~~~~~
../../../src/include/c.h:914:24: note: in definition of macro
'StaticAssertDecl'
914 | _Static_assert(condition, errmessage)
| ^~~~~~~~~
fe-auth.c:43:1: note: 'CHAR_BIT' is defined in header ''; did you
forget to '#include '?
42 | #include "fe-auth.h"
+++ |+#include
43 | #include "fe-auth-sasl.h"
In file included from ../../../src/include/postgres_fe.h:25,
from fe-auth.c:23:
fe-auth.c:807:64: note: each undeclared identifier is reported only once for
each function it appears in
807 | StaticAssertDecl((sizeof(conn->allowed_auth_methods) *
CHAR_BIT) > AUTH_REQ_MAX,
|
^~~~~~~~
../../../src/include/c.h:914:24: note: in definition of macro
'StaticAssertDecl'
914 | _Static_assert(condition, errmessage)
| ^~~~~~~~~
fe-auth.c:807:26: error: expression in static assertion is not an integer
807 | StaticAssertDecl((sizeof(conn->allowed_auth_methods) *
CHAR_BIT) > AUTH_REQ_MAX,
| ^
../../../src/include/c.h:914:24: note: in definition of macro
'StaticAssertDecl'
914 | _Static_assert(condition, errmessage)
| ^~~~~~~~~
gmake[3]: *** [: fe-auth.o] Error 1
Re: BUG #18026: compile error / fe-auth.c:807:64: error: 'CHAR_BIT' undeclared (first use in this function)
От:
Tom Lane <tgl@sss.pgh.pa.us>
Дата:
PG Bug reporting form writes: > fe-auth.c: In function 'check_expected_areq': > fe-auth.c:807:64: error: 'CHAR_BIT' undeclared (first use in this > function) Hmm. This problem seems straightforward enough to fix, but what I don't understand is why we've not seen it already. We do have a buildfarm animal running on Solaris 11.4 [1], and it's not unhappy. Are you using any unusual build options or toolchain? regards, tom lane [1] https://buildfarm.postgresql.org/cgi-bin/show_history.pl?nm=margay&br=HEAD
Re: BUG #18026: compile error / fe-auth.c:807:64: error: 'CHAR_BIT' undeclared (first use in this function)
От:
Marcel Hofstetter <hofstetter@jomasoft.ch>
Дата:
Am 17.07.2023 um 18:15 schrieb Tom Lane: > PG Bug reporting form writes: >> fe-auth.c: In function 'check_expected_areq': >> fe-auth.c:807:64: error: 'CHAR_BIT' undeclared (first use in this >> function) > > Hmm. This problem seems straightforward enough to fix, but what I > don't understand is why we've not seen it already. We do have a > buildfarm animal running on Solaris 11.4 [1], and it's not unhappy. > Are you using any unusual build options or toolchain? > > regards, tom lane > > [1] https://buildfarm.postgresql.org/cgi-bin/show_history.pl?nm=margay&br=HEAD I'm the owner of margay. No idea why it works there. buildfarm tests and building this beta2 is on the same system. Using just defaults and --without-icu on buildfarm and beta2 compile. Best regards, Marcel
Re: BUG #18026: compile error / fe-auth.c:807:64: error: 'CHAR_BIT' undeclared (first use in this function)
От:
Marcel Hofstetter <hofstetter@jomasoft.ch>
Дата:
Am 17.07.2023 um 18:21 schrieb Marcel Hofstetter: > Am 17.07.2023 um 18:15 schrieb Tom Lane: >> PG Bug reporting form writes: >>> fe-auth.c: In function 'check_expected_areq': >>> fe-auth.c:807:64: error: 'CHAR_BIT' undeclared (first use in this >>> function) >> >> Hmm. This problem seems straightforward enough to fix, but what I >> don't understand is why we've not seen it already. We do have a >> buildfarm animal running on Solaris 11.4 [1], and it's not unhappy. >> Are you using any unusual build options or toolchain? >> >> regards, tom lane >> >> [1] >> https://buildfarm.postgresql.org/cgi-bin/show_history.pl?nm=margay&br=HEAD > > I'm the owner of margay. No idea why it works there. > buildfarm tests and building this beta2 is on the same system. > > Using just defaults and --without-icu on buildfarm and beta2 compile. I found it fails after ./configure --prefix /usr/local/16-pgsql --without-icu but compiles with ./configure --prefix /usr/local/16-pgsql --without-icu --with-openssl Best regards, Marcel
Re: BUG #18026: compile error / fe-auth.c:807:64: error: 'CHAR_BIT' undeclared (first use in this function)
От:
Tom Lane <tgl@sss.pgh.pa.us>
Дата:
Marcel Hofstetter writes: > Am 17.07.2023 um 18:15 schrieb Tom Lane: >> Hmm. This problem seems straightforward enough to fix, but what I >> don't understand is why we've not seen it already. We do have a >> buildfarm animal running on Solaris 11.4 [1], and it's not unhappy. > I'm the owner of margay. No idea why it works there. > buildfarm tests and building this beta2 is on the same system. [ noses around a bit... ] I see that margay uses --with-gssapi, could that be the difference? fe-auth.c pulls in a fair amount more stuff if ENABLE_GSS is set than if it isn't, though I did not check to see if is in there in particular. regards, tom lane
Re: BUG #18026: compile error / fe-auth.c:807:64: error: 'CHAR_BIT' undeclared (first use in this function)
От:
Tom Lane <tgl@sss.pgh.pa.us>
Дата:
Marcel Hofstetter writes: > I found it fails after > ./configure --prefix /usr/local/16-pgsql --without-icu > but compiles with > ./configure --prefix /usr/local/16-pgsql --without-icu --with-openssl Ah. Further digging shows that: * On Linux, macOS, and NetBSD (probably all *BSD), is included by , which fe-auth.c includes. So that explains why we didn't see a problem most places, regardless of compile options. AFAICT is not specified by POSIX, so it's unsurprising if Solaris has a different idea of what it should expose. * The openssl headers #include from ossl_typ.h, which is pulled in indirectly from most other openssl headers. So that's why margay didn't complain. So I'm now satisfied that the problem is explained, and I'll go put in the needful #include. Thanks for the report! regards, tom lane
Re: BUG #18026: compile error / fe-auth.c:807:64: error: 'CHAR_BIT' undeclared (first use in this function)
On Mon, Jul 17, 2023 at 04:42:47PM -0400, Tom Lane wrote: > So I'm now satisfied that the problem is explained, and I'll go > put in the needful #include. Thanks for the report! Thanks for the fix. I have just noticed this thread after-the-fact. -- Michael