binutils build failed when CT_STATIC_TOOLCHAIN is enabled
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/ ../libiberty/libiberty.a -lfl  -lz

   The -lfl is expanded to /usr/lib/, so the linker complain that.
I have checked the libtool script, and found that the following option
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/
     line 223:
            extra_make_flags+=("LDFLAGS=-static -all-static")
            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...
Type: text/x-diff
Size: 558 bytes
Desc: not available
URL: <>
-------------- next part --------------
For unsubscribe information see

More information about the crossgcc mailing list