[lfs-dev] Possible problem with current glibc (LFS 7.2 cant recompile LFS 7.2)

Ken Moffat zarniwhoop at ntlworld.com
Sun Aug 26 16:37:49 PDT 2012

On Sun, Aug 26, 2012 at 06:14:17PM -0500, Bruce Dubbs wrote:
> Bruce Dubbs wrote:
> > I tried setting CC in the environment for just the make and it didn't
> > work.  I also tried exporting BUILD_CC and wasn't picked up either.  Now
> > I just edited the Makefile to set BUILD_CC and it will take about 10
> > minutes to run.
> Well, that did work.  I also got the rpc/types.h: No such file or 
> directory error.  That's good because it says that the system is not 
> looking in the host's files.  I'll add the sed and configparms and try 
> again.
 For me, it bombed with
x86_64-lfs-linux-gnu-gcc   -D_RPC_THREAD_SAFE_ -D_GNU_SOURCE
-DIS_IN_build -include /mnt/lfs/building/glibc-build/config.h
rpc_main.c \
        -o /mnt/lfs/building/glibc-build/sunrpc/cross-rpc_main.o
/mnt/lfs/building/glibc-build/sunrpc/cross-rpc_main.o.dt -MT
/mnt/lfs/building/glibc-build/sunrpc/cross-rpc_main.o -c
rpc_main.c:37:19: fatal error: errno.h: No such file or directory
compilation terminated.
make[2]: *** [/mnt/lfs/building/glibc-build/sunrpc/cross-rpc_main.o]
Error 1

 I could see quite a lot going on in /usr/include/errno.h ->
bits/errno.h -> linux/errno.h but I thought I might as well get
everything to use the available linux/errno.h with

sed -i -e 's%\(errno\.h\)%linux/\1%' sunrpc/*.c

 but it now fails with
auth_unix.c: In function 'authunix_create_default':
auth_unix.c:194:11: error: 'errno' undeclared (first use in this
auth_unix.c:194:11: note: each undeclared identifier is reported
only once for each function it appears in
make[2]: ***
[/mnt/lfs/building/glibc-build/sunrpc/compat-auth_unix.os] Error 1
make[2]: *** Waiting for unfinished jobs....
clnt_gen.c: In function 'clnt_create':
clnt_gen.c:86:35: error: 'errno' undeclared (first use in this
clnt_gen.c:86:35: note: each undeclared identifier is reported only
once for each function it appears in
make[2]: ***
[/mnt/lfs/building/glibc-build/sunrpc/compat-clnt_gen.os] Error 1
make[2]: Leaving directory `/mnt/lfs/building/glibc-2.16.0/sunrpc'
make[1]: *** [sunrpc/subdir_lib] Error 2
make[1]: Leaving directory `/mnt/lfs/building/glibc-2.16.0'
make: *** [all] Error 2

 I can see the following in /usr/include/errno.h
#ifndef _ERRNO_H

/* The includer defined __need_Emath if he wants only the
 * definitions
   of EDOM and ERANGE, and not everything else.  */
#ifndef __need_Emath
# define _ERRNO_H       1
# include <features.h>


/* Get the error number constants from the system-specific file.
   This file will test __need_Emath and _ERRNO_H.  */
#include <bits/errno.h>
#undef  __need_Emath

#ifdef  _ERRNO_H

/* Declare the `errno' variable, unless it's defined as a macro by
   bits/errno.h.  This is the case in GNU, where it is a per-thread
   variable.  This redeclaration using the macro still works, but it
   will be a function declaration without a prototype and may
   a -Wstrict-prototypes warning.  */
#ifndef errno
extern int errno;

 but in bits/errno.h I can see

#ifdef _ERRNO_H

# undef EDOM
# undef EILSEQ
# undef ERANGE
# include <linux/errno.h>

/* Linux has no ENOTSUP error code.  */

/* Older Linux versions also had no ECANCELED error code.  */
# ifndef ECANCELED
#  define ECANCELED     125
# endif

/* Support for error codes to support robust mutexes was added
 * later, too.  */
#  define EOWNERDEAD            130
#  define ENOTRECOVERABLE       131
# endif

# ifndef ERFKILL
#  define ERFKILL               132
# endif

# ifndef EHWPOISON
#  define EHWPOISON             133
# endif

# ifndef __ASSEMBLER__
/* Function to get address of global `errno' variable.  */
extern int *__errno_location (void) __THROW __attribute__

#  if !defined _LIBC || defined _LIBC_REENTRANT
/* When using threads, errno is a per-thread value.  */
#   define errno (*__errno_location ())
#  endif
# endif /* !__ASSEMBLER__ */
#endif /* _ERRNO_H */

#if !defined _ERRNO_H && defined __need_Emath
/* This is ugly but the kernel header is not clean enough.  We must
   define only the values EDOM, EILSEQ and ERANGE in case
__need_Emath is
   defined.  */
# define EDOM   33      /* Math argument out of domain of function.
# */
# define EILSEQ 84      /* Illegal byte sequence.  */
# define ERANGE 34      /* Math result not representable.  */
#endif /* !_ERRNO_H && __need_Emath */

 I suppose this is only needed by the invocations of cross-rpcgen in
glibc, which on x86_64 start with
CPP='x86_64-lfs-linux-gnu-gcc -E -x c-header'
/mnt/lfs/building/glibc-build/sunrpc/cross-rpcgen -Y ../scripts -h
rpcsvc/bootparam_prot.x -o
/bin/sh ../scripts/move-if-change

 but I've no idea how to define code for the errno function now that
the host's glibc appears to be unavailable.

das eine Mal als Tragödie, das andere Mal als Farce

More information about the lfs-dev mailing list