Subject: Re:

From: Francois Desloges <[email-masked]>
Date: Wed, 22 Sep 1999 17:08:41 -0400

OK! Investigating why 

A "grep -nre LIBNSS_FILES_SO /usr/*" gives me:

In /usr/include/gnu/lib-names.h:25:
>#define	LIBNSS_FILES_SO	"libnss_files.so.2"
which is LIBNSS_FILES_SO only existing definition.

Irrelevant stuff in /usr/lib/perl5/5.00503/i386-linux/gnu/lib-names.ph
Irrelevant stuff in /usr/src/glibc/glibc-2.1.2/ChangeLog.7

And finally in /usr/src/glibc/glibc-2.1.2/nss/nsswitch.c:71, the line that
generate the make Error:
>static const char *const __nss_shlib_revision = LIBNSS_FILES_SO + 15;   
Which, with
>#define	LIBNSS_FILES_SO	"libnss_files.so.2"
would give something like:
>static const char *const __nss_shlib_revision = ".2";

The complete offending nss/nsswitch.c code being:
>#if !defined DO_STATIC_NSS || defined PIC
>/* String with revision number of the shared object files.  */
>static const char *const __nss_shlib_revision = LIBNSS_FILES_SO + 15;
>#endif

I definitely don't want DO_STATIC_NSS defined, which would have been the case
if I would have add --enable-static-nss to ./configure, which I haven't (as
recommended by INSTALL). So it's correct that this declaration get
compiled.

Therefore, it might only be that gnu/lib-names.h, where
LIBNSS_FILES_SO is defined hasn't been included. If i'm not wrong, the useful
content of this file is normally created on "make install" so is not supposed
to be available on the first make.

Indeed in nss/nsswitch.c, there's a
>#if !defined DO_STATIC_NSS || defined PIC
>#include <gnu/lib-names.h>
>#endif
just a few lines before the offending code.

I don't know what is the <official> include directory on this build. However,
having not barked at the "#include <gnu/lib-names.h>" line the build has
obviously found the file. Well, "find" tell me that there's only 2 lib-names.h
found on all my system. These are located in /usr/include/gnu and
/usr/src/glibc/glibc-2.1.2/gnu.
Since grep already told me that LIBNSS_FILES_SO is defined in the first file,
and that I doubt this build would rely on an already installed glibc it knows
nothing about, my build defintively included the second one.

/usr/src/glibc/glibc-2.1.2/gnu/lib-names.h has not really yet
been built since the glibc I'm building has obviously not been installed. It
reads as follow:

>/* This file is automatically generated.
>   It defines macros to allow user program to find the shared
>   library files which come as part of GNU libc.  */
>#ifndef __GNU_LIB_NAMES_H
>#define __GNU_LIB_NAMES_H	1
>
>
>#endif	/* gnu/lib-names.h */

Which bring me to my question:
How do I get get glibc-2.1.2/gnu/lib-names.h to have LIBNSS_FILES_SO defined
before glibc is built?

Any one has an idea of any other mysterious explanation?

--
François Desloges
[email-masked]
unsubscribe: body of `unsubscribe linux-arm' to [email-masked]

---

From: Philip Blundell <[email-masked]>
Date: Wed, 22 Sep 1999 22:54:15 +0100

>LIBNSS_FILES_SO is defined hasn't been included. If i'm not wrong, the
>useful content of this file is normally created on "make install" so is 
>not supposed to be available on the first make.

No, this file is supposed to be built quite early in the make process.
It has a before-compile rule in Makeconfig, and lots of places in libc depend 
on it.  It is built from soversions.mk, which in turn is built by make from 
rules in Makeconfig.

>Any one has an idea of any other mysterious explanation?

Did you check what version of GNU make you have?

p.

---

From: Francois Desloges <[email-masked]>
Date: Thu, 23 Sep 1999 08:51:50 -0400

> Did you check what version of GNU make you have?

Sorry, I forgot the earlier questions.
My make version is 3.77, which glibc Install tell me should not cause any
problem. And building without -j 2 gives the same results.

My Makeconfig contain the appropriate lib-names.h creations routine:
># Generate the header containing the names of all shared libraries.
># We use a stamp file to avoid uncessary recompilations.
>before-compile += $(common-objpfx)gnu/lib-names.h
>$(common-objpfx)gnu/lib-names.h: $(common-objpfx)gnu/lib-names.stmp; @:
>$(common-objpfx)gnu/lib-names.stmp: $(common-objpfx)soversions.mk
>	$(make-target-directory)
>	@rm -f ${@:stmp=T} $@
>	(echo '/* This file is automatically generated.';\
>	 echo '   It defines macros to allow user program to find the shared';\
>	 echo '   library files which come as part of GNU libc.  */';\
>	 echo '#ifndef __GNU_LIB_NAMES_H'; \
>	 echo '#define __GNU_LIB_NAMES_H	1'; \
>	 echo; \
>	 (libs='$(all-sonames)';\
>	  for l in $$libs; do \
>	    upname=`echo $$l | sed 's/[.]so.*//' | \
>		    tr 'abcdefghijklmnopqrstuvwxyz-' \
>		       'ABCDEFGHIJKLMNOPQRSTUVWXYZ_'`; \
>	    echo "#define	$${upname}_SO	\"$$l\""; \
>	  done;) | sort; \
>	 echo; \
>	 echo '#endif	/* gnu/lib-names.h */';) > ${@:stmp=T}
>	$(move-if-change) ${@:stmp=T} ${@:stmp=h}
>	touch $@
>
>common-generated += gnu/lib-names.h gnu/lib-names.stmp

And the soversions.mk generation code that precede it in the Makeconfig
generated the appropriate soversions.mk file, which content begin  with:
>libpthread.so-version=.0
>all-sonames+=libpthread.so$(libpthread.so-version)
>libm.so-version=.6
>all-sonames+=libm.so$(libm.so-version)
>libc.so-version=.6
>all-sonames+=libc.so$(libc.so-version)
>ld.so-version=ld-linux.so.2
>all-sonames+=$(ld.so-version)
>libdl.so-version=.2
>all-sonames+=libdl.so$(libdl.so-version)
>libutil.so-version=.1
>all-sonames+=libutil.so$(libutil.so-version)
>libresolv.so-version=.2
>all-sonames+=libresolv.so$(libresolv.so-version)
>libnss_files.so-version=.2
>all-sonames+=libnss_files.so$(libnss_files.so-version)
>...
which should generate the appropriate
>#define LIBNSS_FILES_SO "libnss_files.so.2" 
line and all other defines in lib-names.h

I just have _no_ idea what to do!

By the way, how do I force make to rebuild everything?
I've read/browse-trough almost half of make's document and have find nothing
about this (though it was very instructive)
And is Makeconfig executed by ./configure or make?

Oh well, I feel by far too dependent from your help!
One day, I promise, I'll be the one helping :-)
Thank you so much !

---

From: Philip Blundell <[email-masked]>
Date: Thu, 23 Sep 1999 21:52:20 +0100

>My make version is 3.77,

That's the same version I use, and I haven't seen any problems.

>>all-sonames+=libpthread.so$(libpthread.so-version)

That looks OK to me.

>I just have _no_ idea what to do!

Well, the way this is supposed to work is that soversions.mk is included by 
Makeconfig.  This defines $(all-sonames) to be a list of the libraries, and 
the iterator in the rule you quoted goes through the list outputting the 
appropriate definitions.  It looks like $(all-sonames) is somehow ending up 
empty, which suggests that either soversions.mk isn't being included at the 
right point, or you have a spurious version of that file somewhere that 
doesn't contain the right definitions.  You might get some clues by running 
make with the debug flags, or adding strategic echo commands to the rule in 
Makeconfig.

>By the way, how do I force make to rebuild everything?

`make clean; make' is the easiest way.  I don't know of any option to tell it 
to consider everything is out of date.  If you just want to rebuild 
lib-names.h then deleting it and rerunning `make' should do the trick.

>And is Makeconfig executed by ./configure or make?

The latter.

p.