bug-gnu-utils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: lack of param.h causing compilation problem in a custom environment


From: Aharon Robbins
Subject: Re: lack of param.h causing compilation problem in a custom environment
Date: Tue, 26 Aug 2003 17:45:21 +0300

Greetings.  Re this:

> Date: Sun, 24 Aug 2003 00:35:32 +1000
> From: Daniel Bradley <address@hidden>
> Subject: lack of param.h causing compilation problem in a custom environment
> To: address@hidden
>
> Hi,
>
> I think i've identified a compilation problem while building gawk in a 
> custom environment roughly based on Linux from scratch 4.1.
>
> Glibc-2.2.5
> binutils-2.13
> gcc-3.2
> gawk-3.1.1 (but visual checking of source would indicate problem is also 
> in 3.1.3)
>
> I think i've traced the problem to being that <sys/params.h> isn't being 
> #included in awk.h yet there exists a #if defined test that relies upon 
> NGROUPS_MAX, which is retrieved via that header (original definition is 
> in <linux/limits.h>).
>
> Therefore if NGROUPS_MAX is defined it will not be detected in awk.h 
> thus "groups" and "groupset" will not be declared - a similar test is 
> also in main.c where the two are defined.
>
> This results in the code at "io.c:1364" trying to use the ngroups
> global variable that hasn't been defined yet.
>
> The compile error I get is:
>
> gcc -DDEFPATH="\".:/system/software/text_processing/gawk-3.1.1/share/awk\""
> -DHAVE_CONFIG_H -DGAWK
> -DLOCALEDIR="\"/system/software/text_processing/gawk-3.1.1/share/locale\""
> -I. -I. -I. -I./intl    -march=i386 -c `test -f io.c || echo './'`io.c
> io.c: In function `useropen':
> io.c:1365: `ngroups' undeclared (first use in this function)
> io.c:1365: (Each undeclared identifier is reported only once
> io.c:1365: for each function it appears in.)
> io.c:1367: `groupset' undeclared (first use in this function)
> make[2]: *** [io.o] Error 1
> make[2]: Leaving directory `/local/build/gawk-3.1.1'
> make[1]: *** [all-recursive] Error 1
> make[1]: Leaving directory `/local/build/gawk-3.1.1'
> make: *** [all] Error 2
> software@/local/build/gawk-3.1.1$
>
> Cheers,
> Daniel Bradley.

According to POSIX, NGROUPS_MAX comes from <limits.h>, not <sys/param.h>.

>From the error message, it would appear that you should change
this line:

        #if defined(NGROUPS_MAX) && NGROUPS_MAX > 0

into this:

        #if defined (HAVE_GETGROUPS) && defined(NGROUPS_MAX) && NGROUPS_MAX > 0

which is what awk.h and main.c use, and hopefully the problem will go
away.  I'll get this fix into my tree.

Thanks,

Arnold




reply via email to

[Prev in Thread] Current Thread [Next in Thread]