pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
BUG #18026: compile error / fe-auth.c:807:64: error: 'CHAR_BIT' undeclared (first use in this function)
7+ messages / 4 participants
[nested] [flat]

Commits from this thread:
  2023-07-17 8fab4b3480 efe8d82269  Include <limits.h> in fe-auth.c, to get CHAR_BIT reliably.
* BUG #18026: compile error / fe-auth.c:807:64: error: 'CHAR_BIT' undeclared (first use in this function)
@ 2023-07-17 15:27 PG Bug reporting form <noreply@postgresql.org>
  2023-07-17 16:15 ` 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>
  0 siblings, 1 reply; 7+ messages in thread

From: PG Bug reporting form @ 2023-07-17 15:27 UTC (permalink / raw)
  To: pgsql-bugs@lists.postgresql.org; +Cc: hofstetter@jomasoft.ch

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



^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* Re: BUG #18026: compile error / fe-auth.c:807:64: error: 'CHAR_BIT' undeclared (first use in this function)
  2023-07-17 15:27 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>
@ 2023-07-17 16:15 ` Tom Lane <tgl@sss.pgh.pa.us>
  2023-07-17 16:21   ` Re: BUG #18026: compile error / fe-auth.c:807:64: error: 'CHAR_BIT' undeclared (first use in this function) Marcel Hofstetter <hofstetter@jomasoft.ch>
  0 siblings, 1 reply; 7+ messages in thread

From: Tom Lane @ 2023-07-17 16:15 UTC (permalink / raw)
  To: hofstetter@jomasoft.ch; +Cc: pgsql-bugs@lists.postgresql.org

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





^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* Re: BUG #18026: compile error / fe-auth.c:807:64: error: 'CHAR_BIT' undeclared (first use in this function)
  2023-07-17 15:27 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>
  2023-07-17 16:15 ` 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-17 16:21   ` Marcel Hofstetter <hofstetter@jomasoft.ch>
  2023-07-17 18:46     ` 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-17 18:55     ` 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>
  0 siblings, 2 replies; 7+ messages in thread

From: Marcel Hofstetter @ 2023-07-17 16:21 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: pgsql-bugs@lists.postgresql.org

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






^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* Re: BUG #18026: compile error / fe-auth.c:807:64: error: 'CHAR_BIT' undeclared (first use in this function)
  2023-07-17 15:27 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>
  2023-07-17 16:15 ` 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-17 16:21   ` 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-17 18:46     ` Marcel Hofstetter <hofstetter@jomasoft.ch>
  2023-07-17 20:42       ` 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>
  1 sibling, 1 reply; 7+ messages in thread

From: Marcel Hofstetter @ 2023-07-17 18:46 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: pgsql-bugs@lists.postgresql.org

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







^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* Re: BUG #18026: compile error / fe-auth.c:807:64: error: 'CHAR_BIT' undeclared (first use in this function)
  2023-07-17 15:27 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>
  2023-07-17 16:15 ` 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-17 16:21   ` 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-17 18:46     ` 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-17 20:42       ` Tom Lane <tgl@sss.pgh.pa.us>
  2023-07-18 05:44         ` Re: BUG #18026: compile error / fe-auth.c:807:64: error: 'CHAR_BIT' undeclared (first use in this function) Michael Paquier <michael@paquier.xyz>
  0 siblings, 1 reply; 7+ messages in thread

From: Tom Lane @ 2023-07-17 20:42 UTC (permalink / raw)
  To: Marcel Hofstetter <hofstetter@jomasoft.ch>; +Cc: pgsql-bugs@lists.postgresql.org

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





^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* Re: BUG #18026: compile error / fe-auth.c:807:64: error: 'CHAR_BIT' undeclared (first use in this function)
  2023-07-17 15:27 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>
  2023-07-17 16:15 ` 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-17 16:21   ` 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-17 18:46     ` 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-17 20:42       ` 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-18 05:44         ` Michael Paquier <michael@paquier.xyz>
  0 siblings, 0 replies; 7+ messages in thread

From: Michael Paquier @ 2023-07-18 05:44 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: Marcel Hofstetter <hofstetter@jomasoft.ch>; pgsql-bugs@lists.postgresql.org

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

Attachments:

  signature.asc (application/pgp-signature, 832B) download

^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* Re: BUG #18026: compile error / fe-auth.c:807:64: error: 'CHAR_BIT' undeclared (first use in this function)
  2023-07-17 15:27 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>
  2023-07-17 16:15 ` 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-17 16:21   ` 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-17 18:55     ` Tom Lane <tgl@sss.pgh.pa.us>
  1 sibling, 0 replies; 7+ messages in thread

From: Tom Lane @ 2023-07-17 18:55 UTC (permalink / raw)
  To: Marcel Hofstetter <hofstetter@jomasoft.ch>; +Cc: pgsql-bugs@lists.postgresql.org

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





^ permalink  raw  reply  [nested|flat] 7+ messages in thread


end of thread, other threads:[~2023-07-18 05:44 UTC | newest]

Thread overview: 7+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2023-07-17 15:27 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>
2023-07-17 16:15 ` Tom Lane <tgl@sss.pgh.pa.us>
2023-07-17 16:21   ` Marcel Hofstetter <hofstetter@jomasoft.ch>
2023-07-17 18:46     ` Marcel Hofstetter <hofstetter@jomasoft.ch>
2023-07-17 20:42       ` Tom Lane <tgl@sss.pgh.pa.us>
2023-07-18 05:44         ` Michael Paquier <michael@paquier.xyz>
2023-07-17 18:55     ` Tom Lane <tgl@sss.pgh.pa.us>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox