Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Mon, 20 May 2013 21:49:00 -0700
From: Isaac Dunham <idunham@...abit.com>
To: musl@...ts.openwall.com
Subject: Re: error compiling shadow 4.1.5.1

On Mon, 20 May 2013 23:14:32 -0400
Rich Felker <dalias@...ifal.cx> wrote:

> On Mon, May 20, 2013 at 07:58:44PM -0700, Isaac Dunham wrote:
> > On Mon, 20 May 2013 21:17:20 -0300
> > "Matias A. Fonzo" <selk@...gora.org> wrote:
> > > I'm trying to compile shadow 4.1.5.1.  I receive this error:
> >  
> > > http://pastebin.com/raw.php?i=9kzU9hfg
> >  
> > > It seems like some entries are missing in utmp.h:
> > > ut_host, ut_addr/ut_addr_v6, ...

Could you please provide some clarification as to your configuration?
Specifically, whether PAM is installed, if you disabled nscd (ISTR that
being tied in with glibc), and whether musl is installed in parallel
with glibc (it could be picking up stuff from /usr/include).

I get the impression that the configure script is picking
things up when it shouldn't.  Specifically, it "detects" several
features that may be from /usr.

> > 1: musl does not support utmp. A public list of who's logged in is
> > not desired.
> 
> Well the utmp functions are stubs that don't read or write any data,
> but the interfaces are there to facilitate compiling programs that
> expect them to exist. If there are build errors due to stuff being
> missing, we should add it.
> 
> > 2: Just looking at that error, I get the impression that someone
> > either isn't defining a feature-test macro that they should or is
> > omitting a header. AF_INET is defined in sys/socket.h
> 
> Indeed. glibc exposes socket stuff indirectly through some other
> headers, if I'm not mistaken. musl on the other hand avoids pulling in
> additional headers implicitly. If this is indeed the problem, I think
> just adding #include <sys/socket.h> to the file would fix it.

> > 3: I see no indications that the errors are due to ut_* being
> > absent.
> 
> Agreed.

Adding <sys/socket.h> above <netdb.h> helps get it building.
There are still issues...but they show up due to ut_addr_v6 being
detected in struct utmp.
The errors:
utmp.c: In function 'prepare_utmp':
utmp.c:267: error: dereferencing pointer to incomplete type
utmp.c:268: error: dereferencing pointer to incomplete type
utmp.c:268: error: dereferencing pointer to incomplete type
utmp.c:274: error: dereferencing pointer to incomplete type
utmp.c:275: error: dereferencing pointer to incomplete type
utmp.c:275: error: dereferencing pointer to incomplete type
make[2]: *** [utmp.o] Error 1

Lines 265-277:
#ifdef HAVE_STRUCT_UTMP_UT_ADDR_V6
	memcpy (utent->ut_addr_v6,
		&(sa->sin_addr),
		MIN (sizeof (utent->ut_addr_v6),
		     sizeof (sa->sin_addr)));
	} else if (info->ai_family == AF_INET6) {
		struct sockaddr_in6 *sa =
		(struct sockaddr_in6 *)info->ai_addr;
		memcpy (utent->ut_addr_v6,
			&(sa->sin6_addr),
			MIN (sizeof (utent->ut_addr_v6),
			     sizeof (sa->sin6_addr)));
#endif				/* HAVE_STRUCT_UTMP_UT_ADDR_V6 */

And config.h:
/* Define to 1 if `ut_addr_v6' is a member of `struct utmp'. */
#define HAVE_STRUCT_UTMP_UT_ADDR_V6

undefining this makes it build.

But it seems that ut_addr_v6 is a member of struct utmpx, and that
should be enough...

Finally, there's an unconditional use of ruserok; of course they check
whether it returns 0 or 1 on failure, but assume it's present!

Welcome to autoconf, the build system that will make sure you have ANSI
C89 headers, but won't make sure you have a function that never even
made it into POSIX.

And tcb.h is missing, which means shadow won't enable it.

HTH,
Isaac Dunham

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.