Mike Frysinger wrote:
On Friday 18 May 2007, Yann E. MORIN wrote:
So, to build a cross-toolchain with uClibc, we need, in order:

no

the only header that gets generated is bits/sysnum.h and the only thing that uses that is syscall.h ... which gcc doesnt use, so it isnt really too much of an issue ...
Hi Mike,
I'd like to come back to this issue because I've fallen in the same problem while trying to build from scratch
a cross gcc (for SH4).
Currently the 'headers' target cannot be used for the reason that it tries to compile something with a HOST compiler
using CPU_FLAGS (the same issue Yann Morin reported)
According to Paul Brook suggestion to split the 'headers' target on Makefile, and following your note about the pointless
generation of sysnum.h for the gcc build purpose,
I'd like to suggest a fix into uClibc/Makefile.in that consist into splitting the 'headers' target into three parts:

headers-sysnum  -> producing the sysnum.h

headers: creating the symlinks from include/sys include/bits to the arch specific header files -> This used to build gcc bootstrap

headers-extra: any other headers target (i.e. locale)

To have a uclibc-bootstrap headers just we can use (after configuring the uClibc)
make headers
make PREFIX=<wherever you like> install_headers

My patch is just for reference because it includes also the nptl part.
If it is ok, I can do a cleanup a post a new one synchronized with trunk.
so the normal order is fine:
 - build/install binutils
 - install uClibc headers
 - install kernel headers
 - build C-only gcc
 - build/install uClibc
 - build C/C++/whatever gcc

glibc is the same way
I had a look at the glibc and I noted that during the install-headers stage, glibc use the host gcc without passing any of arch specific flags (it uses the asm_CPP macro), this is why it doesn't fail.
-mike
------------------------------------------------------------------------

_______________________________________________
uClibc mailing list
[email protected]
http://busybox.net/cgi-bin/mailman/listinfo/uclibc

--- uClibc-nptl-svn_r17694/Makefile.in  2007-02-16 11:50:47.669900000 +0100
+++ uClibc-nptl/Makefile.in     2007-07-10 12:07:47.514867000 +0200
@@ -53,6 +53,21 @@ endif
 HEADERS_BITS_COMMON := $(notdir $(wildcard 
$(top_srcdir)libc/sysdeps/linux/common/bits/*.h))
 HEADERS_BITS_ARCH   := $(notdir $(wildcard 
$(top_srcdir)libc/sysdeps/linux/$(TARGET_ARCH)/bits/*.h))
 HEADERS_BITS_COMMON := $(filter-out 
$(HEADERS_BITS_ARCH),$(HEADERS_BITS_COMMON))
+
+headers-sysnum: include/bits/sysnum.h
+       $(Q)\
+       set -e; \
+       cd $(top_builddir); \
+       tmp=`mktemp include/bits/sysnum.h.XXXXXX 2>/dev/null`; \
+       [ -z "$$tmp" ] && tmp='include/bits/sysnum.h.new'; \
+       KERNEL_HEADERS="${KERNEL_HEADERS}" top_builddir=. CC="$(CC) 
$(CPU_CFLAGS)" $(SHELL) extra/scripts/gen_bits_syscall_h.sh > $$tmp; \
+       if cmp include/bits/sysnum.h $$tmp >/dev/null 2>&1; then \
+               $(RM) $$tmp; \
+       else \
+       mv -f $$tmp include/bits/sysnum.h; \
+       fi
+
+
 headers: include/bits/uClibc_config.h
        $(Q)$(MAKE) headers-y
        $(Q)\
@@ -85,29 +100,24 @@ headers: include/bits/uClibc_config.h
                        $(LN) -fs $$i .; \
                done; \
        fi
-       $(Q)\
-       set -e; \
-       cd $(top_builddir); \
-       tmp=`mktemp include/bits/sysnum.h.XXXXXX 2>/dev/null`; \
-       [ -z "$$tmp" ] && tmp='include/bits/sysnum.h.new'; \
-       KERNEL_HEADERS="${KERNEL_HEADERS}" top_builddir=. CC="$(CC) 
$(CPU_CFLAGS)" $(SHELL) extra/scripts/gen_bits_syscall_h.sh > $$tmp; \
-       if cmp include/bits/sysnum.h $$tmp >/dev/null 2>&1; then \
-               $(RM) $$tmp; \
-       else \
-               mv -f $$tmp include/bits/sysnum.h; \
-       fi
-ifeq ($(UCLIBC_HAS_LOCALE),y)
-       $(MAKE) locale_headers
-endif
 ifeq ($(UCLIBC_HAS_THREADS_NATIVE),y)
-       $(MAKE) nptl_headers
- ifeq ($(shell $(CC) --help >& /dev/null && echo yes),yes)
-       $(MAKE) nptl_arch_headers
-       $(MAKE) nptl_linux_headers
- endif
-endif
+           $(MAKE) nptl_headers
+endif          
+
+
+headers-extra:
+    ifeq ($(UCLIBC_HAS_LOCALE),y)
+           $(MAKE) locale_headers
+    endif
+    ifeq ($(UCLIBC_HAS_THREADS_NATIVE),y)
+               $(MAKE) nptl_headers_extra
+        ifeq ($(shell $(CC) --help >& /dev/null && echo yes),yes)
+                   $(MAKE) nptl_arch_headers
+                   $(MAKE) nptl_linux_headers
+        endif
+    endif
 
-pregen: headers
+pregen: headers headers-sysnum headers-extra
 
 install: install_runtime install_dev
 
--- uClibc-nptl-svn_r17694/libpthread/nptl/Makefile.in  2007-02-16 
11:50:43.979855000 +0100
+++ uClibc-nptl/libpthread/nptl/Makefile.in     2007-07-10 11:52:22.760601000 
+0200
@@ -305,6 +305,8 @@ nptl_headers:
        $(LN) -sf 
../../$(PTDIR)/sysdeps/unix/sysv/linux/$(TARGET_ARCH)/bits/pthreadtypes.h 
$(top_builddir)include/bits/
        $(LN) -sf ../../$(PTDIR)/sysdeps/pthread/bits/libc-lock.h 
$(top_builddir)include/bits/
        $(LN) -sf ../../$(PTDIR)/sysdeps/pthread/bits/stdio-lock.h 
$(top_builddir)include/bits/
+
+nptl_headers_extra:
 ifeq ($(shell $(CC) --help >& /dev/null && echo yes),yes)
        $(MAKE) $(PTHREAD_OUT)/pthread-errnos.h
 endif
_______________________________________________
uClibc mailing list
[email protected]
http://busybox.net/cgi-bin/mailman/listinfo/uclibc

Reply via email to