DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH v2 0/1] Enable BSD features visibility for FreeBSD
@ 2019-05-14 14:04 Marcin Smoczynski
  2019-05-14 14:04 ` Marcin Smoczynski
  2019-05-14 14:04 ` [dpdk-dev] [PATCH v2 1/1] build: enable " Marcin Smoczynski
  0 siblings, 2 replies; 9+ messages in thread
From: Marcin Smoczynski @ 2019-05-14 14:04 UTC (permalink / raw)
  To: bruce.richardson, thomas
  Cc: dev, konstantin.ananyev, adrien.mazarguil, Marcin Smoczynski

v1 -> v2
* merge multiple -D__BSD_VISIBLE into one
* merge multiple -D_GNU_SOURCE into one
* add -D__BSD_VISIBLE to pc file for FreeBSD

Marcin Smoczynski (1):
  build: enable BSD features visibility for FreeBSD

 app/meson.build               | 3 ---
 config/meson.build            | 8 ++++++++
 drivers/meson.build           | 3 ---
 examples/meson.build          | 3 ---
 lib/meson.build               | 3 ---
 meson.build                   | 6 +++++-
 mk/target/generic/rte.vars.mk | 5 +++++
 7 files changed, 18 insertions(+), 13 deletions(-)

--
2.17.1

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [dpdk-dev] [PATCH v2 0/1] Enable BSD features visibility for FreeBSD
  2019-05-14 14:04 [dpdk-dev] [PATCH v2 0/1] Enable BSD features visibility for FreeBSD Marcin Smoczynski
@ 2019-05-14 14:04 ` Marcin Smoczynski
  2019-05-14 14:04 ` [dpdk-dev] [PATCH v2 1/1] build: enable " Marcin Smoczynski
  1 sibling, 0 replies; 9+ messages in thread
From: Marcin Smoczynski @ 2019-05-14 14:04 UTC (permalink / raw)
  To: bruce.richardson, thomas
  Cc: dev, konstantin.ananyev, adrien.mazarguil, Marcin Smoczynski

v1 -> v2
* merge multiple -D__BSD_VISIBLE into one
* merge multiple -D_GNU_SOURCE into one
* add -D__BSD_VISIBLE to pc file for FreeBSD

Marcin Smoczynski (1):
  build: enable BSD features visibility for FreeBSD

 app/meson.build               | 3 ---
 config/meson.build            | 8 ++++++++
 drivers/meson.build           | 3 ---
 examples/meson.build          | 3 ---
 lib/meson.build               | 3 ---
 meson.build                   | 6 +++++-
 mk/target/generic/rte.vars.mk | 5 +++++
 7 files changed, 18 insertions(+), 13 deletions(-)

--
2.17.1


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [dpdk-dev] [PATCH v2 1/1] build: enable BSD features visibility for FreeBSD
  2019-05-14 14:04 [dpdk-dev] [PATCH v2 0/1] Enable BSD features visibility for FreeBSD Marcin Smoczynski
  2019-05-14 14:04 ` Marcin Smoczynski
@ 2019-05-14 14:04 ` Marcin Smoczynski
  2019-05-14 14:04   ` Marcin Smoczynski
                     ` (2 more replies)
  1 sibling, 3 replies; 9+ messages in thread
From: Marcin Smoczynski @ 2019-05-14 14:04 UTC (permalink / raw)
  To: bruce.richardson, thomas
  Cc: dev, konstantin.ananyev, adrien.mazarguil, Marcin Smoczynski

When a component uses either XOPEN_SOURCE or POSIX_C_SOURCE macro
explicitly in its build recipe, it restricts visibility of a non POSIX
features subset, such as IANA protocol numbers (IPPROTO_* macros).
Non standard features are enabled by default for DPDK both for Linux
thanks to _GNU_SOURCE and for FreeBSD thanks to __BSD_VISIBLE. However
using XOPEN_SOURCE or POSIX_(C_)SOURCE in a component causes
__BSD_VISIBLE to be defined to 0 for FreeBSD, causing different feature
sets visibility for Linux and FreeBSD. It restricts from using IPPROTO
macros in public headers, such as rte_ip.h, despite the fact they are
already widely used in sources.

Add __BSD_VISIBLE macro specified unconditionally for FreeBSD targets
which enforces feature sets visibility unification between Linux and
FreeBSD.

Add single -D_GNU_SOURCE to config/meson.build as a project argument
instead of adding separate directive for each project subtree.

This patch solves the problem of build breaks for [1] on FreeBSD [2]
following the discussion [3].

[1] https://mails.dpdk.org/archives/dev/2019-May/131885.html
[2] http://mails.dpdk.org/archives/test-report/2019-May/082263.html
[3] https://mails.dpdk.org/archives/dev/2019-May/132110.html

Signed-off-by: Marcin Smoczynski <marcinx.smoczynski@intel.com>
---
 app/meson.build               | 3 ---
 config/meson.build            | 8 ++++++++
 drivers/meson.build           | 3 ---
 examples/meson.build          | 3 ---
 lib/meson.build               | 3 ---
 meson.build                   | 6 +++++-
 mk/target/generic/rte.vars.mk | 5 +++++
 7 files changed, 18 insertions(+), 13 deletions(-)

diff --git a/app/meson.build b/app/meson.build
index 2b9fdef74..b0e6afbbe 100644
--- a/app/meson.build
+++ b/app/meson.build
@@ -22,9 +22,6 @@ lib_execinfo = cc.find_library('execinfo', required: false)
 
 default_cflags = machine_args
 
-# specify -D_GNU_SOURCE unconditionally
-default_cflags += '-D_GNU_SOURCE'
-
 foreach app:apps
 	build = true
 	name = app
diff --git a/config/meson.build b/config/meson.build
index 0d25646f5..b77c87811 100644
--- a/config/meson.build
+++ b/config/meson.build
@@ -187,3 +187,11 @@ install_headers('rte_config.h', subdir: get_option('include_subdir_arch'))
 
 # enable VFIO only if it is linux OS
 dpdk_conf.set('RTE_EAL_VFIO', is_linux)
+
+# specify -D_GNU_SOURCE unconditionally
+add_project_arguments('-D_GNU_SOURCE', language: 'c')
+
+# specify -D__BSD_VISIBLE for FreeBSD
+if is_freebsd
+	add_project_arguments('-D__BSD_VISIBLE', language: 'c')
+endif
diff --git a/drivers/meson.build b/drivers/meson.build
index 4c444f495..dc47b45ec 100644
--- a/drivers/meson.build
+++ b/drivers/meson.build
@@ -21,9 +21,6 @@ if cc.has_argument('-Wno-format-truncation')
 	default_cflags += '-Wno-format-truncation'
 endif
 
-# specify -D_GNU_SOURCE unconditionally
-default_cflags += '-D_GNU_SOURCE'
-
 foreach class:dpdk_driver_classes
 	drivers = []
 	std_deps = []
diff --git a/examples/meson.build b/examples/meson.build
index 1a6134f12..6e18ca8ec 100644
--- a/examples/meson.build
+++ b/examples/meson.build
@@ -31,9 +31,6 @@ if cc.has_argument('-Wno-format-truncation')
 	default_cflags += '-Wno-format-truncation'
 endif
 
-# specify -D_GNU_SOURCE unconditionally
-default_cflags += '-D_GNU_SOURCE'
-
 foreach example: examples
 	name = example
 	build = true
diff --git a/lib/meson.build b/lib/meson.build
index e067ce5ea..dd7c94c03 100644
--- a/lib/meson.build
+++ b/lib/meson.build
@@ -41,9 +41,6 @@ endif
 
 enabled_libs = [] # used to print summary at the end
 
-# -D_GNU_SOURCE unconditionally
-default_cflags += '-D_GNU_SOURCE'
-
 foreach l:libraries
 	build = true
 	name = l
diff --git a/meson.build b/meson.build
index 46f9c5683..05c816a9e 100644
--- a/meson.build
+++ b/meson.build
@@ -64,6 +64,10 @@ configure_file(output: build_cfg,
 dpdk_drivers = ['-Wl,--whole-archive'] + dpdk_drivers + ['-Wl,--no-whole-archive']
 
 pkg = import('pkgconfig')
+pkg_extra_cflags = ['-include', 'rte_config.h'] + machine_args
+if is_freebsd
+	pkg_extra_cflags += ['-D__BSD_VISIBLE']
+endif
 pkg.generate(name: meson.project_name(),
 	filebase: 'lib' + meson.project_name().to_lower(),
 	version: meson.project_version(),
@@ -76,7 +80,7 @@ pkg.generate(name: meson.project_name(),
 Note that CFLAGS might contain an -march flag higher than typical baseline.
 This is required for a number of static inline functions in the public headers.''',
 	subdirs: [get_option('include_subdir_arch'), '.'],
-	extra_cflags: ['-include', 'rte_config.h'] + machine_args
+	extra_cflags: pkg_extra_cflags
 )
 
 # final output, list all the libs and drivers to be built
diff --git a/mk/target/generic/rte.vars.mk b/mk/target/generic/rte.vars.mk
index 25a578ad7..5f00a0bfa 100644
--- a/mk/target/generic/rte.vars.mk
+++ b/mk/target/generic/rte.vars.mk
@@ -111,6 +111,11 @@ endif
 # always define _GNU_SOURCE
 CFLAGS += -D_GNU_SOURCE
 
+# define __BSD_VISIBLE when building for FreeBSD
+ifeq ($(CONFIG_RTE_EXEC_ENV_FREEBSD),y)
+CFLAGS += -D__BSD_VISIBLE
+endif
+
 export CFLAGS
 export LDFLAGS
 
-- 
2.17.1

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [dpdk-dev] [PATCH v2 1/1] build: enable BSD features visibility for FreeBSD
  2019-05-14 14:04 ` [dpdk-dev] [PATCH v2 1/1] build: enable " Marcin Smoczynski
@ 2019-05-14 14:04   ` Marcin Smoczynski
  2019-06-05  9:37   ` Thomas Monjalon
  2019-06-05 10:15   ` Ananyev, Konstantin
  2 siblings, 0 replies; 9+ messages in thread
From: Marcin Smoczynski @ 2019-05-14 14:04 UTC (permalink / raw)
  To: bruce.richardson, thomas
  Cc: dev, konstantin.ananyev, adrien.mazarguil, Marcin Smoczynski

When a component uses either XOPEN_SOURCE or POSIX_C_SOURCE macro
explicitly in its build recipe, it restricts visibility of a non POSIX
features subset, such as IANA protocol numbers (IPPROTO_* macros).
Non standard features are enabled by default for DPDK both for Linux
thanks to _GNU_SOURCE and for FreeBSD thanks to __BSD_VISIBLE. However
using XOPEN_SOURCE or POSIX_(C_)SOURCE in a component causes
__BSD_VISIBLE to be defined to 0 for FreeBSD, causing different feature
sets visibility for Linux and FreeBSD. It restricts from using IPPROTO
macros in public headers, such as rte_ip.h, despite the fact they are
already widely used in sources.

Add __BSD_VISIBLE macro specified unconditionally for FreeBSD targets
which enforces feature sets visibility unification between Linux and
FreeBSD.

Add single -D_GNU_SOURCE to config/meson.build as a project argument
instead of adding separate directive for each project subtree.

This patch solves the problem of build breaks for [1] on FreeBSD [2]
following the discussion [3].

[1] https://mails.dpdk.org/archives/dev/2019-May/131885.html
[2] http://mails.dpdk.org/archives/test-report/2019-May/082263.html
[3] https://mails.dpdk.org/archives/dev/2019-May/132110.html

Signed-off-by: Marcin Smoczynski <marcinx.smoczynski@intel.com>
---
 app/meson.build               | 3 ---
 config/meson.build            | 8 ++++++++
 drivers/meson.build           | 3 ---
 examples/meson.build          | 3 ---
 lib/meson.build               | 3 ---
 meson.build                   | 6 +++++-
 mk/target/generic/rte.vars.mk | 5 +++++
 7 files changed, 18 insertions(+), 13 deletions(-)

diff --git a/app/meson.build b/app/meson.build
index 2b9fdef74..b0e6afbbe 100644
--- a/app/meson.build
+++ b/app/meson.build
@@ -22,9 +22,6 @@ lib_execinfo = cc.find_library('execinfo', required: false)
 
 default_cflags = machine_args
 
-# specify -D_GNU_SOURCE unconditionally
-default_cflags += '-D_GNU_SOURCE'
-
 foreach app:apps
 	build = true
 	name = app
diff --git a/config/meson.build b/config/meson.build
index 0d25646f5..b77c87811 100644
--- a/config/meson.build
+++ b/config/meson.build
@@ -187,3 +187,11 @@ install_headers('rte_config.h', subdir: get_option('include_subdir_arch'))
 
 # enable VFIO only if it is linux OS
 dpdk_conf.set('RTE_EAL_VFIO', is_linux)
+
+# specify -D_GNU_SOURCE unconditionally
+add_project_arguments('-D_GNU_SOURCE', language: 'c')
+
+# specify -D__BSD_VISIBLE for FreeBSD
+if is_freebsd
+	add_project_arguments('-D__BSD_VISIBLE', language: 'c')
+endif
diff --git a/drivers/meson.build b/drivers/meson.build
index 4c444f495..dc47b45ec 100644
--- a/drivers/meson.build
+++ b/drivers/meson.build
@@ -21,9 +21,6 @@ if cc.has_argument('-Wno-format-truncation')
 	default_cflags += '-Wno-format-truncation'
 endif
 
-# specify -D_GNU_SOURCE unconditionally
-default_cflags += '-D_GNU_SOURCE'
-
 foreach class:dpdk_driver_classes
 	drivers = []
 	std_deps = []
diff --git a/examples/meson.build b/examples/meson.build
index 1a6134f12..6e18ca8ec 100644
--- a/examples/meson.build
+++ b/examples/meson.build
@@ -31,9 +31,6 @@ if cc.has_argument('-Wno-format-truncation')
 	default_cflags += '-Wno-format-truncation'
 endif
 
-# specify -D_GNU_SOURCE unconditionally
-default_cflags += '-D_GNU_SOURCE'
-
 foreach example: examples
 	name = example
 	build = true
diff --git a/lib/meson.build b/lib/meson.build
index e067ce5ea..dd7c94c03 100644
--- a/lib/meson.build
+++ b/lib/meson.build
@@ -41,9 +41,6 @@ endif
 
 enabled_libs = [] # used to print summary at the end
 
-# -D_GNU_SOURCE unconditionally
-default_cflags += '-D_GNU_SOURCE'
-
 foreach l:libraries
 	build = true
 	name = l
diff --git a/meson.build b/meson.build
index 46f9c5683..05c816a9e 100644
--- a/meson.build
+++ b/meson.build
@@ -64,6 +64,10 @@ configure_file(output: build_cfg,
 dpdk_drivers = ['-Wl,--whole-archive'] + dpdk_drivers + ['-Wl,--no-whole-archive']
 
 pkg = import('pkgconfig')
+pkg_extra_cflags = ['-include', 'rte_config.h'] + machine_args
+if is_freebsd
+	pkg_extra_cflags += ['-D__BSD_VISIBLE']
+endif
 pkg.generate(name: meson.project_name(),
 	filebase: 'lib' + meson.project_name().to_lower(),
 	version: meson.project_version(),
@@ -76,7 +80,7 @@ pkg.generate(name: meson.project_name(),
 Note that CFLAGS might contain an -march flag higher than typical baseline.
 This is required for a number of static inline functions in the public headers.''',
 	subdirs: [get_option('include_subdir_arch'), '.'],
-	extra_cflags: ['-include', 'rte_config.h'] + machine_args
+	extra_cflags: pkg_extra_cflags
 )
 
 # final output, list all the libs and drivers to be built
diff --git a/mk/target/generic/rte.vars.mk b/mk/target/generic/rte.vars.mk
index 25a578ad7..5f00a0bfa 100644
--- a/mk/target/generic/rte.vars.mk
+++ b/mk/target/generic/rte.vars.mk
@@ -111,6 +111,11 @@ endif
 # always define _GNU_SOURCE
 CFLAGS += -D_GNU_SOURCE
 
+# define __BSD_VISIBLE when building for FreeBSD
+ifeq ($(CONFIG_RTE_EXEC_ENV_FREEBSD),y)
+CFLAGS += -D__BSD_VISIBLE
+endif
+
 export CFLAGS
 export LDFLAGS
 
-- 
2.17.1


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [dpdk-dev] [PATCH v2 1/1] build: enable BSD features visibility for FreeBSD
  2019-05-14 14:04 ` [dpdk-dev] [PATCH v2 1/1] build: enable " Marcin Smoczynski
  2019-05-14 14:04   ` Marcin Smoczynski
@ 2019-06-05  9:37   ` Thomas Monjalon
  2019-06-05 10:02     ` Bruce Richardson
  2019-06-05 10:15   ` Ananyev, Konstantin
  2 siblings, 1 reply; 9+ messages in thread
From: Thomas Monjalon @ 2019-06-05  9:37 UTC (permalink / raw)
  To: bruce.richardson, konstantin.ananyev, adrien.mazarguil
  Cc: dev, Marcin Smoczynski

Marcin, please remind to use --in-reply-to to have next versions
in the same thread. Thanks

Bruce, Konstantin, Adrien, any opinion about this patch?


14/05/2019 16:04, Marcin Smoczynski:
> When a component uses either XOPEN_SOURCE or POSIX_C_SOURCE macro
> explicitly in its build recipe, it restricts visibility of a non POSIX
> features subset, such as IANA protocol numbers (IPPROTO_* macros).
> Non standard features are enabled by default for DPDK both for Linux
> thanks to _GNU_SOURCE and for FreeBSD thanks to __BSD_VISIBLE. However
> using XOPEN_SOURCE or POSIX_(C_)SOURCE in a component causes
> __BSD_VISIBLE to be defined to 0 for FreeBSD, causing different feature
> sets visibility for Linux and FreeBSD. It restricts from using IPPROTO
> macros in public headers, such as rte_ip.h, despite the fact they are
> already widely used in sources.
> 
> Add __BSD_VISIBLE macro specified unconditionally for FreeBSD targets
> which enforces feature sets visibility unification between Linux and
> FreeBSD.
> 
> Add single -D_GNU_SOURCE to config/meson.build as a project argument
> instead of adding separate directive for each project subtree.
> 
> This patch solves the problem of build breaks for [1] on FreeBSD [2]
> following the discussion [3].
> 
> [1] https://mails.dpdk.org/archives/dev/2019-May/131885.html
> [2] http://mails.dpdk.org/archives/test-report/2019-May/082263.html
> [3] https://mails.dpdk.org/archives/dev/2019-May/132110.html
> 
> Signed-off-by: Marcin Smoczynski <marcinx.smoczynski@intel.com>





^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [dpdk-dev] [PATCH v2 1/1] build: enable BSD features visibility for FreeBSD
  2019-06-05  9:37   ` Thomas Monjalon
@ 2019-06-05 10:02     ` Bruce Richardson
  0 siblings, 0 replies; 9+ messages in thread
From: Bruce Richardson @ 2019-06-05 10:02 UTC (permalink / raw)
  To: Thomas Monjalon
  Cc: konstantin.ananyev, adrien.mazarguil, dev, Marcin Smoczynski

On Wed, Jun 05, 2019 at 11:37:34AM +0200, Thomas Monjalon wrote:
> Marcin, please remind to use --in-reply-to to have next versions
> in the same thread. Thanks
> 
> Bruce, Konstantin, Adrien, any opinion about this patch?
> 
Looks a reasonable cleanup to me. The fact that the same macros are being
defined in multiple places implies that it would be good to consolidate
them.

> 
> 14/05/2019 16:04, Marcin Smoczynski:
> > When a component uses either XOPEN_SOURCE or POSIX_C_SOURCE macro
> > explicitly in its build recipe, it restricts visibility of a non POSIX
> > features subset, such as IANA protocol numbers (IPPROTO_* macros).
> > Non standard features are enabled by default for DPDK both for Linux
> > thanks to _GNU_SOURCE and for FreeBSD thanks to __BSD_VISIBLE. However
> > using XOPEN_SOURCE or POSIX_(C_)SOURCE in a component causes
> > __BSD_VISIBLE to be defined to 0 for FreeBSD, causing different feature
> > sets visibility for Linux and FreeBSD. It restricts from using IPPROTO
> > macros in public headers, such as rte_ip.h, despite the fact they are
> > already widely used in sources.
> > 
> > Add __BSD_VISIBLE macro specified unconditionally for FreeBSD targets
> > which enforces feature sets visibility unification between Linux and
> > FreeBSD.
> > 
> > Add single -D_GNU_SOURCE to config/meson.build as a project argument
> > instead of adding separate directive for each project subtree.
> > 
> > This patch solves the problem of build breaks for [1] on FreeBSD [2]
> > following the discussion [3].
> > 
> > [1] https://mails.dpdk.org/archives/dev/2019-May/131885.html
> > [2] http://mails.dpdk.org/archives/test-report/2019-May/082263.html
> > [3] https://mails.dpdk.org/archives/dev/2019-May/132110.html
> > 
> > Signed-off-by: Marcin Smoczynski <marcinx.smoczynski@intel.com>
> 
Acked-by: Bruce Richardson <bruce.richardson@intel.com>

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [dpdk-dev] [PATCH v2 1/1] build: enable BSD features visibility for FreeBSD
  2019-05-14 14:04 ` [dpdk-dev] [PATCH v2 1/1] build: enable " Marcin Smoczynski
  2019-05-14 14:04   ` Marcin Smoczynski
  2019-06-05  9:37   ` Thomas Monjalon
@ 2019-06-05 10:15   ` Ananyev, Konstantin
  2019-06-17 12:36     ` Smoczynski, MarcinX
  2019-06-26 14:51     ` Thomas Monjalon
  2 siblings, 2 replies; 9+ messages in thread
From: Ananyev, Konstantin @ 2019-06-05 10:15 UTC (permalink / raw)
  To: Smoczynski, MarcinX, Richardson, Bruce, thomas; +Cc: dev, adrien.mazarguil


> 
> When a component uses either XOPEN_SOURCE or POSIX_C_SOURCE macro
> explicitly in its build recipe, it restricts visibility of a non POSIX
> features subset, such as IANA protocol numbers (IPPROTO_* macros).
> Non standard features are enabled by default for DPDK both for Linux
> thanks to _GNU_SOURCE and for FreeBSD thanks to __BSD_VISIBLE. However
> using XOPEN_SOURCE or POSIX_(C_)SOURCE in a component causes
> __BSD_VISIBLE to be defined to 0 for FreeBSD, causing different feature
> sets visibility for Linux and FreeBSD. It restricts from using IPPROTO
> macros in public headers, such as rte_ip.h, despite the fact they are
> already widely used in sources.
> 
> Add __BSD_VISIBLE macro specified unconditionally for FreeBSD targets
> which enforces feature sets visibility unification between Linux and
> FreeBSD.
> 
> Add single -D_GNU_SOURCE to config/meson.build as a project argument
> instead of adding separate directive for each project subtree.
> 
> This patch solves the problem of build breaks for [1] on FreeBSD [2]
> following the discussion [3].
> 
> [1] https://mails.dpdk.org/archives/dev/2019-May/131885.html
> [2] http://mails.dpdk.org/archives/test-report/2019-May/082263.html
> [3] https://mails.dpdk.org/archives/dev/2019-May/132110.html
> 
> Signed-off-by: Marcin Smoczynski <marcinx.smoczynski@intel.com>
> ---
>  app/meson.build               | 3 ---
>  config/meson.build            | 8 ++++++++
>  drivers/meson.build           | 3 ---
>  examples/meson.build          | 3 ---
>  lib/meson.build               | 3 ---
>  meson.build                   | 6 +++++-
>  mk/target/generic/rte.vars.mk | 5 +++++
>  7 files changed, 18 insertions(+), 13 deletions(-)
> 
> diff --git a/app/meson.build b/app/meson.build
> index 2b9fdef74..b0e6afbbe 100644
> --- a/app/meson.build
> +++ b/app/meson.build
> @@ -22,9 +22,6 @@ lib_execinfo = cc.find_library('execinfo', required: false)
> 
>  default_cflags = machine_args
> 
> -# specify -D_GNU_SOURCE unconditionally
> -default_cflags += '-D_GNU_SOURCE'
> -
>  foreach app:apps
>  	build = true
>  	name = app
> diff --git a/config/meson.build b/config/meson.build
> index 0d25646f5..b77c87811 100644
> --- a/config/meson.build
> +++ b/config/meson.build
> @@ -187,3 +187,11 @@ install_headers('rte_config.h', subdir: get_option('include_subdir_arch'))
> 
>  # enable VFIO only if it is linux OS
>  dpdk_conf.set('RTE_EAL_VFIO', is_linux)
> +
> +# specify -D_GNU_SOURCE unconditionally
> +add_project_arguments('-D_GNU_SOURCE', language: 'c')
> +
> +# specify -D__BSD_VISIBLE for FreeBSD
> +if is_freebsd
> +	add_project_arguments('-D__BSD_VISIBLE', language: 'c')
> +endif
> diff --git a/drivers/meson.build b/drivers/meson.build
> index 4c444f495..dc47b45ec 100644
> --- a/drivers/meson.build
> +++ b/drivers/meson.build
> @@ -21,9 +21,6 @@ if cc.has_argument('-Wno-format-truncation')
>  	default_cflags += '-Wno-format-truncation'
>  endif
> 
> -# specify -D_GNU_SOURCE unconditionally
> -default_cflags += '-D_GNU_SOURCE'
> -
>  foreach class:dpdk_driver_classes
>  	drivers = []
>  	std_deps = []
> diff --git a/examples/meson.build b/examples/meson.build
> index 1a6134f12..6e18ca8ec 100644
> --- a/examples/meson.build
> +++ b/examples/meson.build
> @@ -31,9 +31,6 @@ if cc.has_argument('-Wno-format-truncation')
>  	default_cflags += '-Wno-format-truncation'
>  endif
> 
> -# specify -D_GNU_SOURCE unconditionally
> -default_cflags += '-D_GNU_SOURCE'
> -
>  foreach example: examples
>  	name = example
>  	build = true
> diff --git a/lib/meson.build b/lib/meson.build
> index e067ce5ea..dd7c94c03 100644
> --- a/lib/meson.build
> +++ b/lib/meson.build
> @@ -41,9 +41,6 @@ endif
> 
>  enabled_libs = [] # used to print summary at the end
> 
> -# -D_GNU_SOURCE unconditionally
> -default_cflags += '-D_GNU_SOURCE'
> -
>  foreach l:libraries
>  	build = true
>  	name = l
> diff --git a/meson.build b/meson.build
> index 46f9c5683..05c816a9e 100644
> --- a/meson.build
> +++ b/meson.build
> @@ -64,6 +64,10 @@ configure_file(output: build_cfg,
>  dpdk_drivers = ['-Wl,--whole-archive'] + dpdk_drivers + ['-Wl,--no-whole-archive']
> 
>  pkg = import('pkgconfig')
> +pkg_extra_cflags = ['-include', 'rte_config.h'] + machine_args
> +if is_freebsd
> +	pkg_extra_cflags += ['-D__BSD_VISIBLE']
> +endif
>  pkg.generate(name: meson.project_name(),
>  	filebase: 'lib' + meson.project_name().to_lower(),
>  	version: meson.project_version(),
> @@ -76,7 +80,7 @@ pkg.generate(name: meson.project_name(),
>  Note that CFLAGS might contain an -march flag higher than typical baseline.
>  This is required for a number of static inline functions in the public headers.''',
>  	subdirs: [get_option('include_subdir_arch'), '.'],
> -	extra_cflags: ['-include', 'rte_config.h'] + machine_args
> +	extra_cflags: pkg_extra_cflags
>  )
> 
>  # final output, list all the libs and drivers to be built
> diff --git a/mk/target/generic/rte.vars.mk b/mk/target/generic/rte.vars.mk
> index 25a578ad7..5f00a0bfa 100644
> --- a/mk/target/generic/rte.vars.mk
> +++ b/mk/target/generic/rte.vars.mk
> @@ -111,6 +111,11 @@ endif
>  # always define _GNU_SOURCE
>  CFLAGS += -D_GNU_SOURCE
> 
> +# define __BSD_VISIBLE when building for FreeBSD
> +ifeq ($(CONFIG_RTE_EXEC_ENV_FREEBSD),y)
> +CFLAGS += -D__BSD_VISIBLE
> +endif
> +
>  export CFLAGS
>  export LDFLAGS
> 
> --

Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>

> 2.17.1


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [dpdk-dev] [PATCH v2 1/1] build: enable BSD features visibility for FreeBSD
  2019-06-05 10:15   ` Ananyev, Konstantin
@ 2019-06-17 12:36     ` Smoczynski, MarcinX
  2019-06-26 14:51     ` Thomas Monjalon
  1 sibling, 0 replies; 9+ messages in thread
From: Smoczynski, MarcinX @ 2019-06-17 12:36 UTC (permalink / raw)
  To: Ananyev, Konstantin, Richardson, Bruce, thomas; +Cc: dev, adrien.mazarguil

Is my action required to merge patches? e.g. do I need to send rebased patches (however there are no conflicts at the moment)?

> -----Original Message-----
> From: Ananyev, Konstantin
> Sent: Wednesday, June 5, 2019 12:16 PM
> To: Smoczynski, MarcinX <marcinx.smoczynski@intel.com>; Richardson,
> Bruce <bruce.richardson@intel.com>; thomas@monjalon.net
> Cc: dev@dpdk.org; adrien.mazarguil@6wind.com
> Subject: RE: [PATCH v2 1/1] build: enable BSD features visibility for FreeBSD
> 
> 
> >
> > When a component uses either XOPEN_SOURCE or POSIX_C_SOURCE
> macro
> > explicitly in its build recipe, it restricts visibility of a non POSIX
> > features subset, such as IANA protocol numbers (IPPROTO_* macros).
> > Non standard features are enabled by default for DPDK both for Linux
> > thanks to _GNU_SOURCE and for FreeBSD thanks to __BSD_VISIBLE.
> However
> > using XOPEN_SOURCE or POSIX_(C_)SOURCE in a component causes
> > __BSD_VISIBLE to be defined to 0 for FreeBSD, causing different
> > feature sets visibility for Linux and FreeBSD. It restricts from using
> > IPPROTO macros in public headers, such as rte_ip.h, despite the fact
> > they are already widely used in sources.
> >
> > Add __BSD_VISIBLE macro specified unconditionally for FreeBSD targets
> > which enforces feature sets visibility unification between Linux and
> > FreeBSD.
> >
> > Add single -D_GNU_SOURCE to config/meson.build as a project argument
> > instead of adding separate directive for each project subtree.
> >
> > This patch solves the problem of build breaks for [1] on FreeBSD [2]
> > following the discussion [3].
> >
> > [1] https://mails.dpdk.org/archives/dev/2019-May/131885.html
> > [2] http://mails.dpdk.org/archives/test-report/2019-May/082263.html
> > [3] https://mails.dpdk.org/archives/dev/2019-May/132110.html
> >
> > Signed-off-by: Marcin Smoczynski <marcinx.smoczynski@intel.com>
> > ---
> >  app/meson.build               | 3 ---
> >  config/meson.build            | 8 ++++++++
> >  drivers/meson.build           | 3 ---
> >  examples/meson.build          | 3 ---
> >  lib/meson.build               | 3 ---
> >  meson.build                   | 6 +++++-
> >  mk/target/generic/rte.vars.mk | 5 +++++
> >  7 files changed, 18 insertions(+), 13 deletions(-)
> >
> > diff --git a/app/meson.build b/app/meson.build index
> > 2b9fdef74..b0e6afbbe 100644
> > --- a/app/meson.build
> > +++ b/app/meson.build
> > @@ -22,9 +22,6 @@ lib_execinfo = cc.find_library('execinfo', required:
> > false)
> >
> >  default_cflags = machine_args
> >
> > -# specify -D_GNU_SOURCE unconditionally -default_cflags +=
> > '-D_GNU_SOURCE'
> > -
> >  foreach app:apps
> >  	build = true
> >  	name = app
> > diff --git a/config/meson.build b/config/meson.build index
> > 0d25646f5..b77c87811 100644
> > --- a/config/meson.build
> > +++ b/config/meson.build
> > @@ -187,3 +187,11 @@ install_headers('rte_config.h', subdir:
> > get_option('include_subdir_arch'))
> >
> >  # enable VFIO only if it is linux OS
> >  dpdk_conf.set('RTE_EAL_VFIO', is_linux)
> > +
> > +# specify -D_GNU_SOURCE unconditionally
> > +add_project_arguments('-D_GNU_SOURCE', language: 'c')
> > +
> > +# specify -D__BSD_VISIBLE for FreeBSD if is_freebsd
> > +	add_project_arguments('-D__BSD_VISIBLE', language: 'c') endif
> > diff --git a/drivers/meson.build b/drivers/meson.build index
> > 4c444f495..dc47b45ec 100644
> > --- a/drivers/meson.build
> > +++ b/drivers/meson.build
> > @@ -21,9 +21,6 @@ if cc.has_argument('-Wno-format-truncation')
> >  	default_cflags += '-Wno-format-truncation'
> >  endif
> >
> > -# specify -D_GNU_SOURCE unconditionally -default_cflags +=
> > '-D_GNU_SOURCE'
> > -
> >  foreach class:dpdk_driver_classes
> >  	drivers = []
> >  	std_deps = []
> > diff --git a/examples/meson.build b/examples/meson.build index
> > 1a6134f12..6e18ca8ec 100644
> > --- a/examples/meson.build
> > +++ b/examples/meson.build
> > @@ -31,9 +31,6 @@ if cc.has_argument('-Wno-format-truncation')
> >  	default_cflags += '-Wno-format-truncation'
> >  endif
> >
> > -# specify -D_GNU_SOURCE unconditionally -default_cflags +=
> > '-D_GNU_SOURCE'
> > -
> >  foreach example: examples
> >  	name = example
> >  	build = true
> > diff --git a/lib/meson.build b/lib/meson.build index
> > e067ce5ea..dd7c94c03 100644
> > --- a/lib/meson.build
> > +++ b/lib/meson.build
> > @@ -41,9 +41,6 @@ endif
> >
> >  enabled_libs = [] # used to print summary at the end
> >
> > -# -D_GNU_SOURCE unconditionally
> > -default_cflags += '-D_GNU_SOURCE'
> > -
> >  foreach l:libraries
> >  	build = true
> >  	name = l
> > diff --git a/meson.build b/meson.build index 46f9c5683..05c816a9e
> > 100644
> > --- a/meson.build
> > +++ b/meson.build
> > @@ -64,6 +64,10 @@ configure_file(output: build_cfg,  dpdk_drivers =
> > ['-Wl,--whole-archive'] + dpdk_drivers + ['-Wl,--no-whole-archive']
> >
> >  pkg = import('pkgconfig')
> > +pkg_extra_cflags = ['-include', 'rte_config.h'] + machine_args if
> > +is_freebsd
> > +	pkg_extra_cflags += ['-D__BSD_VISIBLE'] endif
> >  pkg.generate(name: meson.project_name(),
> >  	filebase: 'lib' + meson.project_name().to_lower(),
> >  	version: meson.project_version(),
> > @@ -76,7 +80,7 @@ pkg.generate(name: meson.project_name(),  Note
> that
> > CFLAGS might contain an -march flag higher than typical baseline.
> >  This is required for a number of static inline functions in the public
> headers.''',
> >  	subdirs: [get_option('include_subdir_arch'), '.'],
> > -	extra_cflags: ['-include', 'rte_config.h'] + machine_args
> > +	extra_cflags: pkg_extra_cflags
> >  )
> >
> >  # final output, list all the libs and drivers to be built diff --git
> > a/mk/target/generic/rte.vars.mk b/mk/target/generic/rte.vars.mk index
> > 25a578ad7..5f00a0bfa 100644
> > --- a/mk/target/generic/rte.vars.mk
> > +++ b/mk/target/generic/rte.vars.mk
> > @@ -111,6 +111,11 @@ endif
> >  # always define _GNU_SOURCE
> >  CFLAGS += -D_GNU_SOURCE
> >
> > +# define __BSD_VISIBLE when building for FreeBSD ifeq
> > +($(CONFIG_RTE_EXEC_ENV_FREEBSD),y)
> > +CFLAGS += -D__BSD_VISIBLE
> > +endif
> > +
> >  export CFLAGS
> >  export LDFLAGS
> >
> > --
> 
> Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
> 
> > 2.17.1


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [dpdk-dev] [PATCH v2 1/1] build: enable BSD features visibility for FreeBSD
  2019-06-05 10:15   ` Ananyev, Konstantin
  2019-06-17 12:36     ` Smoczynski, MarcinX
@ 2019-06-26 14:51     ` Thomas Monjalon
  1 sibling, 0 replies; 9+ messages in thread
From: Thomas Monjalon @ 2019-06-26 14:51 UTC (permalink / raw)
  To: Smoczynski, MarcinX
  Cc: dev, Ananyev, Konstantin, Richardson, Bruce, adrien.mazarguil

> > When a component uses either XOPEN_SOURCE or POSIX_C_SOURCE macro
> > explicitly in its build recipe, it restricts visibility of a non POSIX
> > features subset, such as IANA protocol numbers (IPPROTO_* macros).
> > Non standard features are enabled by default for DPDK both for Linux
> > thanks to _GNU_SOURCE and for FreeBSD thanks to __BSD_VISIBLE. However
> > using XOPEN_SOURCE or POSIX_(C_)SOURCE in a component causes
> > __BSD_VISIBLE to be defined to 0 for FreeBSD, causing different feature
> > sets visibility for Linux and FreeBSD. It restricts from using IPPROTO
> > macros in public headers, such as rte_ip.h, despite the fact they are
> > already widely used in sources.
> > 
> > Add __BSD_VISIBLE macro specified unconditionally for FreeBSD targets
> > which enforces feature sets visibility unification between Linux and
> > FreeBSD.
> > 
> > Add single -D_GNU_SOURCE to config/meson.build as a project argument
> > instead of adding separate directive for each project subtree.
> > 
> > This patch solves the problem of build breaks for [1] on FreeBSD [2]
> > following the discussion [3].
> > 
> > [1] https://mails.dpdk.org/archives/dev/2019-May/131885.html
> > [2] http://mails.dpdk.org/archives/test-report/2019-May/082263.html
> > [3] https://mails.dpdk.org/archives/dev/2019-May/132110.html
> > 
> > Signed-off-by: Marcin Smoczynski <marcinx.smoczynski@intel.com>
> 
> Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>

Applied, thanks



^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2019-06-26 14:51 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-14 14:04 [dpdk-dev] [PATCH v2 0/1] Enable BSD features visibility for FreeBSD Marcin Smoczynski
2019-05-14 14:04 ` Marcin Smoczynski
2019-05-14 14:04 ` [dpdk-dev] [PATCH v2 1/1] build: enable " Marcin Smoczynski
2019-05-14 14:04   ` Marcin Smoczynski
2019-06-05  9:37   ` Thomas Monjalon
2019-06-05 10:02     ` Bruce Richardson
2019-06-05 10:15   ` Ananyev, Konstantin
2019-06-17 12:36     ` Smoczynski, MarcinX
2019-06-26 14:51     ` Thomas Monjalon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).