binutils build failed when CT_STATIC_TOOLCHAIN is enabled

goodmenlinux@gmail.com goodmenlinux@gmail.com
Wed Jun 18 07:48:00 GMT 2014


Hi, all

   I want a static toolchain (to copy and use it anywhere).
But failed when build the binutils:
    ct-ng binutils_for_host:

    It need flex static libs. On my machine, flex only has shared libs, so I 
tried to build a static lib manually (Why not include the flex in the "Companion tools"?)

    After that step, binutils keeps failed to built:
It has something to do with libtool. I spend some time to find the root cause, and here is
my discovering:

    The cmdline to build the ranlib is:
/bin/sh ./libtool --tag=CC   --mode=link ../../../buildtools/bin/x86_64-build_unknown-linux-gnu-gcc -W -Wall -Wstrict-prototypes -Wmissing-prototypes -Wshadow -O2 -g -pipe   -static-libstdc++ -static-libgcc -static -all-static -o ranlib ar.o is-ranlib.o arparse.o arlex.o arsup.o rename.o binemul.o emul_vanilla.o bucomm.o version.o filemode.o ../bfd/libbfd.la ../libiberty/libiberty.a -lfl  -lz

   The -lfl is expanded to /usr/lib/libfl.so, so the linker complain that.
I have checked the libtool script, and found that the following option
      -all-static
      -static
      -static-libtool-libs
is processed in a strange way. If any one of those three option appears firstly in the cmdline, all others
will be neglected. Our LDFLAGS is ".... -static -all-static -o", so the -static option takes the real effect,
and the -all-static has no useage actually! that is the cause of the failure.

     I have changed the /usr/lib/ct-ng.hg+default-99029fac116b/scripts/build/binutils/binutils.sh
     line 223:
            extra_make_flags+=("LDFLAGS=-static -all-static")
     to 
            extra_make_flags+=("LDFLAGS=-all-static -static")

And the binutils built OK.

The patch is attached for the maintainer for reference.

Thanks for all the maintainers and hackers!


-------------- next part --------------
A non-text attachment was scrubbed...
Name: binutils.sh.patch
Type: text/x-diff
Size: 558 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/crossgcc/attachments/20140618/d5363b3f/attachment.bin>
-------------- next part --------------
--
For unsubscribe information see http://sourceware.org/lists.html#faq


More information about the crossgcc mailing list