From patchwork Thu Sep 28 08:45:35 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Wei Liu X-Patchwork-Id: 9975527 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 9950E603F2 for ; Thu, 28 Sep 2017 08:48:23 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 894861FE85 for ; Thu, 28 Sep 2017 08:48:23 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7E2D9204FE; Thu, 28 Sep 2017 08:48:23 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id E43471FE85 for ; Thu, 28 Sep 2017 08:48:22 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dxUS2-0008CT-LJ; Thu, 28 Sep 2017 08:45:46 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dxUS2-0008CL-7V for xen-devel@lists.xen.org; Thu, 28 Sep 2017 08:45:46 +0000 Received: from [85.158.143.35] by server-9.bemta-6.messagelabs.com id 74/AA-03422-9B6BCC95; Thu, 28 Sep 2017 08:45:45 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrAIsWRWlGSWpSXmKPExsXitHRDpO7mbWc iDVqOclos+biYxYHR4+ju30wBjFGsmXlJ+RUJrBkbXk1hLZgjUbGj/wBLA+M+4S5GDg4JAX+J rR9Fuhg5OVgEVCU+t95kAbHZBJQlfnb2soHYIgLSEkdf32cHsZkFbCTmPu5iBbGFBcwk5nc0g dm8AhYSd48+ZAaxhQScJCbtfcgEEReUODnzCQvIKmYBTYn1u/QhTGmJ5f84ICbKSzRvnQ3WyS ngLPHy+3ewTlEBFYnOpXNYICYqSHRMP8Y0gZF/FpKhsxCGzkIYOgvJ0AWMLKsYNYpTi8pSi3Q NTfSSijLTM0pyEzNzdA0NzPRyU4uLE9NTcxKTivWS83M3MQJDkgEIdjBe3xhwiFGSg0lJlFd1 65lIIb6k/JTKjMTijPii0pzU4kOMMhwcShK8r0BygkWp6akVaZk5wOiASUtw8CiJ8N4DSfMWF yTmFmemQ6ROMSpKifM6gSQEQBIZpXlwbbCIvMQoKyXMywh0iBBPQWpRbmYJqvwrRnEORiVh3h 0gU3gy80rgpr8CWswEtHjyRLDFJYkIKakGxp13L1ec6VOvmrE7NN/VIGvnYj7G+zvP+may8+5 NOR6/c1vTvqMPjx2TnPqg+HlxlOuqB1/uivw1Zjgzr8HBKomx7iBbpJXMR5f/JndjysKK//VE vOd997D+yY8ny23/i/066n49ITRJ9LR0s8/M1P/fZ/+YzuzToPPi7dW5x1mrT5rOWBL5bKsSS 3FGoqEWc1FxIgCtkt7UwwIAAA== X-Env-Sender: prvs=4379d8120=wei.liu2@citrix.com X-Msg-Ref: server-15.tower-21.messagelabs.com!1506588337!84865433!1 X-Originating-IP: [66.165.176.89] X-SpamReason: No, hits=0.0 required=7.0 tests=sa_preprocessor: VHJ1c3RlZCBJUDogNjYuMTY1LjE3Ni44OSA9PiAyMDMwMDc=\n, received_headers: No Received headers X-StarScan-Received: X-StarScan-Version: 9.4.45; banners=-,-,- X-VirusChecked: Checked Received: (qmail 40853 invoked from network); 28 Sep 2017 08:45:38 -0000 Received: from smtp.citrix.com (HELO SMTP.CITRIX.COM) (66.165.176.89) by server-15.tower-21.messagelabs.com with RC4-SHA encrypted SMTP; 28 Sep 2017 08:45:38 -0000 X-IronPort-AV: E=Sophos;i="5.42,449,1500940800"; d="scan'208";a="441565556" Date: Thu, 28 Sep 2017 09:45:35 +0100 From: Wei Liu To: Message-ID: <20170928084535.lkdywz5gjtgtlaxz@citrix.com> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20170113 (1.7.2) Cc: Wei Liu , xen-devel@lists.xen.org Subject: Re: [Xen-devel] Building xtf on older distros X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP On Thu, Sep 28, 2017 at 02:43:57PM +1300, Glenn Enright wrote: > Hi there > > When building the xen testing framework on CentOS6, I see the below issue. I > see similar issues with CentOS7 and other distros with older tool chains. > The only one that built cleanly for me was Ubuntu 1604. > > Some workarounds (disabling the -W options) let it get a bit further but I > hit other issues. > > Andrew separately mentioned this may be related to C99 initialisation, which > sounds about right. > > At the moment I'm doing a static build and moving the binaries where I need > to run the tests, which is fine, but it would be nice to have a native c6 > build working to match the rest of my existing test infra. > > Not a C dev, but happy to test any/all things. > > Not list subscribed so please include in CC. > > Regards, Glenn > http://rimuhosting.com > > ... > gcc -pipe -I/root/gle/xtf/include -I/root/gle/xtf/arch/x86/include -MMD -MP > -Wall -Wextra -Werror -std=gnu99 -Wstrict-prototypes -O3 -g -fno-common > -fno-asynchronous-unwind-tables -fno-strict-aliasing -fno-stack-protector > -fno-pic -ffreestanding -mno-red-zone -mno-sse -Wno-unused-parameter > -Winline -m64 -DCONFIG_ENV_pv64 -include arch/config.h -c > /root/gle/xtf/arch/x86/setup.c -o /root/gle/xtf/arch/x86/setup-pv64.o > cc1: warnings being treated as errors > /root/gle/xtf/arch/x86/grant_table.c: In function ‘arch_map_gnttab’: > /root/gle/xtf/arch/x86/grant_table.c:19: error: implicit declaration of > function ‘_Static_assert’ > make[1]: *** [/root/gle/xtf/arch/x86/grant_table-pv64.o] Error 1 > make[1]: *** Waiting for unfinished jobs.... > make[1]: Leaving directory `/root/gle/xtf/tests/cpuid' > make: *** [all] Error 2 > > # gcc --version > gcc (GCC) 4.4.7 20120313 (Red Hat 4.4.7-18) > Copyright (C) 2010 Free Software Foundation, Inc. > This is free software; see the source for copying conditions. There is NO > warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. > Please try the following patch: ---8<--- From 7fd09585c1b511d1cd2c2b761d32bfcfb022d2d8 Mon Sep 17 00:00:00 2001 From: Wei Liu Date: Thu, 28 Sep 2017 09:43:12 +0100 Subject: [XTF PATCH] lib: provide BUILD_BUG_ON for older gcc's Cc: andrew.cooper3@citrix.com Reported-by: Glenn Enright Signed-off-by: Wei Liu --- include/xtf/lib.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/include/xtf/lib.h b/include/xtf/lib.h index d792a8d..1d2a396 100644 --- a/include/xtf/lib.h +++ b/include/xtf/lib.h @@ -28,8 +28,12 @@ void __noreturn panic(const char *fmt, ...) __printf(1, 2); #cond, __FILE__, __LINE__); \ } while ( 0 ) +#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6) #define BUILD_BUG_ON(cond) \ _Static_assert(!(cond), "!(" #cond ")") +#else +#define BUILD_BUG_ON(cond) sizeof(struct { int:-!!(cond); }) +#endif #define min(a, b) \ ({ \