[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#431086: please support reverse cross build



Package: gcc-4.2
Version: 4.2-20070627-1
Severity: normal
Tags: patch

On Thu, 28 Jun 2007 14:47:55 +0200
Martin Michlmayr <tbm@cyrius.com> wrote:

> Throughout the development of GCC 4.2, we regularly recompiled the
> entire Debian archive with development snapshots of GCC to make sure
> that we'd end up with a reliable compiler.  We have done regular
> rebuilds on IA64 and AMD64, and we have tested almost every
> architecture at some point during the development phase of 4.2 (the
> exception being hppa and m68k, as well as non-Linux platforms).  We
> now have a compiler with relatively few known issues.

One issue that arose during DebConf7 relates to an upstream behaviour of
gcc that is not working inside the debian packaging code.

Emdebian has been building cross-compiler toolchains for some time but
in order to be able to build all Emdebian packages from source, we need
to be able to cross build gcc, not to provide a cross compiler but to
provide some core libraries - specifically libgcc1 and libstsdc++6-foo
- cross built for a different host.

e.g.
Build=amd64|i386|powerpc
Host=arm
Target=arm

compared to
build=amd64|i386|powerpc
host=amd64|i386|powerpc
target=arm
for a standard cross-compiler.

As host==target this isn't a full canadian cross, more of a reverse
cross.

A normal arm-linux-gnu-gcc etc. toolchain is used to build these
packages.

The attached patches to debian/rules.defs and debian/rules2 provide
support for these builds as well as outline support for a full canadian
cross build.


--- System information. ---
Architecture: amd64
Kernel:       Linux 2.6.21-1-amd64

Debian Release: lenny/sid
  500 unstable        www.linux.codehelp.co.uk 
  500 unstable        www.emdebian.org 
  500 unstable        ftp.uk.debian.org 

--- Package information. ---
Depends                      (Version) | Installed
======================================-+-======================
gcc-4.2-base        (= 4.2-20070627-1) | 4.2-20070627-1
cpp-4.2             (= 4.2-20070627-1) | 4.2-20070627-1
binutils          (>= 2.17cvs20070426) | 2.17cvs20070426-8
libgcc1          (>= 1:4.2-20070627-1) | 1:4.2-20070627-1
libgomp1           (>= 4.2-20070627-1) | 4.2-20070627-1
libc6                       (>= 2.5-5) | 2.5-11




-- 


Neil Williams
=============
http://www.data-freedom.org/
http://www.nosoftwarepatents.com/
http://www.linux.codehelp.co.uk/

--- gcc-4.2.old/debian/rules.defs	2007-06-29 12:34:25.000000000 +0100
+++ gcc-4.2.cross/debian/rules.defs	2007-06-29 16:10:04.000000000 +0100
@@ -66,6 +66,28 @@
 endif
 
 # ---------------------------------------------------------------------------
+# full canadian
+# typical cross-compiler
+# reverse cross (built to run on the target)
+# native
+#
+# build != host && host == target : reverse cross (REVERSE_CROSS == yes)
+# build == host && host != target : typical cross (DEB_CROSS == yes)
+# build != host && host != target : canadian (DEB_CROSS == yes)
+# build == host && host == target : native
+ifneq ($(DEB_BUILD_GNU_TYPE), $(DEB_HOST_GNU_TYPE))
+ ifneq ($(DEB_HOST_GNU_TYPE), $(DEB_TARGET_GNU_TYPE))
+	DEB_CROSS = yes
+ else
+ 	REVERSE_CROSS = yes
+ endif
+ else
+ ifneq ($(DEB_HOST_GNU_TYPE), $(DEB_TARGET_GNU_TYPE))
+	DEB_CROSS = yes
+ endif  
+endif
+
+# ---------------------------------------------------------------------------
 # which binary packages are built?
 
 # cross compiler support. If GCC_TARGET is set, then it's the architecture
@@ -75,8 +97,7 @@
 $(error GCC_TARGET value "$(GCC_TARGET)" is not a valid Debian architecture)
 endif
 
-ifneq ($(DEB_HOST_GNU_TYPE),$(DEB_TARGET_GNU_TYPE))
-  DEB_CROSS = yes
+ifdef DEB_CROSS
   # TP: Target Prefix. Used primarily as a prefix for cross tool
   #     names (e.g. powerpc-linux-gcc).
   # TS: Target Suffix. Used primarily at the end of cross compiler
@@ -700,6 +721,9 @@
 ifdef DEB_CROSS
   with_check := disabled for cross compiler package
 endif
+ifdef REVERSE_CROSS
+  with_check := disabled for reverse cross build
+endif
 check_no_systems := hurd-i386
 ifneq (, $(filter $(DEB_TARGET_GNU_SYSTEM),$(check_no_systems)))
   with_check := disabled for $(DEB_TARGET_GNU_SYSTEM)
--- gcc-4.2.old/debian/rules2	2007-06-29 12:34:25.000000000 +0100
+++ gcc-4.2.cross/debian/rules2	2007-06-29 16:03:57.000000000 +0100
@@ -535,7 +535,9 @@
 $(build_stamp): $(configure_stamp) $(build_locale_stamp)
 	dh_testdir
 	rm -f bootstrap-protocol
+# DEB_CROSS is never set if REVERSE_CROSS is set and vice-versa.
 ifndef DEB_CROSS
+ifndef REVERSE_CROSS
   ifeq ($(with_java),yes)
     ifeq ($(with_native_ecj),yes)
 	: # prepare the standalone ecj jar
@@ -608,6 +610,7 @@
 	) 2>&1 | tee bootstrap-protocol
 	s=`cat status`; rm -f status; test $$s -eq 0
 endif
+endif
 	-chmod 755 $(srcdir)/contrib/warn_summary
 	if [ -x $(srcdir)/contrib/warn_summary ]; then \
 	  rm -f bootstrap-summary; \

Attachment: pgpTMHNwi45jE.pgp
Description: PGP signature


Reply to: