From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by dpdk.space (Postfix) with ESMTP id B16E9A0096 for ; Wed, 5 Jun 2019 12:15:55 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 88A551B9D3; Wed, 5 Jun 2019 12:15:55 +0200 (CEST) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by dpdk.org (Postfix) with ESMTP id AD2711B94E for ; Wed, 5 Jun 2019 12:15:54 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 05 Jun 2019 03:15:52 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,550,1549958400"; d="scan'208";a="181882101" Received: from irsmsx108.ger.corp.intel.com ([163.33.3.3]) by fmsmga002.fm.intel.com with ESMTP; 05 Jun 2019 03:15:35 -0700 Received: from irsmsx105.ger.corp.intel.com ([169.254.7.155]) by IRSMSX108.ger.corp.intel.com ([169.254.11.19]) with mapi id 14.03.0415.000; Wed, 5 Jun 2019 11:15:34 +0100 From: "Ananyev, Konstantin" To: "Smoczynski, MarcinX" , "Richardson, Bruce" , "thomas@monjalon.net" CC: "dev@dpdk.org" , "adrien.mazarguil@6wind.com" Thread-Topic: [PATCH v2 1/1] build: enable BSD features visibility for FreeBSD Thread-Index: AQHVCl44hltT/jrs9UmyUREglqWJS6aM+kUA Date: Wed, 5 Jun 2019 10:15:34 +0000 Message-ID: <2601191342CEEE43887BDE71AB9772580161FE75AF@irsmsx105.ger.corp.intel.com> References: <20190514140416.4192-1-marcinx.smoczynski@intel.com> <20190514140416.4192-2-marcinx.smoczynski@intel.com> In-Reply-To: <20190514140416.4192-2-marcinx.smoczynski@intel.com> Accept-Language: en-IE, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiZWU5NGNkM2MtZWJkNC00OWMxLTgwNjAtMmE5ZDhmYTRmMzNhIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoiNkdTQjkzVklna3JZOWVHbDJBNmRDQnBJS1A0SFQreU5BSkJcL2ZJdElka0poR2JDdzJWWUQwSk5KcnNONjI0VEcifQ== x-ctpclassification: CTP_NT dlp-product: dlpe-windows dlp-version: 11.0.600.7 dlp-reaction: no-action x-originating-ip: [163.33.239.180] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH v2 1/1] build: enable BSD features visibility for FreeBSD X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" >=20 > 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. >=20 > Add __BSD_VISIBLE macro specified unconditionally for FreeBSD targets > which enforces feature sets visibility unification between Linux and > FreeBSD. >=20 > Add single -D_GNU_SOURCE to config/meson.build as a project argument > instead of adding separate directive for each project subtree. >=20 > This patch solves the problem of build breaks for [1] on FreeBSD [2] > following the discussion [3]. >=20 > [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 >=20 > Signed-off-by: Marcin Smoczynski > --- > 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(-) >=20 > 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 =3D cc.find_library('execinfo', required: = false) >=20 > default_cflags =3D machine_args >=20 > -# specify -D_GNU_SOURCE unconditionally > -default_cflags +=3D '-D_GNU_SOURCE' > - > foreach app:apps > build =3D true > name =3D 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')) >=20 > # 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 +=3D '-Wno-format-truncation' > endif >=20 > -# specify -D_GNU_SOURCE unconditionally > -default_cflags +=3D '-D_GNU_SOURCE' > - > foreach class:dpdk_driver_classes > drivers =3D [] > std_deps =3D [] > 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 +=3D '-Wno-format-truncation' > endif >=20 > -# specify -D_GNU_SOURCE unconditionally > -default_cflags +=3D '-D_GNU_SOURCE' > - > foreach example: examples > name =3D example > build =3D 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 >=20 > enabled_libs =3D [] # used to print summary at the end >=20 > -# -D_GNU_SOURCE unconditionally > -default_cflags +=3D '-D_GNU_SOURCE' > - > foreach l:libraries > build =3D true > name =3D 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 =3D ['-Wl,--whole-archive'] + dpdk_drivers + ['-Wl,--no-who= le-archive'] >=20 > pkg =3D import('pkgconfig') > +pkg_extra_cflags =3D ['-include', 'rte_config.h'] + machine_args > +if is_freebsd > + pkg_extra_cflags +=3D ['-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 baseli= ne. > This is required for a number of static inline functions in the public h= eaders.''', > subdirs: [get_option('include_subdir_arch'), '.'], > - extra_cflags: ['-include', 'rte_config.h'] + machine_args > + extra_cflags: pkg_extra_cflags > ) >=20 > # 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.m= k > 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 +=3D -D_GNU_SOURCE >=20 > +# define __BSD_VISIBLE when building for FreeBSD > +ifeq ($(CONFIG_RTE_EXEC_ENV_FREEBSD),y) > +CFLAGS +=3D -D__BSD_VISIBLE > +endif > + > export CFLAGS > export LDFLAGS >=20 > -- Acked-by: Konstantin Ananyev > 2.17.1