Thread
Commits
-
Include <limits.h> in fe-auth.c, to get CHAR_BIT reliably.
- efe8d8226929 16.0 landed
- 8fab4b348013 17.0 landed
-
BUG #18026: compile error / fe-auth.c:807:64: error: 'CHAR_BIT' undeclared (first use in this function)
The Post Office <noreply@postgresql.org> — 2023-07-17T15:27:21Z
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 '<limits.h>'; did you forget to '#include <limits.h>'? 42 | #include "fe-auth.h" +++ |+#include <limits.h> 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]: *** [<builtin>: 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> — 2023-07-17T16:15:59Z
PG Bug reporting form <noreply@postgresql.org> 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> — 2023-07-17T16:21:43Z
Am 17.07.2023 um 18:15 schrieb Tom Lane: > PG Bug reporting form <noreply@postgresql.org> 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> — 2023-07-17T18:46:50Z
Am 17.07.2023 um 18:21 schrieb Marcel Hofstetter: > Am 17.07.2023 um 18:15 schrieb Tom Lane: >> PG Bug reporting form <noreply@postgresql.org> 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> — 2023-07-17T18:55:50Z
Marcel Hofstetter <hofstetter@jomasoft.ch> 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 <limits.h> 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> — 2023-07-17T20:42:47Z
Marcel Hofstetter <hofstetter@jomasoft.ch> 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), <limits.h> is included by <sys/param.h>, which fe-auth.c includes. So that explains why we didn't see a problem most places, regardless of compile options. AFAICT <sys/param.h> is not specified by POSIX, so it's unsurprising if Solaris has a different idea of what it should expose. * The openssl headers #include <limits.h> 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)
Michael Paquier <michael@paquier.xyz> — 2023-07-18T05:44:18Z
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