From patchwork Sat Aug 24 14:24:45 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: FX Coudert X-Patchwork-Id: 269638 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 B0C732C0084 for ; Sun, 25 Aug 2013 00:25:38 +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:from :content-type:message-id:mime-version:subject:date:references:cc :to; q=dns; s=default; b=iMM/8Ai7Cst0G89YpVT9uT/6ilq0zoFOLb/1IXq 0mhsd6RedQoDbw4e3MpIA1zgy73WocEAeeKpGLY7xvWucCGfFpT5l8rmsbPy8mWr u+33rwV11+Kf1qiBn0YvgEbbzo0eh5qA5nFXVZ8aMjEIjzdQ22fqec7RYJFzNWGK Z5Lk= 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:from :content-type:message-id:mime-version:subject:date:references:cc :to; s=default; bh=baUZ1jBOwSj8uiUamg6Iaa5BK1E=; b=IsY5OMu500uF/ bbECLvnpa1vUzo51U6n5VCfM0ER8aGdj/NSEQArap5s0Y65kXch/zEnbMisS4xi5 oHHEHIoWddcO5oHu3k8ENs0rEiw0lJTqt6P7dKUIY6PgcZqchLWVP7K1ctrBjKaA p3Nr4emxa65mGxCw3Si0maFVy5+W4g= Received: (qmail 20827 invoked by alias); 24 Aug 2013 14:25:31 -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 20811 invoked by uid 89); 24 Aug 2013 14:25:30 -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-we0-f172.google.com (HELO mail-we0-f172.google.com) (74.125.82.172) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Sat, 24 Aug 2013 14:25:29 +0000 Received: by mail-we0-f172.google.com with SMTP id t60so1491778wes.3 for ; Sat, 24 Aug 2013 07:25:27 -0700 (PDT) X-Received: by 10.194.173.163 with SMTP id bl3mr3680515wjc.10.1377354327649; Sat, 24 Aug 2013 07:25:27 -0700 (PDT) Received: from [192.168.0.101] ([128.140.128.58]) by mx.google.com with ESMTPSA id fv10sm4241277wic.0.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sat, 24 Aug 2013 07:25:26 -0700 (PDT) From: FX Message-Id: <08855916-EED2-4485-AE68-4BD91FE4393A@gmail.com> Mime-Version: 1.0 (Mac OS X Mail 6.5 \(1508\)) Subject: Fwd: [RFC, patch] Detect lack of 32-bit devel environment on x86_64-linux targets Date: Sat, 24 Aug 2013 16:24:45 +0200 References: Cc: "rth@redhat.com" , "jh@suse.cz" , "ubizjak@gmail.com" , "bonzini@gnu.org" To: "gcc-patches@gcc.gnu.org" X-Virus-Found: No ping > 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}"