package/kismet: fix build with gcc >= 9
PATCH v2 1/1 package/kismet: fix build with gcc >= 9
kismet fails to build with gcc >= 9 on:
In file included from /home/buildroot/autobuild/instance-3/output-1/host/xtensa-buildroot-linux-uclibc/sysroot/usr/include/sys/socket.h:39,
from ipc_remote.h:61,
from ipc_remote.cc:34:
/home/buildroot/autobuild/instance-3/output-1/host/xtensa-buildroot-linux-uclibc/sysroot/usr/include/bits/socket.h:289:33: error: flexible array member 'cmsghdr::__cmsg_data' not at end of 'struct<unnamed>'
289 | __extension__ unsigned char __cmsg_data __flexarr; /* Ancillary data. */
| ^~~~~~~~~~~Adding -std=c++11 fix the build and can be removed as soon as kismet is bumped to latest version as the offending code has been removed. It should be noted that kismet builds fine with gcc 8 so it remains unclear why this build failure is raised only with gcc >= 9 (build failure confirmed with gcc 9 and 10)
Fixes:
- http://autobuild.buildroot.org/results/85f7c746ae1cc19f8839f892f0c280dcb0444ea9
---
Changes v1 -> v2 (after review of Thomas Petazzoni):
- Drop incorrect patch and use -std=c++11
package/kismet/kismet.mk | 5 +++++ 1 file changed, 5 insertions(+)
package/kismet/kismet.mk +5 -0
@@ -17,6 +17,11 @@ KISMET_AUTORECONF = YES KISMET_CXXFLAGS = $(TARGET_CXXFLAGS) +# flexible array member 'cmsghdr::__cmsg_data' not at end of 'struct<unnamed>' +ifeq ($(BR2_TOOLCHAIN_GCC_AT_LEAST_9),y) +KISMET_CXXFLAGS += -std=c++11 +endif + ifeq ($(BR2_TOOLCHAIN_HAS_GCC_BUG_85180),y) KISMET_CXXFLAGS += -O0 endif
Signature · 1 line
2.28.0
PATCH v2 1/1 package/kismet: fix build with gcc >= 9
Quoted 5 lines · On Mon, 24 Aug 2020 20:21:21 +0200 Fabrice Fontaine…
Adding -std=c++11 fix the build and can be removed as soon as kismet is bumped to latest version as the offending code has been removed. It should be noted that kismet builds fine with gcc 8 so it remains unclear why this build failure is raised only with gcc >= 9 (build failure confirmed with gcc 9 and 10)
Meh, this looks weird :/
bits/socket.h defines the field like this:
#if __glibc_c99_flexarr_available
__extension__ unsigned char __cmsg_data __flexarr; /* Ancillary data. */
#endif
and __glibc_c99_flexarr_available is defined as follows:
/* Support for flexible arrays.
Headers that should use flexible arrays only if they're "real" (e.g. only if they won't affect sizeof()) should test #if __glibc_c99_flexarr_available. */
#if defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L
# define __flexarr [] # define __glibc_c99_flexarr_available 1 #elif __GNUC_PREREQ (2,97) /* GCC 2.97 supports C99 flexible array members as an extension, even when in C89 mode or compiling C++ (any version). */ # define __flexarr [] # define __glibc_c99_flexarr_available 1 #elif defined __GNUC__ /* Pre-2.97 GCC did not support C99 flexible arrays but did have an equivalent extension with slightly different notation. */ # define __flexarr [0] # define __glibc_c99_flexarr_available 1 #else /* Some other non-C99 compiler. Approximate with [1]. */ # define __flexarr [1] # define __glibc_c99_flexarr_available 0 #endif
Some it's really unclear how -std=c++11 can fix the issue.
Could you have a look at which of those #if case we fall into in the different cases (between gcc 8.x and gcc 9.x, with/without -std=c++11) ?
Thanks!
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin Embedded Linux and Kernel engineering https://bootlin.com
PATCH v2 1/1 package/kismet: fix build with gcc >= 9
Hello Fabrice,
Do you have some further research/feedback on the below questions ?
Thanks!
Thomas
Quoted 50 lines · On Wed, 26 Aug 2020 23:35:30 +0200 Thomas Petazzoni…
Quoted 5 lines · On Mon, 24 Aug 2020 20:21:21 +0200 Fabrice Fontaine…
Adding -std=c++11 fix the build and can be removed as soon as kismet is bumped to latest version as the offending code has been removed. It should be noted that kismet builds fine with gcc 8 so it remains unclear why this build failure is raised only with gcc >= 9 (build failure confirmed with gcc 9 and 10)
Meh, this looks weird :/
bits/socket.hdefines the field like this:#if
__glibc_c99_flexarr_available
__extension__unsigned char__cmsg_data__flexarr; /* Ancillary data. */
#endifand
__glibc_c99_flexarr_availableis defined as follows:/* Support for flexible arrays.
Headers that should use flexible arrays only if they're "real" (e.g. only if they won't affectsizeof()) should test #if__glibc_c99_flexarr_available. */
#if defined__STDC_VERSION__&&__STDC_VERSION__>= 199901L# define __flexarr [] # define __glibc_c99_flexarr_available 1 #elif __GNUC_PREREQ (2,97) /* GCC 2.97 supports C99 flexible array members as an extension, even when in C89 mode or compiling C++ (any version). */ # define __flexarr [] # define __glibc_c99_flexarr_available 1 #elif defined __GNUC__ /* Pre-2.97 GCC did not support C99 flexible arrays but did have an equivalent extension with slightly different notation. */ # define __flexarr [0] # define __glibc_c99_flexarr_available 1 #else /* Some other non-C99 compiler. Approximate with [1]. */ # define __flexarr [1] # define __glibc_c99_flexarr_available 0 #endifSome it's really unclear how -std=c++11 can fix the issue.
Could you have a look at which of those #if case we fall into in the different cases (between gcc 8.x and gcc 9.x, with/without -std=c++11) ?
Thanks!
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin Embedded Linux and Kernel engineering https://bootlin.com