public inbox for crossgcc@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] Add zlib in case host's version is too old.
@ 2012-02-10 11:53 Johannes Stezenbach
  2012-02-13 20:24 ` Yann E. MORIN
  0 siblings, 1 reply; 3+ messages in thread
From: Johannes Stezenbach @ 2012-02-10 11:53 UTC (permalink / raw)
  To: crossgcc; +Cc: Yann E. MORIN

zlib is used by both binutils and gdb and the build fails
on hosts which have a really old zlib version.
(gcc has its own zlib included)

Signed-off-by: Johannes Stezenbach <js@sig21.net>

diff -r e0d70cf2b396 -r cc5137ade317 config/companion_libs.in
--- a/config/companion_libs.in	Thu Feb 09 13:09:08 2012 +0100
+++ b/config/companion_libs.in	Fri Feb 10 12:14:16 2012 +0100
@@ -94,6 +94,19 @@
 source "config/companion_libs/libelf.in"
 endif
 
+config ZLIB
+    bool
+    prompt "zlib"
+    help
+      While gcc comes with its own zlib version, both binutils
+      and gdb use the zlib provided by the build host, which is
+      usually OK. Select this if the zlib on the build host is
+      really, really old.
+
+config ZLIB_VERSION
+    string
+    default "1.2.5"
+
 config FOO
     bool
 
diff -r e0d70cf2b396 -r cc5137ade317 scripts/build/binutils/binutils.sh
--- a/scripts/build/binutils/binutils.sh	Thu Feb 09 13:09:08 2012 +0100
+++ b/scripts/build/binutils/binutils.sh	Fri Feb 10 12:14:16 2012 +0100
@@ -74,6 +74,7 @@
     CT_DoExecLog CFG                                            \
     CFLAGS="${CT_CFLAGS_FOR_HOST}"                              \
     CXXFLAGS="${CT_CFLAGS_FOR_HOST}"                            \
+    CPPFLAGS="-I${CT_COMPLIBS_DIR}/include"                     \
     "${CT_SRC_DIR}/binutils-${CT_BINUTILS_VERSION}/configure"   \
         --build=${CT_BUILD}                                     \
         --host=${CT_HOST}                                       \
@@ -86,9 +87,11 @@
         "${CT_BINUTILS_EXTRA_CONFIG_ARRAY[@]}"
 
     if [ "${CT_STATIC_TOOLCHAIN}" = "y" ]; then
-        extra_make_flags+=("LDFLAGS=-static -all-static")
+        extra_make_flags+=("LDFLAGS=-static -all-static -L${CT_COMPLIBS_DIR}/lib")
         CT_DoLog EXTRA "Prepare binutils for static build"
         CT_DoExecLog ALL make ${JOBSFLAGS} configure-host
+    else
+        extra_make_flags+=("LDFLAGS=-L${CT_COMPLIBS_DIR}/lib")
     fi
 
     CT_DoLog EXTRA "Building binutils"
diff -r e0d70cf2b396 -r cc5137ade317 scripts/build/companion_libs/zlib.sh
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/build/companion_libs/zlib.sh	Fri Feb 10 12:14:16 2012 +0100
@@ -0,0 +1,45 @@
+# Build script for zlib
+
+do_zlib_get() { :; }
+do_zlib_extract() { :; }
+do_zlib() { :; }
+
+if [ "${CT_ZLIB}" = "y" ]; then
+
+do_zlib_get() {
+    CT_GetFile "zlib-${CT_ZLIB_VERSION}" http://zlib.net/
+}
+
+do_zlib_extract() {
+    CT_Extract "zlib-${CT_ZLIB_VERSION}"
+    CT_Patch "zlib" "${CT_ZLIB_VERSION}"
+}
+
+do_zlib() {
+    CT_DoStep INFO "Installing zlib"
+    mkdir -p "${CT_BUILD_DIR}/build-zlib"
+    CT_Pushd "${CT_BUILD_DIR}/build-zlib"
+
+    CT_DoLog EXTRA "Configuring zlib"
+
+    # zlib has non-standard configure which only works in the src tree
+    CT_DoExecLog ALL                                        \
+    cp -al ${CT_SRC_DIR}/zlib-${CT_ZLIB_VERSION}/* .
+
+    CT_DoExecLog CFG                                        \
+    CC="${CT_HOST}-gcc"                                     \
+    AR="${CT_HOST}-ar"                                      \
+    "./configure" --prefix="${CT_COMPLIBS_DIR}" --static
+
+    CT_DoLog EXTRA "Building zlib"
+    CT_DoExecLog ALL make
+
+    CT_DoLog EXTRA "Installing zlib"
+    CT_DoExecLog ALL cp libz.a ${CT_COMPLIBS_DIR}/lib/
+    CT_DoExecLog ALL cp zlib.h zconf.h ${CT_COMPLIBS_DIR}/include/
+
+    CT_Popd
+    CT_EndStep
+}
+
+fi # CT_ZLIB
diff -r e0d70cf2b396 -r cc5137ade317 scripts/build/debug/300-gdb.sh
--- a/scripts/build/debug/300-gdb.sh	Thu Feb 09 13:09:08 2012 +0100
+++ b/scripts/build/debug/300-gdb.sh	Fri Feb 10 12:14:16 2012 +0100
@@ -143,6 +143,8 @@
         CT_DoExecLog CFG                                \
         CC="${CC_for_gdb}"                              \
         LD="${LD_for_gdb}"                              \
+        CPPFLAGS="-I${CT_COMPLIBS_DIR}/include"         \
+        LDFLAGS="-L${CT_COMPLIBS_DIR}/lib"              \
         "${gdb_cross_configure}"                        \
             --build=${CT_BUILD}                         \
             --host=${CT_HOST}                           \
diff -r e0d70cf2b396 -r cc5137ade317 scripts/crosstool-NG.sh.in
--- a/scripts/crosstool-NG.sh.in	Thu Feb 09 13:09:08 2012 +0100
+++ b/scripts/crosstool-NG.sh.in	Fri Feb 10 12:14:16 2012 +0100
@@ -121,6 +121,7 @@
 . "${CT_LIB_DIR}/scripts/build/companion_libs/cloog.sh"
 . "${CT_LIB_DIR}/scripts/build/companion_libs/mpc.sh"
 . "${CT_LIB_DIR}/scripts/build/companion_libs/libelf.sh"
+. "${CT_LIB_DIR}/scripts/build/companion_libs/zlib.sh"
 . "${CT_LIB_DIR}/scripts/build/binutils/binutils.sh"
 . "${CT_LIB_DIR}/scripts/build/binutils/elf2flt.sh"
 . "${CT_LIB_DIR}/scripts/build/binutils/sstrip.sh"
@@ -531,6 +532,7 @@
     do_cloog_get
     do_mpc_get
     do_libelf_get
+    do_zlib_get
     do_binutils_get
     do_elf2flt_get
     do_sstrip_get
@@ -561,6 +563,7 @@
         do_cloog_extract
         do_mpc_extract
         do_libelf_extract
+        do_zlib_extract
         do_binutils_extract
         do_elf2flt_extract
         do_sstrip_extract
diff -r e0d70cf2b396 -r cc5137ade317 scripts/showSamples.sh
--- a/scripts/showSamples.sh	Thu Feb 09 13:09:08 2012 +0100
+++ b/scripts/showSamples.sh	Fri Feb 10 12:14:16 2012 +0100
@@ -75,6 +75,7 @@
             [ -z "${CT_CLOOG}"  -a -z "${CT_CLOOG_TARGET}"  ] || printf " cloog-ppl-%s" "${CT_CLOOG_VERSION}"
             [ -z "${CT_MPC}"    -a -z "${CT_MPC_TARGET}"    ] || printf " mpc-%s"       "${CT_MPC_VERSION}"
             [ -z "${CT_LIBELF}" -a -z "${CT_LIBELF_TARGET}" ] || printf " libelf-%s"    "${CT_LIBELF_VERSION}"
+            [ -z "${CT_ZLIB}" ] || printf " zlib-%s"    "${CT_ZLIB_VERSION}"
             [ -z "${complibs}"  ] || printf "\n"
             printf  "    %-*s : %s\n" ${t_width} "binutils" "binutils-${CT_BINUTILS_VERSION}"
             printf  "    %-*s : %s" ${t_width} "C compiler" "${CT_CC}-${CT_CC_VERSION} (C"
diff -r e0d70cf2b396 -r cc5137ade317 steps.mk
--- a/steps.mk	Thu Feb 09 13:09:08 2012 +0100
+++ b/steps.mk	Fri Feb 10 12:14:16 2012 +0100
@@ -23,6 +23,7 @@
             cloog               \
             mpc                 \
             libelf              \
+            zlib                \
             binutils            \
             elf2flt             \
             sstrip              \

--
For unsubscribe information see http://sourceware.org/lists.html#faq

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] Add zlib in case host's version is too old.
  2012-02-10 11:53 [PATCH] Add zlib in case host's version is too old Johannes Stezenbach
@ 2012-02-13 20:24 ` Yann E. MORIN
  2012-02-14 12:58   ` Johannes Stezenbach
  0 siblings, 1 reply; 3+ messages in thread
From: Yann E. MORIN @ 2012-02-13 20:24 UTC (permalink / raw)
  To: crossgcc; +Cc: Johannes Stezenbach

Johannes, All,

On Friday 10 February 2012 12:53:10 Johannes Stezenbach wrote:
> Add zlib in case host's version is too old.

There's already a zlib patch on the list, which I've been sitting on for
a bit of time now:
  http://sourceware.org/ml/crossgcc/2011-11/msg00149.html

I've been reluctant to add this as-is (gut-feelings...) because I do not
want crosstool-NG to become a build-all-and-every-thing bloatware without
due thinking.

Especially, the reason ivoked was for portability of the toolchain. This
would have been solved by statically linking the toolchain, which would
have pulled the host's static zlib, and thus the toolchain owuld be portable.
But just building our own seemed a bit overkill...

> zlib is used by both binutils and gdb and the build fails
> on hosts which have a really old zlib version.

This is a very good reason we might want to build our own zlib (the same
reason we do build the other complibs).

Out of curiosity, what host is that?

> (gcc has its own zlib included)

Would it be feasible to have gcc use our own version instead of its bundled
one? Zhenqiang said gcc's build would break in this case [1], but I would
like hard facts why it's not possible.
  [1] http://sourceware.org/ml/crossgcc/2011-11/msg00147.html

Also, I have some stuff pending that touches the way companion libraries are
handled, so I will post-pone this patch for a little bit...

Thank you!

Regards,
Yann E. MORIN.

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'

--
For unsubscribe information see http://sourceware.org/lists.html#faq

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] Add zlib in case host's version is too old.
  2012-02-13 20:24 ` Yann E. MORIN
@ 2012-02-14 12:58   ` Johannes Stezenbach
  0 siblings, 0 replies; 3+ messages in thread
From: Johannes Stezenbach @ 2012-02-14 12:58 UTC (permalink / raw)
  To: Yann E. MORIN; +Cc: crossgcc

Hi Yann,

On Mon, Feb 13, 2012 at 09:24:13PM +0100, Yann E. MORIN wrote:
> On Friday 10 February 2012 12:53:10 Johannes Stezenbach wrote:
> > Add zlib in case host's version is too old.
> 
> There's already a zlib patch on the list, which I've been sitting on for
> a bit of time now:
>   http://sourceware.org/ml/crossgcc/2011-11/msg00149.html

Oh, I should've paid more attention to the list...
In this case please drop my patch, I'll drop it
too and use the linaro patches.

> I've been reluctant to add this as-is (gut-feelings...) because I do not
> want crosstool-NG to become a build-all-and-every-thing bloatware without
> due thinking.
> 
> Especially, the reason ivoked was for portability of the toolchain. This
> would have been solved by statically linking the toolchain, which would
> have pulled the host's static zlib, and thus the toolchain owuld be portable.
> But just building our own seemed a bit overkill...
> 
> > zlib is used by both binutils and gdb and the build fails
> > on hosts which have a really old zlib version.
> 
> This is a very good reason we might want to build our own zlib (the same
> reason we do build the other complibs).
> 
> Out of curiosity, what host is that?

In my case I'm trying to build a toolchain which works on every
machine in a large, heterogenous network.  Some machines run
"Red Hat Enterprise Linux WS release 3" (2.4.21-37.ELsmp)
and are kept around for some old tools from IP vendors used in chip design.

I can build a static toolchain on my Debian sid host just fine,
but it won't run on the old RedHat because glibc complains
"kernel too old" (sigh).  I'm not sure how to solve this other than
by building on the oldest machine.  Note that the host gcc on
this old machine is too old to compile a new cross gcc which
means I have to compile a new host gcc (and a bunch of other tools) first...


> > (gcc has its own zlib included)
> 
> Would it be feasible to have gcc use our own version instead of its bundled
> one? Zhenqiang said gcc's build would break in this case [1], but I would
> like hard facts why it's not possible.
>   [1] http://sourceware.org/ml/crossgcc/2011-11/msg00147.html
>
> Also, I have some stuff pending that touches the way companion libraries are
> handled, so I will post-pone this patch for a little bit...

No problem, I just posted the patch because I'm using it.


Thanks,
Johannes

--
For unsubscribe information see http://sourceware.org/lists.html#faq

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-02-14 12:58 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-02-10 11:53 [PATCH] Add zlib in case host's version is too old Johannes Stezenbach
2012-02-13 20:24 ` Yann E. MORIN
2012-02-14 12:58   ` Johannes Stezenbach

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).