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

Bug#590102: Patch for gcc-4.4-4.4.4-7 to allow a static build option



Package: gcc-4.4
Version: 4.4.4-5
Severity: wishlist
Tags: patch

Here is a simple patch for your consideration that modifies the rules
makefile for the gcc-4.4 package to allow an option to build statically
when creating a cross compiler by passing the environment variable
'BUILD_STATIC=yes' on the command line to dpkg-buildpackage.

The rationale for providing the ability to compile a statically linked
gcc-4.4 is to allow greater portability of that toolchain to 
environments other than the stock Debian environment in which the
toolchain was built.  This becomes especially interesting in the
embedded world where cross compilers (such as ones that can be created in
Debian) have long lifetimes and can be deployed to varied buildserver
enviroments to support cross compiling software for target embedded systems.
It removes the dependence on such things as having the exact correct version
of GLIBC (and other libraries) installed on the buildserver and makes
the toolchain standalone.  A static toolchain also provides the ultimate
in repeatablilty, since it does not depend on dynamically loadable modules
that can change on the build system.

I have tested this patch by using dpkg-buildpackage to build gcc-4.4
version 4.4.4-7.  The resulting binaries were not dynamic.
I have also submitted a similar patch for the binutils-2.20.51.20100710-2
package when compiling cross tools.



-- System Information:
Debian Release: squeeze/sid
  APT prefers testing
  APT policy: (500, 'testing')
Architecture: i386 (i686)

Kernel: Linux 2.6.32-5-686 (SMP w/1 CPU core)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages gcc-4.4 depends on:
ii  binutils                      2.20.1-11  The GNU assembler, linker and bina
ii  cpp-4.4                       4.4.4-5    The GNU C preprocessor
ii  gcc-4.4-base                  4.4.4-5    The GNU Compiler Collection (base 
ii  libc6                         2.11.2-2   Embedded GNU C Library: Shared lib
ii  libgcc1                       1:4.4.4-5  GCC support library
ii  libgomp1                      4.4.4-5    GCC OpenMP (GOMP) support library

Versions of packages gcc-4.4 recommends:
ii  libc6-dev                     2.11.2-2   Embedded GNU C Library: Developmen

Versions of packages gcc-4.4 suggests:
pn  gcc-4.4-doc                   <none>     (no description available)
pn  gcc-4.4-locales               <none>     (no description available)
pn  gcc-4.4-multilib              <none>     (no description available)
ii  libcloog-ppl0                 0.15.9-1   the Chunky Loop Generator (runtime
pn  libgcc1-dbg                   <none>     (no description available)
pn  libgomp1-dbg                  <none>     (no description available)
pn  libmudflap0-4.4-dev           <none>     (no description available)
pn  libmudflap0-dbg               <none>     (no description available)
ii  libppl-c2                     0.10.2-6   Parma Polyhedra Library (C interfa
ii  libppl7                       0.10.2-6   Parma Polyhedra Library (runtime l

-- no debconf information
--- gcc-4.4-4.4.4/debian/rules2.orig	2010-07-22 16:20:30.000000000 -0400
+++ gcc-4.4-4.4.4/debian/rules2	2010-07-22 15:29:15.000000000 -0400
@@ -119,6 +119,10 @@
   CFLAGS	= -g -O2
 endif
 
+ifeq ($(BUILD_STATIC),yes)
+  LDFLAGS	+= -static
+endif
+
 CFLAGS_TO_PASS = \
 	$(if $(CFLAGS),CFLAGS="$(CFLAGS)") \
 	$(if $(BOOT_CFLAGS),BOOT_CFLAGS="$(BOOT_CFLAGS)") \

Reply to: