[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] Building xtf on older distros



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 <wei.liu2@xxxxxxxxxx>
Date: Thu, 28 Sep 2017 09:43:12 +0100
Subject: [XTF PATCH] lib: provide BUILD_BUG_ON for older gcc's
Cc: andrew.cooper3@xxxxxxxxxx

Reported-by: Glenn Enright <glenn@xxxxxxxxxxxxxxx>
Signed-off-by: Wei Liu <wei.liu2@xxxxxxxxxx>
---
 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)                                       \
     ({                                                  \
-- 
2.11.0


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
https://lists.xen.org/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.