[Pkg-shadow-devel] Building shadow uid_t not defined

Angel Tsankov fn42551 at fmi.uni-sofia.bg
Fri Mar 13 01:09:34 UTC 2009

Nicolas François wrote:
> Hello,
> On Thu, Mar 12, 2009 at 04:42:50PM +0200, fn42551 at fmi.uni-sofia.bg
> wrote:
>> I'm trying to compile shadow  './configure' completed
>> successfully, but 'make' prints the following error:
>> gcc -DHAVE_CONFIG_H -I. -I.. -I../lib -g -O2 -MT xgetpwnam.o -MD -MP
>> -MF .deps/xgetpwnam.Tpo -c -o xgetpwnam.o xgetpwnam.c
>> In file included from xgetpwnam.c:52:
>> ../lib/pwio.h:37: error: parse error before "uid"
>> It seems that 'uid_t' has not been defined.  I search for its
>> definition and found that 'uid_t' is conditionally typedef'ed in
>> /usr/include/pwd.h.  The condition is '#if defined __USE_XOPEN ||
>> defined __USE_XOPEN2K'.  I remember building this version of shadow
>> without any problem before.  How can I build it again?
> What is your system? (and what libc?)

The system is the LFS 6.1.1 LiveCD (around 3 year old). The C library is
glibc and it is at least that old, too.  With the latest version of this
system shadow compiles.

> Also do you have a getpwent or getpwuid manpage for this system?
> Does it indicate any macro to be defined before the inclusion of
> <sys/types.h> and <pwd.h>?
Yes, the system has man pages for getpwent and for getpwuid, but neither of
them mentions any macro.

> To fix you problem, you can probably define one of these variables,
> but that could give incompatible definitions.
> Another idea could be to find another file in the shadow source which
> uses some uid_t and look at the included files.
> (A first idea could be to include <unistd.h> in lib/pwio.h before
> <sys/types.h>)
First, neither <unistd.h>, nor <sys/types.h> is included in lib/pwio.h.
Second, including them in any order (before pwd.h) fixes the above error.
Including just <sys/types.h> also works, but including only <unistd.h> does

Later on, the same error occured during the compilation of xgetgrnam.c, and
I included <sys/types.h> in lib/groupio.h, too.  After these two changes
shadow was compiled.

Thanks for your reply,
Angel Tsankov

More information about the Pkg-shadow-devel mailing list