From patchwork Sun Aug 11 15:59:33 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: FX Coudert X-Patchwork-Id: 266337 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 537272C00B7 for ; Mon, 12 Aug 2013 01:59:45 +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 :content-type:mime-version:subject:from:in-reply-to:date:cc :message-id:references:to; q=dns; s=default; b=edFGD0iCxe8Epbyjn ZCgmmPlHi5p3aLqN1fZZVRPEebGgfh5buEMxjXSbi07t31Keo3tV49v1IAX2rzjl LPPEEp53miXA9179p7103SZf8jdx1DqtXXUwTOsqgdYu0b4/IeVjVV+y6HqgVzmA TG2hk83V27v5kvMRkssiC63I68= 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 :content-type:mime-version:subject:from:in-reply-to:date:cc :message-id:references:to; s=default; bh=Qs3Sp+jIcWNPg3Tym0WLa/k 97h4=; b=mihqzKeuTWgtlaPeji2+2c+x1Y1ji2Obh5JCJpVl/6dtBDP6/KzJ2cc +SvmTAQ/ICl+pVa5Nj5JBhxUmKVEchHrLkRYbXksoS4TkLGewWPEzcGaX/FCFe4z qhvmkSOBRPJNG3Rj59Ps2nhpPJ/qSK10Qngr1KMhmTb/ozS4ub88= Received: (qmail 830 invoked by alias); 11 Aug 2013 15:59:39 -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 821 invoked by uid 89); 11 Aug 2013 15:59:38 -0000 X-Spam-SWARE-Status: No, score=-4.1 required=5.0 tests=BAYES_00, FREEMAIL_FROM, KHOP_THREADED, RCVD_IN_DNSWL_LOW, RCVD_IN_HOSTKARMA_YE, SPF_PASS autolearn=ham version=3.3.2 Received: from mail-wi0-f170.google.com (HELO mail-wi0-f170.google.com) (209.85.212.170) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Sun, 11 Aug 2013 15:59:36 +0000 Received: by mail-wi0-f170.google.com with SMTP id hi8so1035571wib.3 for ; Sun, 11 Aug 2013 08:59:34 -0700 (PDT) X-Received: by 10.180.36.50 with SMTP id n18mr4383897wij.8.1376236774632; Sun, 11 Aug 2013 08:59:34 -0700 (PDT) Received: from [192.168.1.17] (smb-rsycl-01.wifihubtelecom.net. [213.174.124.177]) by mx.google.com with ESMTPSA id nb12sm11873529wic.3.2013.08.11.08.59.33 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sun, 11 Aug 2013 08:59:33 -0700 (PDT) Mime-Version: 1.0 (Mac OS X Mail 6.5 \(1508\)) Subject: [RFC, patch] Detect lack of 32-bit devel environment on x86_64-linux targets From: FX In-Reply-To: <58F1AD55-AFB6-4BE9-A112-34B8386373C0@gmail.com> Date: Sun, 11 Aug 2013 17:59:33 +0200 Cc: rth@redhat.com, jh@suse.cz, ubizjak@gmail.com, bonzini@gnu.org Message-Id: References: <51F66CA9.4040803@redhat.com> <51F67A08.2070709@redhat.com> <51F79E41.9040302@tx.technion.ac.il> <58F1AD55-AFB6-4BE9-A112-34B8386373C0@gmail.com> To: "gcc-patches@gcc.gnu.org" X-Virus-Found: No Given that I did not receive any feedback on my earlier email on this topic, I would like to send this patch for RFC. I'm not expert at this configury-stuff, so please try to comment on both the test proposed and my actual implementation :) The idea is to find a patch which both catches probable issues early on for most x86_64-linux users, yet does not make build more complex for our power users. So, I propose to include a specific check in toplevel configure: The cumulative conditions I suggest, in order to make it as unobtrusive as possible for current users, are: 1. if we build a native compiler, 2. on x86_64-linux (and possible other x86_64 targets whose maintainers want to opt in), 3. and neither --enable-multilib nor --disable-multilib were passed then: a. we check that the native compiler can handle 32-bit, by compiling a test executable with the "-m32" option b. if we fail, we error out of the configure process, indicating that this can be overriden with --{enable,disable}-multilib I suspect this might catch (at configure time) the large majority of users who currently get stuck at stage 2 with the "gnu/stubs-32.h" error, while being invisible to a large majority of the power users. So, what do you think? FX Index: configure.ac =================================================================== --- configure.ac (revision 201292) +++ configure.ac (working copy) @@ -2861,6 +2861,26 @@ case "${target}" in ;; esac +# Special user-friendly check for native x86_64-linux build, if +# multilib is not explicitly enabled. +case "$target:$have_compiler:$host:$target:$enable_multilib" in + x86_64-*linux*:yes:$build:$build:) + # Make sure we have a developement environment that handles 32-bit + dev64=no + echo "int main () { return 0; }" > conftest.c + ${CC} -m32 -o conftest ${CFLAGS} ${CPPFLAGS} ${LDFLAGS} conftest.c + if test $? = 0 ; then + if test -s conftest || test -s conftest.exe ; then + dev64=yes + fi + fi + rm -f conftest* + if test x${dev64} != xyes ; then + AC_MSG_ERROR([I suspect your system does not have 32-bit developement libraries (libc and headers). If you have them, rerun configure with --enable-multilib. If you do not have them, and want to build a 64-bit-only compiler, rerun configure with --disable-multilib.]) + fi + ;; +esac + # Default to --enable-multilib. if test x${enable_multilib} = x ; then target_configargs="--enable-multilib ${target_configargs}"