From patchwork Thu Jan 22 23:44:15 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Matthias Klose X-Patchwork-Id: 432017 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 71629140281 for ; Fri, 23 Jan 2015 10:44:36 +1100 (AEDT) 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=MaUSzR5ntLjoSf17iyvCzbnudg0YeSwGVul2mgZhxns NE8n7NUK0v0BdCn4OUkaSzC+BIFQPDfWNELK5wGUex8VVaToaPCEtNsG3Z0zO2FM ClHp9v8ct6qSle5qQNNl55Bkg6ZXwRqzeG7KoLqze1dv8lp8RQRYgysTK555GJE8 = 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=7fWR9xA6F40D/h1WKpYPeY/iMbI=; b=lT/2lfJu2N+GrS+p7 4CFigZwOZnN/jkm1EH3xOXIjNAFIa6VS3eB+uAP+IgERFLUMHOrLbMvvJ49oPjOS fbSnVMATMCYGpmIEc68dQUGhTgU7MZeXcLuTuJCJWpmoroBRHDvP8vThLMLYj45n fX0TNIKKxlpxlA87DaODyDXDkI= Received: (qmail 8755 invoked by alias); 22 Jan 2015 23:44:26 -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 8722 invoked by uid 89); 22 Jan 2015 23:44:24 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-2.6 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.2 X-HELO: einhorn.in-berlin.de Received: from einhorn.in-berlin.de (HELO einhorn.in-berlin.de) (192.109.42.8) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Thu, 22 Jan 2015 23:44:22 +0000 X-Envelope-From: doko@ubuntu.com Received: from [192.168.42.218] (dslb-088-073-096-075.088.073.pools.vodafone-ip.de [88.73.96.75]) (authenticated bits=0) by einhorn.in-berlin.de (8.14.4/8.14.4/Debian-4) with ESMTP id t0MNiGrL007016 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NOT); Fri, 23 Jan 2015 00:44:18 +0100 Message-ID: <54C18B4F.4020308@ubuntu.com> Date: Fri, 23 Jan 2015 00:44:15 +0100 From: Matthias Klose User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.3.0 MIME-Version: 1.0 To: GCC Patches CC: Ian Lance Taylor Subject: [patch, libbacktrace/libsanitizer] fix multilib builds In the past I had some issues on various linux platforms to build some multilib configurations, all not building libbacktrace and libsanitizer, seen on powerpc, ix86 and x86_64. All fail like Running configure in multilib subdir x32 pwd: /«PKGBUILDDIR»/build/i586-linux-gnu configure: creating cache ./config.cache checking build system type... i586-pc-linux-gnu checking host system type... i586-pc-linux-gnu checking target system type... i586-pc-linux-gnu checking for i586-linux-gnu-gcc... /«PKGBUILDDIR»/build/./gcc/xgcc -B/«PKGBUILDDIR»/build/./gcc/ -B/usr/i586-linux-gnu/bin/ -B/usr/i586-linux-gnu/lib/ -isystem /usr/i586-linux-gnu/include -isystem /usr/i586-linux-gnu/sys-include -isystem /«PKGBUILDDIR»/build/sys-include -mx32 checking for C compiler default output file name... a.out checking whether the C compiler works... configure: error: in `/«PKGBUILDDIR»/build/i586-linux-gnu/x32/libbacktrace': configure: error: cannot run C compiled programs. If you meant to cross compile, use `--host'. See `config.log' for more details. The issue here is that the kernel used for the build is not configured for x32, and I'm trying to build x32 multilibs. The same thing happens when trying to build 64bit multilibs on powerpc, s390 or ix86 kernels, not being able to execute 64bit binaries. The autoconf generated configury assumes that it should be able to execute any multilib built binary, however config/multi.m4 knows better about this ... # Even if the default multilib is not a cross compilation, # it may be that some of the other multilibs are. if test $cross_compiling = no && test $multilib = yes \ && test "x${with_multisubdir}" != x ; then cross_compiling=maybe fi However for the libbacktrace and the libsanitizer builds, the AM_ENABLE_MULTILIB macro is included way too late. Scan the generated configure file for "cross_compiling" and see that the above snippet is added after the failing checks. The fix seems to be simple, just move the AM_ENABLE_MULTILIB macro up so that the "cross_compiling" value is corrected before it is tested. This is what the patch is doing. However ... for every runtime library there is still something wrong, at least one linker check in the generated configure is done before the expansion of the AM_ENABLE_MULTILIB macro. I'm not trying to fix that with this patch ... autoconf offers a AC_REQUIRE macro, so AM_ENABLE_MULTILIB should add one to ensure that this macros is always expanded before the first check for "cross_compiling", but I'm not sure which one. Small patch, but took me some time to find out :-/ This patch should go to trunk and all active branches. Ok to check in? Matthias --- a/src/libbacktrace/configure.ac +++ b/src/libbacktrace/configure.ac @@ -34,6 +34,8 @@ AC_CONFIG_SRCDIR(backtrace.h) AC_CONFIG_HEADER(config.h) +AM_ENABLE_MULTILIB(, ..) + AC_CANONICAL_SYSTEM target_alias=${target_alias-$host_alias} @@ -83,7 +85,6 @@ if test -n "${with_target_subdir}"; then # We are compiling a GCC library. We can assume that the unwind # library exists. - AM_ENABLE_MULTILIB(, ..) BACKTRACE_FILE="backtrace.lo simple.lo" else AC_CHECK_HEADER([unwind.h], --- a/src/libsanitizer/configure.ac +++ b/src/libsanitizer/configure.ac @@ -5,6 +5,8 @@ AC_INIT(package-unused, version-unused, libsanitizer) AC_CONFIG_SRCDIR([include/sanitizer/common_interface_defs.h]) +AM_ENABLE_MULTILIB(, ..) + AC_MSG_CHECKING([for --enable-version-specific-runtime-libs]) AC_ARG_ENABLE(version-specific-runtime-libs, [ --enable-version-specific-runtime-libs Specify that runtime libraries should be installed in a compiler-specific directory ], @@ -26,7 +28,6 @@ GCC_LIBSTDCXX_RAW_CXX_FLAGS AM_INIT_AUTOMAKE(foreign no-dist) -AM_ENABLE_MULTILIB(, ..) AM_MAINTAINER_MODE # Calculate toolexeclibdir