From patchwork Wed Jun 12 07:48:47 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthias Klose X-Patchwork-Id: 250683 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 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "localhost", Issuer "www.qmailtoaster.com" (not verified)) by ozlabs.org (Postfix) with ESMTPS id 64CF62C0091 for ; Wed, 12 Jun 2013 17:49:03 +1000 (EST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :message-id:date:from:mime-version:to:cc:subject:content-type; q=dns; s=default; b=pjev+jRz+ZZ2d+MpTtdKk0eDsSkQ+0K99Xjeld4OwVe s84nGw43cGw9h3yffU+Mup4y/9guAyggTCWyzXq/IvDlh/EhEs31NYmAyNvO99n0 EWz2j/baEVtBZl1s1SedRIrP6+ynblsP+6i7KuqTmx//OSv2Sw/xOLh3Hemtl4OI = DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :message-id:date:from:mime-version:to:cc:subject:content-type; s=default; bh=pou18OCAvPK9PitIqOrgPNpPbrQ=; b=qalL/jcpXLF9kpl8j pvZFjA+F9WkEb+i4VCE1bK7ZrBdFx3edOAILNDqtews6TZ+JwSzK6DBKx+FxhD7W L7OglFWtcJ3s7muoB4Mw7R+5EColPd49q9atKEdlaTn0xG2wgUz1WVAbklVBBnbb nF8lnFB3xzAStjfkqHtZjMu/Us= Received: (qmail 11268 invoked by alias); 12 Jun 2013 07:48:56 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 11256 invoked by uid 89); 12 Jun 2013 07:48:55 -0000 X-Spam-SWARE-Status: No, score=-2.2 required=5.0 tests=AWL, BAYES_00, KHOP_RCVD_UNTRUST, RCVD_IN_DNSWL_LOW, TW_BG autolearn=ham version=3.3.1 Received: from youngberry.canonical.com (HELO youngberry.canonical.com) (91.189.89.112) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Wed, 12 Jun 2013 07:48:53 +0000 Received: from dslb-088-073-071-126.pools.arcor-ip.net ([88.73.71.126] helo=[192.168.42.222]) by youngberry.canonical.com with esmtpsa (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1UmfnW-0004pn-JL; Wed, 12 Jun 2013 07:48:50 +0000 Message-ID: <51B827DF.4030903@ubuntu.com> Date: Wed, 12 Jun 2013 09:48:47 +0200 From: Matthias Klose User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130510 Thunderbird/17.0.6 MIME-Version: 1.0 To: GCC Patches CC: Richard Sandiford , Steven Bosscher , Richard Biener Subject: [patch] fix cross building a native compiler X-Virus-Found: No Trying to cross build a native compiler for arm-linux on x86_64 linux currently fails to build, if the libgmp development files are not available for the build system. This works with 4.7, but fails with 4.8. The build fails with: TARGET_CPU_DEFAULT="" \ HEADERS="auto-build.h ansidecl.h" DEFINES="" \ /bin/bash ../../src/gcc/mkconfig.sh bconfig.h g++ -c -g -O2 -DIN_GCC -fno-exceptions -fno-rtti -fasynchronous-unwind-tables -W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wmissing-format-attribute -pedantic -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings -DHAVE_CONFIG_H -DGENERATOR_FILE -I. -Ibuild -I../../src/gcc -I../../src/gcc/build -I../../src/gcc/../include -I../../src/gcc/../libcpp/include -I../../src/gcc/../libdecnumber -I../../src/gcc/../libdecnumber/dpd -I../libdecnumber -I../../src/gcc/../libbacktrace -DCLOOG_INT_GMP \ -o build/genconstants.o ../../src/gcc/genconstants.c In file included from /usr/include/x86_64-linux-gnu/sys/resource.h:25:0, from ../../src/gcc/system.h:395, from ../../src/gcc/genconstants.c:28: /usr/include/x86_64-linux-gnu/bits/resource.h:131:18: error: declaration does not declare anything [-fpermissive] In file included from ../../src/gcc/genconstants.c:28:0: ../../src/gcc/system.h:444:23: error: declaration of C function 'void* sbrk(int)' conflicts with Searching the archive and ML this is supposed to work according to PR 35051, as described in http://gcc.gnu.org/ml/gcc-patches/2008-02/msg00041.html When building the auto-build.h, all the configure tests including the system.h header fail to build with configure:10361: gcc -c -I../../../src/gcc -I../../../src/gcc/../include conftest.c >&5 In file included from ../../../src/gcc/system.h:641:0, from conftest.c:116: /usr/include/gmp.h:69:24: fatal error: gmp-x86_64.h: No such file or directory compilation terminated. And at least all the HAVE_DECL_* defines are set to 0 instead of 1. [side note: can we keep the temporary directory for this? it's a bit strange that this directory is removed during the build, and can't be looked at. The build continues after the configure, and then fails later] I checked that defining GENERATOR_FILE for this configure step to build the auto-build.h lets me to cross build the native compiler, and the resulting build seems to work on the target platform. However I can't find any other documentation for GENERATOR_FILE, so I'm unsure if that's the right thing to do. Richard did introduce the conditional include of gmp.h based on GENERATOR_FILE back in 2008, and Steven did define this for some object files built for the host, but not the build in 2012: 2012-07-08 Steven Bosscher * Makefile.in (gengtype-lex.o, gengtype-parse.o, gengtype-state.o, gengtype.o): Add -DGENERATOR_FILE manually for host gengtype objects. Is just setting _DGENERATOR_FILE for the auto-build.h build the right thing to do? If yes, ok for the 4.8 branch and the trunk? I didn't yet figure out why this works with 4.7. Matthias --- gcc/configure.ac~ 2013-06-11 18:34:36.757067080 +0200 +++ gcc/configure.ac 2013-06-11 22:51:47.340892778 +0200 @@ -1519,7 +1519,7 @@ *) realsrcdir=../${srcdir};; esac saved_CFLAGS="${CFLAGS}" - CC="${CC_FOR_BUILD}" CFLAGS="${CFLAGS_FOR_BUILD}" \ + CC="${CC_FOR_BUILD}" CFLAGS="${CFLAGS_FOR_BUILD} -DGENERATOR_FILE" \ LDFLAGS="${LDFLAGS_FOR_BUILD}" \ ${realsrcdir}/configure \ --enable-languages=${enable_languages-all} \