hurd: fix for glibc install-headers target

Message ID 20150822224824.GB11514@type.dc15.debconf.org
State Committed, archived
Headers

Commit Message

Samuel Thibault Aug. 22, 2015, 10:48 p.m. UTC
  Hello,

We are having trouble with bootstrapping glibc on Debian Hurd.  To get
crt*.o, we run

/usr/bin/make cross-compiling=yes -C build-tree/hurd-i386-libc  csu/subdir_lib

At some point it gets into

> /usr/bin/make -C ../mach mach-before-compile no_deps=t generating=t

then it builds a couple of things:

> make[4]: Entering directory '/tmp/glibc-2.19/mach'
> .././scripts/mkinstalldirs /tmp/glibc-2.19/build-tree/hurd-i386-libc/csu
> mkdir -p -- /tmp/glibc-2.19/build-tree/hurd-i386-libc/csu
> echo '#include <mach/syscall_sw.h>' | \
> i586-gnu-gcc-4.8 -std=gnu99 -fgnu89-inline  -O2 -Wall -Winline -Wwrite-strings -fmerge-all-constants -frounding-math -g -pipe -Wno-parentheses -Wstrict-prototypes -mpreferred-stack-boundary=4      -isystem /tmp/glibc-2.19/debian/include  -I../include -I/tmp/glibc-2.19/build-tree/hurd-i386-libc/csu  -I/tmp/glibc-2.19/build-tree/hurd-i386-libc  -I../libpthread/sysdeps/mach/hurd/i386  -I../sysdeps/mach/hurd/i386  -I../libpthread/sysdeps/mach/hurd  -I../libpthread/sysdeps/hurd  -I../libpthread/sysdeps/pthread  -I../sysdeps/pthread  -I../sysdeps/mach/hurd  -I../sysdeps/gnu  -I../sysdeps/unix/bsd  -I../sysdeps/unix/inet  -I../sysdeps/../libpthread/sysdeps/generic  -I../libpthread/sysdeps/mach/i386  -I../sysdeps/mach/i386  -I../libpthread/sysdeps/mach  -I../sysdeps/mach  -I../sysdeps/i386/i586  -I../sysdeps/i386/i486  -I../sysdeps/i386/fpu  -I../sysdeps/x86/fpu  -I../libpthread/sysdeps/i386  -I../sysdeps/i386  -I../sysdeps/x86  -I../sysdeps/wordsize-32  -I../sysdeps/ieee754/ldbl-96  -I../sysdeps/ieee754/dbl-64  -I../sysdeps/ieee754/flt-32  -I../sysdeps/unix  -I../sysdeps/posix  -I../libpthread/sysdeps/posix  -I../sysdeps/ieee754  -I../sysdeps/generic  -I../libpthread/include -I../libpthread -I../hurd -I/tmp/glibc-2.19/build-tree/hurd-i386-libc/hurd/ -I../mach -I/tmp/glibc-2.19/build-tree/hurd-i386-libc/mach/ -I.. -I../libio -I. -nostdinc -isystem /usr/lib/gcc/i586-gnu/4.8/include -isystem /usr/lib/gcc/i586-gnu/4.8/include-fixed -isystem /tmp/glibc-2.19/debian/include -I../libpthread/include  -D_LIBC_REENTRANT -include ../include/libc-symbols.h       -E -MD -MP -MF /tmp/glibc-2.19/build-tree/hurd-i386-libc/csu/mach-syscalls.mk-dep -MT /tmp/glibc-2.19/build-tree/hurd-i386-libc/csu/mach-syscalls.mk \
>       -x c-header - \
>       -D_MACH_`echo i386 | tr a-z A-Z`_SYSCALL_SW_H_=1 | \
> sed -n -e 's/^kernel_trap(\(.*\),\([-0-9]*\),\([0-9]*\))$/\1 \2 \3/p'\
> | gawk -f syscalls.awk > /tmp/glibc-2.19/build-tree/hurd-i386-libc/csu/mach-syscalls.mk-new
> sed -e 's@ /tmp/glibc-2\.19/build-tree/hurd-i386-libc/@ $(common-objpfx)@g' -e 's@^/tmp/glibc-2\.19/build-tree/hurd-i386-libc/@$(common-objpfx)@g' /tmp/glibc-2.19/build-tree/hurd-i386-libc/csu/mach-syscalls.mk-dep >> /tmp/glibc-2.19/build-tree/hurd-i386-libc/csu/mach-syscalls.mk-new
> rm -f /tmp/glibc-2.19/build-tree/hurd-i386-libc/csu/mach-syscalls.mk-dep
> mv -f /tmp/glibc-2.19/build-tree/hurd-i386-libc/csu/mach-syscalls.mk-new /tmp/glibc-2.19/build-tree/hurd-i386-libc/csu/mach-syscalls.mk
> /usr/bin/make -C ../mach mach-before-compile no_deps=t generating=t
> make[5]: Entering directory '/tmp/glibc-2.19/mach'
> /usr/bin/make -C ../mach mach-before-compile no_deps=t generating=t
> make[6]: Entering directory '/tmp/glibc-2.19/mach'

and this goes on at infinitum. Make -d shows that it is trying to build
/tmp/glibc-2.19/build-tree/hurd-i386-libc/mach/mach-shortcuts.h
and adding a $(warning) shows that the generated mach-shortcuts.h rule
is for /tmp/glibc-2.19/build-tree/hurd-i386-libc/csu/mach-shortcuts.h
(in csu/ instead of mach/).  AIUI, the patch below would be needed to
fix the objpfx so that the proper rule is generated, isn't it?

Samuel
  

Comments

Andreas Schwab Aug. 23, 2015, 6:54 a.m. UTC | #1
Samuel Thibault <samuel.thibault@gnu.org> writes:

> and this goes on at infinitum. Make -d shows that it is trying to build
> /tmp/glibc-2.19/build-tree/hurd-i386-libc/mach/mach-shortcuts.h
> and adding a $(warning) shows that the generated mach-shortcuts.h rule
> is for /tmp/glibc-2.19/build-tree/hurd-i386-libc/csu/mach-shortcuts.h
> (in csu/ instead of mach/).  AIUI, the patch below would be needed to
> fix the objpfx so that the proper rule is generated, isn't it?

The first thing mach/Makefile does is subdir := mach.  Why is that not
sufficient?

Andreas.
  
Samuel Thibault Aug. 24, 2015, 11:39 p.m. UTC | #2
Hello,

Andreas Schwab, le Sun 23 Aug 2015 08:54:31 +0200, a écrit :
> Samuel Thibault <samuel.thibault@gnu.org> writes:
> > and this goes on at infinitum. Make -d shows that it is trying to build
> > /tmp/glibc-2.19/build-tree/hurd-i386-libc/mach/mach-shortcuts.h
> > and adding a $(warning) shows that the generated mach-shortcuts.h rule
> > is for /tmp/glibc-2.19/build-tree/hurd-i386-libc/csu/mach-shortcuts.h
> > (in csu/ instead of mach/).  AIUI, the patch below would be needed to
> > fix the objpfx so that the proper rule is generated, isn't it?
> 
> The first thing mach/Makefile does is subdir := mach.  Why is that not
> sufficient?

Because calling

/usr/bin/make cross-compiling=yes -C build-tree/hurd-i386-libc  csu/subdir_lib 

results to calling

/usr/bin/make  subdir=csu -C csu ..=../ subdir_lib

and that subdir=csu will override any subdir:=

Samuel
  
Andreas Schwab Aug. 25, 2015, 7:23 a.m. UTC | #3
Why does install-headers depend on crt*.o?  That appears to be the
regression to fix.

Andreas.
  
Samuel Thibault Aug. 25, 2015, 7:37 a.m. UTC | #4
Andreas Schwab, le Tue 25 Aug 2015 09:23:40 +0200, a écrit :
> Why does install-headers depend on crt*.o?

Ah, sorry, I wasn't clear about it.  It does not, it's the bootstrapping
process of debian which uses both install-headers and builds the crt*.o
files so that gcc can start linking basic stuff.

Samuel
  

Patch

diff --git a/sysdeps/mach/Makefile b/sysdeps/mach/Makefile
index b47cdc6..3323e81 100644
--- a/sysdeps/mach/Makefile
+++ b/sysdeps/mach/Makefile
@@ -43,7 +43,7 @@  ifneq (mach,$(subdir))
 # This patsubst generates patterns like `m%h-shortcuts.h', which are damn
 # likely to match just the corresponding particular file we want.
 $(patsubst mach%,m\%h%,$(mach-before-compile)): # Run only if doesn't exist.
-	$(MAKE) -C $(..)mach mach-before-compile no_deps=t generating=t
+	$(MAKE) -C $(..)mach subdir=mach mach-before-compile no_deps=t generating=t
 
 before-compile += $(mach-before-compile)
 endif
diff --git a/sysdeps/mach/hurd/Makefile b/sysdeps/mach/hurd/Makefile
index b528815..244ac4b 100644
--- a/sysdeps/mach/hurd/Makefile
+++ b/sysdeps/mach/hurd/Makefile
@@ -48,13 +48,13 @@  hurd-objpfx = $(common-objpfx)hurd/
 before-compile += $(patsubst %,$(hurd-objpfx)hurd/%.h,auth io fs process)
 $(patsubst %,$(hurd-objpfx)hurd/%.%,auth io fs process): \
   $(common-objpfx)mach/mach-shortcuts.h
-	$(MAKE) -C $(..)hurd before-compile no_deps=t
+	$(MAKE) -C $(..)hurd subdir=hurd before-compile no_deps=t
 endif
 
 # Hurd profil.c includes this file, so give a rule to make it.
 ifeq ($(subdir),gmon)
 $(common-objpfx)hurd/../mach/RPC_task_get_sampled_pcs.c:
-	$(MAKE) -C $(..)mach before-compile no_deps=t
+	$(MAKE) -C $(..)mach subdir=mach before-compile no_deps=t
 endif