[v4] build: update DPDK to use C11 standard
Checks
Commit Message
As previously announced, DPDK 23.11 will require a C11 supporting
compiler and will use the C11 standard in all builds.
Forcing use of the C standard, rather than the standard with
GNU extensions, means that some posix definitions which are not in
the C standard are unavailable by default. We fix this by ensuring
the correct defines or cflags are passed to the components that
need them.
Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Acked-by: Morten Brørup <mb@smartsharesystems.com>
Acked-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
---
V4:
* pass cflags to the structure and definition checks in mlx* drivers
to ensure posix definitions - as well as C-standard ones - are
available.
V3:
* remove (now unneeded) use of -std=gnu99 in failsafe net driver.
V2:
* Resubmit now that 23.11-rc0 patch applied
* Add _POSIX_C_SOURCE macro to eal_common_errno.c to get POSIX
definition of strerror_r() with c11 standard.
---
doc/guides/linux_gsg/sys_reqs.rst | 3 ++-
doc/guides/rel_notes/deprecation.rst | 18 ------------------
doc/guides/rel_notes/release_23_11.rst | 17 +++++++++++++++++
drivers/common/mlx5/linux/meson.build | 5 +++--
drivers/net/failsafe/meson.build | 1 -
drivers/net/mlx4/meson.build | 4 ++--
lib/eal/common/eal_common_errno.c | 1 +
meson.build | 1 +
8 files changed, 26 insertions(+), 24 deletions(-)
Comments
On Tue, Aug 1, 2023 at 3:16 PM Bruce Richardson
<bruce.richardson@intel.com> wrote:
>
> As previously announced, DPDK 23.11 will require a C11 supporting
> compiler and will use the C11 standard in all builds.
>
> Forcing use of the C standard, rather than the standard with
> GNU extensions, means that some posix definitions which are not in
> the C standard are unavailable by default. We fix this by ensuring
> the correct defines or cflags are passed to the components that
> need them.
>
> Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
> Acked-by: Morten Brørup <mb@smartsharesystems.com>
> Acked-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
> ---
> V4:
> * pass cflags to the structure and definition checks in mlx* drivers
> to ensure posix definitions - as well as C-standard ones - are
> available.
With this v4, mlx4 builds fine in my Ubuntu 20.04.6 container.
However, I think the mlx4dv.h includes are probably faulty: as this
header is using off_t, it should include sys/types.h in the first
place.
https://github.com/linux-rdma/rdma-core/blob/master/providers/mlx4/mlx4dv.h#L36
This had been fixed in the mlx5 header in some rdma-core change in the
past: https://github.com/linux-rdma/rdma-core/commit/d2389b34ccc5
On Tue, Aug 01, 2023 at 03:24:19PM +0200, David Marchand wrote:
> On Tue, Aug 1, 2023 at 3:16 PM Bruce Richardson
> <bruce.richardson@intel.com> wrote:
> >
> > As previously announced, DPDK 23.11 will require a C11 supporting
> > compiler and will use the C11 standard in all builds.
> >
> > Forcing use of the C standard, rather than the standard with
> > GNU extensions, means that some posix definitions which are not in
> > the C standard are unavailable by default. We fix this by ensuring
> > the correct defines or cflags are passed to the components that
> > need them.
> >
> > Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
> > Acked-by: Morten Brørup <mb@smartsharesystems.com>
> > Acked-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
> > ---
> > V4:
> > * pass cflags to the structure and definition checks in mlx* drivers
> > to ensure posix definitions - as well as C-standard ones - are
> > available.
>
> With this v4, mlx4 builds fine in my Ubuntu 20.04.6 container.
> However, I think the mlx4dv.h includes are probably faulty: as this
> header is using off_t, it should include sys/types.h in the first
> place.
> https://github.com/linux-rdma/rdma-core/blob/master/providers/mlx4/mlx4dv.h#L36
>
> This had been fixed in the mlx5 header in some rdma-core change in the
> past: https://github.com/linux-rdma/rdma-core/commit/d2389b34ccc5
>
Even if that were fixed, I still think the correct behaviour in our build
here is to test the structures using the same flags as will be used to
build the final lib.
/Bruce
On Tue, Aug 1, 2023 at 3:29 PM Bruce Richardson
<bruce.richardson@intel.com> wrote:
>
> On Tue, Aug 01, 2023 at 03:24:19PM +0200, David Marchand wrote:
> > On Tue, Aug 1, 2023 at 3:16 PM Bruce Richardson
> > <bruce.richardson@intel.com> wrote:
> > >
> > > As previously announced, DPDK 23.11 will require a C11 supporting
> > > compiler and will use the C11 standard in all builds.
> > >
> > > Forcing use of the C standard, rather than the standard with
> > > GNU extensions, means that some posix definitions which are not in
> > > the C standard are unavailable by default. We fix this by ensuring
> > > the correct defines or cflags are passed to the components that
> > > need them.
> > >
> > > Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
> > > Acked-by: Morten Brørup <mb@smartsharesystems.com>
> > > Acked-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
> > > ---
> > > V4:
> > > * pass cflags to the structure and definition checks in mlx* drivers
> > > to ensure posix definitions - as well as C-standard ones - are
> > > available.
> >
> > With this v4, mlx4 builds fine in my Ubuntu 20.04.6 container.
> > However, I think the mlx4dv.h includes are probably faulty: as this
> > header is using off_t, it should include sys/types.h in the first
> > place.
> > https://github.com/linux-rdma/rdma-core/blob/master/providers/mlx4/mlx4dv.h#L36
> >
> > This had been fixed in the mlx5 header in some rdma-core change in the
> > past: https://github.com/linux-rdma/rdma-core/commit/d2389b34ccc5
> >
> Even if that were fixed, I still think the correct behaviour in our build
> here is to test the structures using the same flags as will be used to
> build the final lib.
Yes, compiling for testing and using the structures must be aligned.
> -----Original Message-----
> From: Bruce Richardson <bruce.richardson@intel.com>
> Sent: Tuesday, August 1, 2023 4:16 PM
> To: dev@dpdk.org
> Cc: Bruce Richardson <bruce.richardson@intel.com>; Morten Brørup
> <mb@smartsharesystems.com>; Tyler Retzlaff
> <roretzla@linux.microsoft.com>
> Subject: [PATCH v4] build: update DPDK to use C11 standard
>
> As previously announced, DPDK 23.11 will require a C11 supporting
> compiler and will use the C11 standard in all builds.
>
> Forcing use of the C standard, rather than the standard with
> GNU extensions, means that some posix definitions which are not in
> the C standard are unavailable by default. We fix this by ensuring
> the correct defines or cflags are passed to the components that
> need them.
>
> Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
> Acked-by: Morten Brørup <mb@smartsharesystems.com>
> Acked-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
> ---
By the way, I also see this build failure in RHEL 7:
[827/1011] Compiling C object app/dpdk-testpmd.p/test-pmd_cmdline_flow.c.o
FAILED: app/dpdk-testpmd.p/test-pmd_cmdline_flow.c.o
ccache cc -Iapp/dpdk-testpmd.p -Iapp -I../app -Iapp/test-pmd -I../app/test-pmd -Ilib/ethdev -I../lib/ethdev -I. -I.. -Iconfig -I../config -Ilib/eal/include -I../lib/eal/include -Ilib/eal/linux/include -I../lib/eal/linux/include -Ilib/eal/x86/include -I../lib/eal/x86/include -Ilib/eal/common -I../lib/eal/common -Ilib/eal -I../lib/eal -Ilib/kvargs -I../lib/kvargs -Ilib/metrics -I../lib/metrics -Ilib/telemetry -I../lib/telemetry -Ilib/net -I../lib/net -Ilib/mbuf -I../lib/mbuf -Ilib/mempool -I../lib/mempool -Ilib/ring -I../lib/ring -Ilib/meter -I../lib/meter -Ilib/cmdline -I../lib/cmdline -Ilib/bitratestats -I../lib/bitratestats -Ilib/bpf -I../lib/bpf -Ilib/gro -I../lib/gro -Ilib/gso -I../lib/gso -Ilib/latencystats -I../lib/latencystats -Ilib/pdump -I../lib/pdump -Ilib/pcapng -I../lib/pcapng -Idrivers/net/mlx5 -I../drivers/net/mlx5 -Idrivers/net/mlx5/linux -I../drivers/net/mlx5/linux -Idrivers/net/mlx5/hws -I../drivers/net/mlx5/hws -Idrivers/bus/pci -I../drivers/bus/pci -I../drivers/bus/pci/linux -Ilib/pci -I../lib/pci -Idrivers/bus/vdev -I../drivers/bus/vdev -Ilib/hash -I../lib/hash -Ilib/rcu -I../lib/rcu -Idrivers/common/mlx5 -I../drivers/common/mlx5 -Idrivers/common/mlx5/linux -I../drivers/common/mlx5/linux -Idrivers/bus/auxiliary -I../drivers/bus/auxiliary -pipe -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Wextra -Werror -std=c11 -O3 -include rte_config.h -Wcast-qual -Wdeprecated -Wformat -Wformat-nonliteral -Wformat-security -Wmissing-declarations -Wmissing-prototypes -Wnested-externs -Wold-style-definition -Wpointer-arith -Wsign-compare -Wstrict-prototypes -Wundef -Wwrite-strings -Wno-missing-field-initializers -D_GNU_SOURCE -march=native -DALLOW_EXPERIMENTAL_API -Wno-deprecated-declarations -MD -MQ app/dpdk-testpmd.p/test-pmd_cmdline_flow.c.o -MF app/dpdk-testpmd.p/test-pmd_cmdline_flow.c.o.d -o app/dpdk-testpmd.p/test-pmd_cmdline_flow.c.o -c ../app/test-pmd/cmdline_flow.c
../app/test-pmd/cmdline_flow.c: In function ‘parse_vc_spec’:
../app/test-pmd/cmdline_flow.c:1035:37: error: array initialized from non-constant array expression
#define NEXT_ENTRY(...) (const enum index []){ __VA_ARGS__, ZERO, }
^
../app/test-pmd/cmdline_flow.c:8049:38: note: in expansion of macro ‘NEXT_ENTRY’
static const enum index prefix[] = NEXT_ENTRY(COMMON_PREFIX);
^
../app/test-pmd/cmdline_flow.c: In function ‘parse_vc_action_rss_type’:
../app/test-pmd/cmdline_flow.c:1035:37: error: array initialized from non-constant array expression
#define NEXT_ENTRY(...) (const enum index []){ __VA_ARGS__, ZERO, }
^
../app/test-pmd/cmdline_flow.c:8391:35: note: in expansion of macro ‘NEXT_ENTRY’
static const enum index next[] = NEXT_ENTRY(ACTION_RSS_TYPE);
^
../app/test-pmd/cmdline_flow.c: In function ‘parse_vc_action_rss_queue’:
../app/test-pmd/cmdline_flow.c:1035:37: error: array initialized from non-constant array expression
#define NEXT_ENTRY(...) (const enum index []){ __VA_ARGS__, ZERO, }
^
../app/test-pmd/cmdline_flow.c:8435:35: note: in expansion of macro ‘NEXT_ENTRY’
static const enum index next[] = NEXT_ENTRY(ACTION_RSS_QUEUE);
^
[834/1011] Compiling C object app/dpdk-testpmd.p/test-pmd_config.c.o
ninja: build stopped: subcommand failed.
Meson: 1.2.0
Gcc: 4.8.5
On Tue, Aug 01, 2023 at 03:47:03PM +0000, Ali Alnubani wrote:
> > -----Original Message-----
> > From: Bruce Richardson <bruce.richardson@intel.com>
> > Sent: Tuesday, August 1, 2023 4:16 PM
> > To: dev@dpdk.org
> > Cc: Bruce Richardson <bruce.richardson@intel.com>; Morten Brørup
> > <mb@smartsharesystems.com>; Tyler Retzlaff
> > <roretzla@linux.microsoft.com>
> > Subject: [PATCH v4] build: update DPDK to use C11 standard
> >
> > As previously announced, DPDK 23.11 will require a C11 supporting
> > compiler and will use the C11 standard in all builds.
> >
> > Forcing use of the C standard, rather than the standard with
> > GNU extensions, means that some posix definitions which are not in
> > the C standard are unavailable by default. We fix this by ensuring
> > the correct defines or cflags are passed to the components that
> > need them.
> >
> > Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
> > Acked-by: Morten Brørup <mb@smartsharesystems.com>
> > Acked-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
> > ---
>
> By the way, I also see this build failure in RHEL 7:
>
It's my understanding that we no longer support the default compilers in
RHEL 7, since gcc 4.8.5 doesn't support the necessary c11 standard atomics.
/Bruce
On Tue, Aug 01, 2023 at 04:50:45PM +0100, Bruce Richardson wrote:
> On Tue, Aug 01, 2023 at 03:47:03PM +0000, Ali Alnubani wrote:
> > > -----Original Message-----
> > > From: Bruce Richardson <bruce.richardson@intel.com>
> > > Sent: Tuesday, August 1, 2023 4:16 PM
> > > To: dev@dpdk.org
> > > Cc: Bruce Richardson <bruce.richardson@intel.com>; Morten Brørup
> > > <mb@smartsharesystems.com>; Tyler Retzlaff
> > > <roretzla@linux.microsoft.com>
> > > Subject: [PATCH v4] build: update DPDK to use C11 standard
> > >
> > > As previously announced, DPDK 23.11 will require a C11 supporting
> > > compiler and will use the C11 standard in all builds.
> > >
> > > Forcing use of the C standard, rather than the standard with
> > > GNU extensions, means that some posix definitions which are not in
> > > the C standard are unavailable by default. We fix this by ensuring
> > > the correct defines or cflags are passed to the components that
> > > need them.
> > >
> > > Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
> > > Acked-by: Morten Brørup <mb@smartsharesystems.com>
> > > Acked-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
> > > ---
> >
> > By the way, I also see this build failure in RHEL 7:
> >
> It's my understanding that we no longer support the default compilers in
> RHEL 7, since gcc 4.8.5 doesn't support the necessary c11 standard atomics.
yes, support is being dropped for RHEL 7
http://mails.dpdk.org/archives/dev/2023-February/263516.html
it seems like now that we are in 23.11 merge window the CI pipelines for
the unsupported targets can be decomissioned?
>
> /Bruce
On Tue, Aug 1, 2023 at 12:20 PM Tyler Retzlaff <roretzla@linux.microsoft.com>
wrote:
>
> yes, support is being dropped for RHEL 7
>
> http://mails.dpdk.org/archives/dev/2023-February/263516.html
>
> it seems like now that we are in 23.11 merge window the CI pipelines for
> the unsupported targets can be decomissioned?
>
> >
> > /Bruce
>
The Community Lab will discontinue CI testing on RHEL7 at start of day
tomorrow.
On Tue, Aug 1, 2023 at 10:12 PM Patrick Robb <probb@iol.unh.edu> wrote:
> On Tue, Aug 1, 2023 at 12:20 PM Tyler Retzlaff <roretzla@linux.microsoft.com> wrote:
>>
>>
>> yes, support is being dropped for RHEL 7
in the main branch.
>>
>> http://mails.dpdk.org/archives/dev/2023-February/263516.html
>>
>> it seems like now that we are in 23.11 merge window the CI pipelines for
>> the unsupported targets can be decomissioned?
>
> The Community Lab will discontinue CI testing on RHEL7 at start of day tomorrow
What about the LTS releases testing?
On Wed, Aug 2, 2023 at 2:32 AM David Marchand <david.marchand@redhat.com>
wrote:
> What about the LTS releases testing?
>
>
> --
> David Marchand
>
>
Okay, we will disable rhel7 testing for dpdk main and next branches, but
leave testing on for the LTS releases.
On Wed, Aug 2, 2023 at 3:41 PM Patrick Robb <probb@iol.unh.edu> wrote:
> On Wed, Aug 2, 2023 at 2:32 AM David Marchand <david.marchand@redhat.com> wrote:
>>
>> What about the LTS releases testing?
>
> Okay, we will disable rhel7 testing for dpdk main and next branches, but leave testing on for the LTS releases.
Thank you Patrick.
@@ -27,7 +27,8 @@ Compilation of the DPDK
The setup commands and installed packages needed on various systems may be different.
For details on Linux distributions and the versions tested, please consult the DPDK Release Notes.
-* General development tools including a supported C compiler such as gcc (version 4.9+) or clang (version 3.4+),
+* General development tools including a C compiler supporting the C11 standard,
+ including standard atomics, for example: GCC (version 5.0+) or Clang (version 3.6+),
and ``pkg-config`` or ``pkgconf`` to be used when building end-user binaries against DPDK.
* For RHEL/Fedora systems these can be installed using ``dnf groupinstall "Development Tools"``
@@ -17,24 +17,6 @@ Other API and ABI deprecation notices are to be posted below.
Deprecation Notices
-------------------
-* C Compiler: From DPDK 23.11 onwards,
- building DPDK will require a C compiler which supports the C11 standard,
- including support for C11 standard atomics.
-
- More specifically, the requirements will be:
-
- * Support for flag "-std=c11" (or similar)
- * __STDC_NO_ATOMICS__ is *not defined* when using c11 flag
-
- Please note:
-
- * C11, including standard atomics, is supported from GCC version 5 onwards,
- and is the default language version in that release
- (Ref: https://gcc.gnu.org/gcc-5/changes.html)
- * C11 is the default compilation mode in Clang from version 3.6,
- which also added support for standard atomics
- (Ref: https://releases.llvm.org/3.6.0/tools/clang/docs/ReleaseNotes.html)
-
* build: Enabling deprecated libraries (``flow_classify``, ``kni``)
won't be possible anymore through the use of the ``disable_libs`` build option.
A new build option for deprecated libraries will be introduced instead.
@@ -20,6 +20,23 @@ DPDK Release 23.11
ninja -C build doc
xdg-open build/doc/guides/html/rel_notes/release_23_11.html
+* Build Requirements: From DPDK 23.11 onwards,
+ building DPDK will require a C compiler which supports the C11 standard,
+ including support for C11 standard atomics.
+
+ More specifically, the requirements will be:
+
+ * Support for flag "-std=c11" (or similar)
+ * __STDC_NO_ATOMICS__ is *not defined* when using c11 flag
+
+ Please note:
+
+ * C11, including standard atomics, is supported from GCC version 5 onwards,
+ and is the default language version in that release
+ (Ref: https://gcc.gnu.org/gcc-5/changes.html)
+ * C11 is the default compilation mode in Clang from version 3.6,
+ which also added support for standard atomics
+ (Ref: https://releases.llvm.org/3.6.0/tools/clang/docs/ReleaseNotes.html)
New Features
------------
@@ -231,11 +231,12 @@ if libmtcr_ul_found
endif
foreach arg:has_sym_args
- mlx5_config.set(arg[0], cc.has_header_symbol(arg[1], arg[2], dependencies: libs))
+ mlx5_config.set(arg[0], cc.has_header_symbol(arg[1], arg[2], dependencies: libs, args: cflags))
endforeach
foreach arg:has_member_args
file_prefix = '#include <' + arg[1] + '>'
- mlx5_config.set(arg[0], cc.has_member(arg[2], arg[3], prefix : file_prefix, dependencies: libs))
+ mlx5_config.set(arg[0],
+ cc.has_member(arg[2], arg[3], prefix : file_prefix, dependencies: libs, args: cflags))
endforeach
# Build Glue Library
@@ -7,7 +7,6 @@ if is_windows
subdir_done()
endif
-cflags += '-std=gnu99'
cflags += '-D_DEFAULT_SOURCE'
cflags += '-D_XOPEN_SOURCE=700'
cflags += '-pedantic'
@@ -103,12 +103,12 @@ has_sym_args = [
config = configuration_data()
foreach arg:has_sym_args
config.set(arg[0], cc.has_header_symbol(arg[1], arg[2],
- dependencies: libs))
+ dependencies: libs, args: cflags))
endforeach
foreach arg:has_member_args
file_prefix = '#include <' + arg[1] + '>'
config.set(arg[0], cc.has_member(arg[2], arg[3],
- prefix: file_prefix, dependencies: libs))
+ prefix: file_prefix, dependencies: libs, args: cflags))
endforeach
configure_file(output : 'mlx4_autoconf.h', configuration : config)
@@ -4,6 +4,7 @@
/* Use XSI-compliant portable version of strerror_r() */
#undef _GNU_SOURCE
+#define _POSIX_C_SOURCE 200809L
#include <stdio.h>
#include <string.h>
@@ -9,6 +9,7 @@ project('DPDK', 'c',
license: 'BSD',
default_options: [
'buildtype=release',
+ 'c_std=c11',
'default_library=static',
'warning_level=2',
],