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

Ken Moffat zarniwhoop at ntlworld.com
Sun Aug 26 19:20:05 PDT 2012

On Sun, Aug 26, 2012 at 06:51:37PM -0700, Bryan Kadzban wrote:
> Uh, isn't that backwards?  :-)
> BUILD_CC is the CC to use to build programs that will be executed on the
> cross-compilation *source* architecture, not the destination. ${LFS_TGT}
> is the destination arch.  The glibc sources are trying to build this
> program for the source.
 And we think we don't want it, because "we never used to need this,
grumble, grumble" ;-)

> This actually also means that host includes (and libs) are *absolutely*
> required to be here.  This output doesn't get linked into the cross
> glibc, so this is *not* actually a contamination from the host system.
> (Only the output of rpcgen, after it gets built and run, is used.)
> This does mean, however, that the host does really need the rpc/types.h
> header file installed, so on systems that don't have it, glibc won't
> build...
 I'm glad someone here understands this stuff (I certainly don't), but
I'm still expecting to see moans about this new requirement,

 I've just had another go, reverting first
commit 656416c96528437f54b345b1470aaa40f145ed30
Author: Andreas Schwab <schwab at linux-m68k.org>
Date:   Sat May 12 08:40:20 2012 +0200

    Fix dependency tracking on cross-rpcgen-objs

 and then the other commit.  Strangely, the Changelog parts of the
commits don't revert, but the rest does.  I've now got in to gcc
pass 2 (without the extra sed or the CC override).  Still with the
rpc headers pushed out of the way.

 I'll keep this running to see if it completes.

 I don't _think_ that the host's rpc headers are critical at this
stage, but I'm not a toolchain expert.

 Even if my revert works, we don't really want to keep carrying this
for our own "idiosyncratic" pure build - it's the sort of thing that
will be fun to fix whenever that part of the code gets changed.
But, FWIW, I'll attach it - it's the sort of thing that will be fun
to fix whenever that part of the code gets changed.

das eine Mal als Tragödie, das andere Mal als Farce
-------------- next part --------------
 Reverts 656416c9 and 28e72501 except for the Changelog parts, which failed to apply.

 The aim is to NOT use the host compiler/headers to do am rpcgen install if
cross compiling - for LFS, we want to insulate ourselves from the host system.

diff -Naur glibc-2.16.0.orig/Makerules glibc-2.16.0/Makerules
--- glibc-2.16.0.orig/Makerules	2012-06-30 20:12:34.000000000 +0100
+++ glibc-2.16.0/Makerules	2012-08-27 02:56:32.411912202 +0100
@@ -356,11 +356,6 @@
 compile-command.c = $(compile.c) $(OUTPUT_OPTION) $(compile-mkdep-flags)
 compile-command.cc = $(compile.cc) $(OUTPUT_OPTION) $(compile-mkdep-flags)
-# Like compile-mkdep-flags, but for use with $(BUILD_CC).  We don't want to
-# track system includes here, they may spuriously trigger an install rule,
-# and would cause the check-local-headers test to fail.
-native-compile-mkdep-flags = -MMD -MP -MF $@.dt -MT $@
 # GCC can grok options after the file name, and it looks nicer that way.
 compile.c = $(CC) $< -c $(CFLAGS) $(CPPFLAGS)
 compile.cc = $(CXX) $< -c $(CXXFLAGS) $(CPPFLAGS)
diff -Naur glibc-2.16.0.orig/sunrpc/Makefile glibc-2.16.0/sunrpc/Makefile
--- glibc-2.16.0.orig/sunrpc/Makefile	2012-06-30 20:12:34.000000000 +0100
+++ glibc-2.16.0/sunrpc/Makefile	2012-08-27 02:58:31.406827581 +0100
@@ -91,7 +91,7 @@
 rpcgen-objs = rpc_main.o rpc_hout.o rpc_cout.o rpc_parse.o \
 	      rpc_scan.o rpc_util.o rpc_svcout.o rpc_clntout.o \
 	      rpc_tblout.o rpc_sample.o
-extra-objs = $(rpcgen-objs) $(addprefix cross-,$(rpcgen-objs))
+extra-objs = $(rpcgen-objs)
 others += rpcgen
 all: # Make this the default target; it will be defined in Rules.
@@ -103,12 +103,15 @@
 xtests += thrsvc
+ifeq (no,$(cross-compiling))
+# We can only build this library if we can run the rpcgen we build.
 headers += $(rpcsvc:%.x=rpcsvc/%.h)
 extra-libs := librpcsvc
 extra-libs-others := librpcsvc # Make it in `others' pass, not `lib' pass.
 librpcsvc-routines = $(rpcsvc:%.x=x%)
 librpcsvc-inhibit-o = .os # Build no shared rpcsvc library.
 omit-deps = $(librpcsvc-routines)
 ifeq (yes,$(build-shared))
 rpc-compat-routines = $(addprefix compat-,$(need-export-routines))
@@ -146,9 +149,7 @@
 CFLAGS-clnt_perr.c = -fexceptions
 CFLAGS-openchild.c = -fexceptions
 $(objpfx)tst-getmyaddr: $(common-objpfx)linkobj/libc.so
 $(objpfx)tst-xdrmem: $(common-objpfx)linkobj/libc.so
@@ -156,28 +157,13 @@
 $(objpfx)rpcgen: $(addprefix $(objpfx),$(rpcgen-objs))
-cross-rpcgen-objs := $(addprefix $(objpfx)cross-,$(rpcgen-objs))
-# When generic makefile support for build system programs is
-# available, it should replace this code.  See
-# <http://sourceware.org/bugzilla/show_bug.cgi?id=14087>.
-$(cross-rpcgen-objs): $(objpfx)cross-%.o: %.c $(before-compile)
-	$(BUILD_CC) $($(basename $(<F))-CFLAGS) $(ALL_BUILD_CFLAGS) $< \
-		$(OUTPUT_OPTION) $(native-compile-mkdep-flags) -c
-$(objpfx)cross-rpcgen: $(cross-rpcgen-objs)
-	$(BUILD_CC) $^ $(BUILD_LDFLAGS) -o $@
 # This makes sure -DNOT_IN_libc is passed for all these modules.
 cpp-srcs-left := $(rpcgen-objs:.o=.c)
 lib := nonlib
 include $(patsubst %,$(..)cppflags-iterator.mk,$(cpp-srcs-left))
-# How we run rpcgen to generate sources and headers in the rules below.
-# Setting CPP tells it how to run the C preprocessor correctly.  Note
-# that $(built-program-file) requires that the just-built cross-rpcgen
-# binary be the second dependency listed in each rule using rpcgen-cmd.
-rpcgen-cmd = CPP='$(CC) -E -x c-header' $(built-program-file) -Y ../scripts
+# Tell rpcgen where to find the C preprocessor.
+rpcgen-cmd = CPP='$(CC) -E -x c-header' $(built-program-cmd) -Y ../scripts
 # Install the rpc data base file.
 $(inst_sysconfdir)/rpc: etc.rpc $(+force)
@@ -188,7 +174,7 @@
 # relinked.
 $(rpcsvc:%.x=$(objpfx)rpcsvc/%.h): $(objpfx)rpcsvc/%.h: $(objpfx)rpcsvc/%.stmp
-$(objpfx)rpcsvc/%.stmp: rpcsvc/%.x $(objpfx)cross-rpcgen
+$(objpfx)rpcsvc/%.stmp: rpcsvc/%.x $(objpfx)rpcgen
 	- at rm -f ${@:stmp=T} $@
 	$(rpcgen-cmd) -h $< -o ${@:stmp=T}
@@ -198,7 +184,7 @@
 # Generate the rpcsvc XDR functions with rpcgen.
 $(rpcsvc:%.x=$(objpfx)x%.c): $(objpfx)x%.c: $(objpfx)x%.stmp
-$(objpfx)x%.stmp: rpcsvc/%.x $(objpfx)cross-rpcgen
+$(objpfx)x%.stmp: rpcsvc/%.x $(objpfx)rpcgen
 	- at rm -f ${@:stmp=T} $@
 	$(rpcgen-cmd) -c $< -o ${@:stmp=T}
 	$(move-if-change) $(@:stmp=T) $(@:stmp=c)
diff -Naur glibc-2.16.0.orig/sunrpc/proto.h glibc-2.16.0/sunrpc/proto.h
--- glibc-2.16.0.orig/sunrpc/proto.h	2012-06-30 20:12:34.000000000 +0100
+++ glibc-2.16.0/sunrpc/proto.h	2012-08-27 02:58:31.406827581 +0100
@@ -50,19 +50,3 @@
 void tabify(FILE *f, int tab);
 char *make_argname(const char *pname, const char *vname);
 void add_type(int len, const char *type);
-/* This header is the last one included in all rpc_*.c files,
-   so we define stuff for cross-rpcgen here to avoid conflicts with
-   $build's C library and $host's glibc.  */
-#ifdef IS_IN_build
-/* Disable translated messages when built for $build and used in
-   building glibc.  */
-#define _(X) (X)
-#define textdomain(X) ((void) 0)
-/* This is used in the definition of PACKAGE for --version output.  */
-#define _libc_intl_domainname "libc"

More information about the lfs-dev mailing list