From patchwork Wed Nov 21 01:02:02 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Price X-Patchwork-Id: 200536 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]) by ozlabs.org (Postfix) with SMTP id 3FF682C00AC for ; Wed, 21 Nov 2012 12:02:33 +1100 (EST) Comment: DKIM? See http://www.dkim.org DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=sourceware.org; s=default; x=1354064554; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: Received:Content-Type:MIME-Version:Content-Transfer-Encoding: Subject:Message-Id:User-Agent:Date:From:To:Mailing-List: Precedence:List-Id:List-Unsubscribe:List-Subscribe:List-Archive: List-Post:List-Help:Sender:Delivered-To; bh=4lDFHXYA9UYpUS9ueJb2 rJCmeJU=; b=MRq1+yLwbUdjkcjK35AgcAQDY/Wng6OaC7fs4ZY1TmIOPrinDYVG wpd/ryDBM1CPzxZGoolH19pI97XSj638ayHGozvqJAIQ7Ph3swN4OhK2PXxghcxl RlktUXSMTXPBYpQslGiNt2vHm0a3rLrkffs/zwtlolzwRelFGRhLQL8= Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=sourceware.org; h=Received:Received:X-SWARE-Spam-Status:X-Spam-Check-By:Received:Received:Received:Received:Content-Type:MIME-Version:Content-Transfer-Encoding:Subject:X-Mercurial-Node:Message-Id:User-Agent:Date:From:To:X-IsSubscribed:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Subscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=g5NJYUgHGC3xUOYD+P+fOHHO59Dpa3ZidmOV0hq4YMlfSZE6XY1oOqSYKta4ln hXyJFQlAKj+tLBgKFEBRSoXdmMvO3XOYCF3MLLc4rVykhSjLdavfk7gtuJkaW/Zu UsYeDzDLQXF9jB+FiPwNUUgKsoJEo2qoiDFvmELQUcRFg=; Received: (qmail 20513 invoked by alias); 21 Nov 2012 01:02:20 -0000 Received: (qmail 20466 invoked by uid 22791); 21 Nov 2012 01:02:19 -0000 X-SWARE-Spam-Status: No, hits=-4.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, KHOP_RCVD_TRUST, RCVD_IN_DNSWL_LOW, RCVD_IN_HOSTKARMA_YE X-Spam-Check-By: sourceware.org Received: from mail-pa0-f41.google.com (HELO mail-pa0-f41.google.com) (209.85.220.41) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 21 Nov 2012 01:02:11 +0000 Received: by mail-pa0-f41.google.com with SMTP id bj3so595352pad.0 for ; Tue, 20 Nov 2012 17:02:11 -0800 (PST) Received: by 10.68.135.101 with SMTP id pr5mr53950939pbb.140.1353459731274; Tue, 20 Nov 2012 17:02:11 -0800 (PST) Received: from nipigon.dssd.com (50-76-39-249-ip-static.hfc.comcastbusiness.net. [50.76.39.249]) by mx.google.com with ESMTPS id sw1sm8893497pbc.75.2012.11.20.17.02.09 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 20 Nov 2012 17:02:10 -0800 (PST) MIME-Version: 1.0 Subject: [PATCH] scripts: refine static linking check to better guide the user X-Mercurial-Node: 163f86b5216fc08c672a687d549dd90b062c81ef Message-Id: <163f86b5216fc08c672a.1353459722@nipigon.dssd.com> User-Agent: Mercurial-patchbomb/1.9.3 Date: Tue, 20 Nov 2012 17:02:02 -0800 From: Daniel Price To: crossgcc@sourceware.org X-IsSubscribed: yes 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 # HG changeset patch # User Daniel Price # Date 1353459557 28800 # Node ID 163f86b5216fc08c672a687d549dd90b062c81ef # Parent 5df2d60ca8476069f3dccf7526940058a47bc837 scripts: refine static linking check to better guide the user scripts: fail on ':' in paths Signed-off-by: Daniel Price --- For unsubscribe information see http://sourceware.org/lists.html#faq diff -r 5df2d60ca847 -r 163f86b5216f scripts/crosstool-NG.sh.in --- a/scripts/crosstool-NG.sh.in Mon Nov 19 15:23:05 2012 -0800 +++ b/scripts/crosstool-NG.sh.in Tue Nov 20 16:59:17 2012 -0800 @@ -66,6 +66,9 @@ *" "*) CT_Abort "'CT_${d}_DIR'='${dir}' contains a space in it.\nDon't use spaces in paths, it breaks things." ;; + *":"*) + CT_Abort "'CT_${d}_DIR'='${dir}' contains a colon in it.\nDon't use colons in paths, it breaks things." + ;; esac done @@ -421,8 +424,7 @@ where=$(CT_Which "${tool}") fi - # Not all tools are available for all platforms, but some are really, - # bally needed + # Not all tools are available for all platforms, but some are required. if [ -n "${where}" ]; then CT_DoLog DEBUG " '${!v}-${tool}' -> '${where}'" printf "#${BANG}${CT_CONFIG_SHELL}\nexec '${where}' \"\${@}\"\n" >"${CT_BUILDTOOLS_PREFIX_DIR}/bin/${!v}-${tool}" @@ -474,25 +476,13 @@ *) ;; esac - # Now we know our host and where to find the host tools, we can check - # if static link was requested, but only if it was requested - if [ "${CT_WANTS_STATIC_LINK}" = "y" ]; then - tmp="${CT_BUILD_DIR}/.static-test" - if ! "${CT_HOST}-gcc" -xc - -static -o "${tmp}" >/dev/null 2>&1 <<-_EOF_ - int main() { return 0; } - _EOF_ - then - CT_Abort "Static linking impossible on the host system '${CT_HOST}'" - fi - rm -f "${tmp}" - fi - # Help gcc # Explicitly optimise, else the lines below will overide the # package's default optimisation flags CT_CFLAGS_FOR_HOST="-O2 -g" [ "${CT_USE_PIPES}" = "y" ] && CT_CFLAGS_FOR_HOST+=" -pipe" CT_CFLAGS_FOR_HOST+=" ${CT_EXTRA_FLAGS_FOR_HOST}" + CT_DoLog DEBUG "gcc CFLAGS for host compiler: ${CT_CFLAGS_FOR_HOST}" # Set the shell to be used by ./configure scripts and by Makefiles (those # that support it!). @@ -510,6 +500,36 @@ [ ${CT_PARALLEL_JOBS} -gt 0 ] && JOBSFLAGS="${JOBSFLAGS} -j${CT_PARALLEL_JOBS}" [ ${CT_LOAD} -ne 0 ] && JOBSFLAGS="${JOBSFLAGS} -l${CT_LOAD}" + CT_DoLog INFO "Testing host compiler" + # Now that we've set up $PATH and $CT_CFLAGS_FOR_HOST, sanity test that gcc + # is runnable so that the user can troubleshoot problems if not. + CT_DoLog DEBUG "Checking that we can run gcc -v" + CT_DoExecLog DEBUG "${CT_HOST}-gcc" -v + + # Create a simple C program for testing. + testc="${CT_BUILD_DIR}/.test.c" + printf "int main() {return 0; }\n" > "${testc}" + gccout="${CT_BUILD_DIR}/.gccout" + + CT_DoLog DEBUG "Checking that gcc can compile a trivial program" + CT_DoExecLog DEBUG "${CT_HOST}-gcc" ${CT_CFLAGS_FOR_HOST} -xc "${testc}" -o "${gccout}" + rm -f "${gccout}" + + if [ "${CT_WANTS_STATIC_LINK}" = "y" ]; then + CT_DoLog DEBUG "Checking that gcc can compile a trivial statically linked program (CT_WANTS_STATIC_LINK)" + CT_DoLog DEBUG "You may need to ensure that static libraries such as libc.a are installed on your system" + CT_DoExecLog DEBUG "${CT_HOST}-gcc" ${CT_CFLAGS_FOR_HOST} -xc "${testc}" -static -o "${gccout}" + rm -f "${gccout}" + fi + + if [ "${CT_CC_STATIC_LIBSTDCXX}" = "y" ]; then + CT_DoLog DEBUG "Checking that gcc can statically link libstdc++ (CT_CC_STATIC_LIBSTDCXX)" + CT_DoLog DEBUG "You may need to ensure that libstdc++.a is installed on your system" + CT_DoExecLog DEBUG "${CT_HOST}-gcc" ${CT_CFLAGS_FOR_HOST} -xc "${testc}" -static -lstdc++ -o "${gccout}" + rm -f "${gccout}" + fi + rm -f "${testc}" + # We need to save the real .config with kconfig's value, # not our mangled .config.2 with arrays. CT_DoLog EXTRA "Installing user-supplied crosstool-NG configuration"