From patchwork Wed Jun 18 07:47:54 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yi Zheng X-Patchwork-Id: 361326 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 8AA64140087 for ; Wed, 18 Jun 2014 17:48:30 +1000 (EST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:date:from:to:subject:message-id:mime-version :content-type; q=dns; s=default; b=c0EsKQ6Ii6BGqKS5uEqwzcbtcGuDH yTHtAJy2gpYwoDwU6Tk6bMJ1/KB3VDIl3Q0qIV7KI5yx8XjRPk/U0TW1p9f5JoWb J1kPxGCjjqxkJouv2GKSbLCmxTGt89cR8meSpyzO+e1ZsD0ymvfayPtI3ArqbY5D g6s6F/F2Lze0Zw= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:date:from:to:subject:message-id:mime-version :content-type; s=default; bh=OgLsLIXa43NDwDhr0d4jrlhV10k=; b=a7U yYHxt5o78Ap5n2XMDwFinTRLek8yNpAXXc9Yjabpfy4ICi792VGXflsrJq6eslLY 8MeDBwBNOqhFh663zNW5aVNLcsyR7WxfWDJUrO019FQaDYqinxjn0VcI4ZJ0gBD+ Q8NiBDsiZwu5DkTdPr9HsR/Q1XB6vfkThcEjZkKk= Received: (qmail 5560 invoked by alias); 18 Jun 2014 07:48:23 -0000 Mailing-List: contact crossgcc-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: crossgcc-owner@sourceware.org Delivered-To: mailing list crossgcc@sourceware.org Received: (qmail 5539 invoked by uid 89); 18 Jun 2014 07:48:19 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.5 required=5.0 tests=BAYES_05, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-pd0-f178.google.com Received: from mail-pd0-f178.google.com (HELO mail-pd0-f178.google.com) (209.85.192.178) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Wed, 18 Jun 2014 07:48:12 +0000 Received: by mail-pd0-f178.google.com with SMTP id r10so438184pdi.9 for ; Wed, 18 Jun 2014 00:48:11 -0700 (PDT) X-Received: by 10.68.99.194 with SMTP id es2mr460829pbb.100.1403077691139; Wed, 18 Jun 2014 00:48:11 -0700 (PDT) Received: from localhost ([222.128.179.239]) by mx.google.com with ESMTPSA id ha10sm1938375pbd.1.2014.06.18.00.48.07 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 18 Jun 2014 00:48:09 -0700 (PDT) Date: Wed, 18 Jun 2014 15:47:54 +0800 From: "brock.zheng" To: crossgcc maillist Subject: binutils build failed when CT_STATIC_TOOLCHAIN is enabled Message-ID: <20140618074754.GB24738@nagra.com> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.23 (2014-03-12) 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! --- For unsubscribe information see http://sourceware.org/lists.html#faq diff -r 99029fac116b scripts/build/binutils/binutils.sh --- a/scripts/build/binutils/binutils.sh Mon May 12 00:09:31 2014 +0200 +++ b/scripts/build/binutils/binutils.sh Wed Jun 18 15:47:16 2014 +0800 @@ -220,7 +220,7 @@ "${CT_BINUTILS_EXTRA_CONFIG_ARRAY[@]}" if [ "${static_build}" = "y" ]; then - extra_make_flags+=("LDFLAGS=-static -all-static") + extra_make_flags+=("LDFLAGS=-all-static -static") CT_DoLog EXTRA "Prepare binutils for static build" CT_DoExecLog ALL make ${JOBSFLAGS} configure-host fi