DPDK patches and discussions
 help / color / mirror / Atom feed
From: Anatoly Burakov <anatoly.burakov@intel.com>
To: dev@dpdk.org
Cc: Jasvinder Singh <jasvinder.singh@intel.com>,
	Cristian Dumitrescu <cristian.dumitrescu@intel.com>,
	Thomas Monjalon <thomas@monjalon.net>,
	dpdk@stormmq.com
Subject: [dpdk-dev] [PATCH 1/7] linuxapp: build with _GNU_SOURCE defined by default
Date: Wed, 29 Aug 2018 12:56:15 +0100	[thread overview]
Message-ID: <75211b619a8677996601f53fc28d5c637fdac5e9.1535543250.git.anatoly.burakov@intel.com> (raw)
In-Reply-To: <cover.1535543250.git.anatoly.burakov@intel.com>
In-Reply-To: <cover.1535543250.git.anatoly.burakov@intel.com>

We use _GNU_SOURCE all over the place, but often times we miss
defining it, resulting in broken builds on musl. Rather than
fixing every library's and driver's and application's makefile,
fix it by simply defining _GNU_SOURCE by default for all
Linuxapp builds.

Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
---
 app/meson.build                      |  9 ++++++++-
 drivers/bus/pci/linux/Makefile       |  2 --
 drivers/meson.build                  |  6 ++++++
 drivers/net/softnic/conn.c           |  1 -
 examples/meson.build                 |  6 ++++++
 lib/librte_eal/linuxapp/eal/Makefile | 16 ----------------
 lib/meson.build                      |  6 ++++++
 mk/exec-env/linuxapp/rte.vars.mk     |  2 ++
 test/test/meson.build                |  5 +++++
 9 files changed, 33 insertions(+), 20 deletions(-)

diff --git a/app/meson.build b/app/meson.build
index 99e0b93ec..c9a52a22b 100644
--- a/app/meson.build
+++ b/app/meson.build
@@ -11,13 +11,20 @@ apps = ['pdump',
 # for BSD only
 lib_execinfo = cc.find_library('execinfo', required: false)
 
+default_cflags = machine_args
+
+# on Linux, specify -D_GNU_SOURCE unconditionally
+if host_machine.system() == 'linux'
+	default_cflags += '-D_GNU_SOURCE'
+endif
+
 foreach app:apps
 	build = true
 	name = app
 	allow_experimental_apis = false
 	sources = []
 	includes = []
-	cflags = machine_args
+	cflags = default_cflags
 	objs = [] # other object files to link against, used e.g. for
 	          # instruction-set optimized versions of code
 
diff --git a/drivers/bus/pci/linux/Makefile b/drivers/bus/pci/linux/Makefile
index 96ea1d540..90404468b 100644
--- a/drivers/bus/pci/linux/Makefile
+++ b/drivers/bus/pci/linux/Makefile
@@ -4,5 +4,3 @@
 SRCS += pci.c
 SRCS += pci_uio.c
 SRCS += pci_vfio.c
-
-CFLAGS += -D_GNU_SOURCE
diff --git a/drivers/meson.build b/drivers/meson.build
index f94e2fe67..7ff97ef4e 100644
--- a/drivers/meson.build
+++ b/drivers/meson.build
@@ -15,6 +15,12 @@ default_cflags = machine_args
 if cc.has_argument('-Wno-format-truncation')
 	default_cflags += '-Wno-format-truncation'
 endif
+
+# on Linux, specify -D_GNU_SOURCE unconditionally
+if host_machine.system() == 'linux'
+	default_cflags += '-D_GNU_SOURCE'
+endif
+
 foreach class:driver_classes
 	drivers = []
 	std_deps = []
diff --git a/drivers/net/softnic/conn.c b/drivers/net/softnic/conn.c
index 990cf40fc..8b6658088 100644
--- a/drivers/net/softnic/conn.c
+++ b/drivers/net/softnic/conn.c
@@ -8,7 +8,6 @@
 #include <unistd.h>
 #include <sys/types.h>
 
-#define __USE_GNU
 #include <sys/socket.h>
 
 #include <sys/epoll.h>
diff --git a/examples/meson.build b/examples/meson.build
index 4ee7a1114..70c22eb62 100644
--- a/examples/meson.build
+++ b/examples/meson.build
@@ -22,6 +22,12 @@ default_cflags = machine_args
 if cc.has_argument('-Wno-format-truncation')
 	default_cflags += '-Wno-format-truncation'
 endif
+
+# on Linux, specify -D_GNU_SOURCE unconditionally
+if host_machine.system() == 'linux'
+	default_cflags += '-D_GNU_SOURCE'
+endif
+
 foreach example: examples
 	name = example
 	build = true
diff --git a/lib/librte_eal/linuxapp/eal/Makefile b/lib/librte_eal/linuxapp/eal/Makefile
index fd92c75c2..bfee453bc 100644
--- a/lib/librte_eal/linuxapp/eal/Makefile
+++ b/lib/librte_eal/linuxapp/eal/Makefile
@@ -85,22 +85,6 @@ SRCS-y += rte_cycles.c
 
 CFLAGS_eal_common_cpuflags.o := $(CPUFLAGS_LIST)
 
-CFLAGS_eal.o := -D_GNU_SOURCE
-CFLAGS_eal_interrupts.o := -D_GNU_SOURCE
-CFLAGS_eal_vfio_mp_sync.o := -D_GNU_SOURCE
-CFLAGS_eal_timer.o := -D_GNU_SOURCE
-CFLAGS_eal_lcore.o := -D_GNU_SOURCE
-CFLAGS_eal_memalloc.o := -D_GNU_SOURCE
-CFLAGS_eal_thread.o := -D_GNU_SOURCE
-CFLAGS_eal_log.o := -D_GNU_SOURCE
-CFLAGS_eal_common_log.o := -D_GNU_SOURCE
-CFLAGS_eal_hugepage_info.o := -D_GNU_SOURCE
-CFLAGS_eal_common_whitelist.o := -D_GNU_SOURCE
-CFLAGS_eal_common_options.o := -D_GNU_SOURCE
-CFLAGS_eal_common_thread.o := -D_GNU_SOURCE
-CFLAGS_eal_common_lcore.o := -D_GNU_SOURCE
-CFLAGS_rte_cycles.o := -D_GNU_SOURCE
-
 # workaround for a gcc bug with noreturn attribute
 # http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12603
 ifeq ($(CONFIG_RTE_TOOLCHAIN_GCC),y)
diff --git a/lib/meson.build b/lib/meson.build
index eb91f100b..4c1577571 100644
--- a/lib/meson.build
+++ b/lib/meson.build
@@ -30,6 +30,12 @@ default_cflags = machine_args
 if cc.has_argument('-Wno-format-truncation')
 	default_cflags += '-Wno-format-truncation'
 endif
+
+# on Linux, specify -D_GNU_SOURCE unconditionally
+if host_machine.system() == 'linux'
+	default_cflags += '-D_GNU_SOURCE'
+endif
+
 foreach l:libraries
 	build = true
 	name = l
diff --git a/mk/exec-env/linuxapp/rte.vars.mk b/mk/exec-env/linuxapp/rte.vars.mk
index 3129edc8c..91b778fcc 100644
--- a/mk/exec-env/linuxapp/rte.vars.mk
+++ b/mk/exec-env/linuxapp/rte.vars.mk
@@ -17,6 +17,8 @@ else
 EXECENV_CFLAGS  = -pthread
 endif
 
+EXECENV_CFLAGS += -D_GNU_SOURCE
+
 EXECENV_LDLIBS  =
 EXECENV_ASFLAGS =
 
diff --git a/test/test/meson.build b/test/test/meson.build
index b1dd6eca2..c81fca439 100644
--- a/test/test/meson.build
+++ b/test/test/meson.build
@@ -242,6 +242,11 @@ if cc.has_argument('-Wno-format-truncation')
     cflags += '-Wno-format-truncation'
 endif
 
+# on Linux, specify -D_GNU_SOURCE unconditionally
+if host_machine.system() == 'linux'
+	default_cflags += '-D_GNU_SOURCE'
+endif
+
 test_dep_objs = []
 compress_test_dep = dependency('zlib', required: false)
 if compress_test_dep.found()
-- 
2.17.1

  reply	other threads:[~2018-08-29 11:56 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-29 11:56 [dpdk-dev] [PATCH 0/7] Improve core EAL musl compatibility Anatoly Burakov
2018-08-29 11:56 ` Anatoly Burakov [this message]
2018-08-29 11:56 ` [dpdk-dev] [PATCH 2/7] pci/vfio: improve " Anatoly Burakov
2018-08-29 12:35   ` Bruce Richardson
2018-08-29 14:08     ` Burakov, Anatoly
2018-08-29 11:56 ` [dpdk-dev] [PATCH 3/7] fbarray: " Anatoly Burakov
2018-08-29 11:56 ` [dpdk-dev] [PATCH 4/7] eal/hugepage_info: " Anatoly Burakov
2018-08-29 11:56 ` [dpdk-dev] [PATCH 5/7] mem: " Anatoly Burakov
2018-08-29 11:56 ` [dpdk-dev] [PATCH 6/7] string_fns: " Anatoly Burakov
2018-08-29 11:56 ` [dpdk-dev] [PATCH 7/7] eal: " Anatoly Burakov
2018-08-29 12:39   ` Bruce Richardson
2018-08-29 12:40     ` Bruce Richardson
2018-08-29 14:09     ` Burakov, Anatoly
2018-08-29 16:47       ` Stephen Hemminger
2018-08-30  9:13         ` Burakov, Anatoly
2018-08-29 16:43   ` Stephen Hemminger
2018-09-20 15:27 ` [dpdk-dev] [PATCH v2 0/7] Improve core EAL " Anatoly Burakov
2018-10-04 10:20   ` [dpdk-dev] [PATCH v3 " Anatoly Burakov
2018-10-22  9:33     ` Thomas Monjalon
2018-10-04 10:20   ` [dpdk-dev] [PATCH v3 1/7] mk: build with _GNU_SOURCE defined by default Anatoly Burakov
2018-10-04 10:20   ` [dpdk-dev] [PATCH v3 2/7] pci/vfio: improve musl compatibility Anatoly Burakov
2018-10-04 10:20   ` [dpdk-dev] [PATCH v3 3/7] fbarray: " Anatoly Burakov
2018-10-04 10:20   ` [dpdk-dev] [PATCH v3 4/7] eal/hugepage_info: " Anatoly Burakov
2018-10-04 10:20   ` [dpdk-dev] [PATCH v3 5/7] mem: " Anatoly Burakov
2018-10-04 10:20   ` [dpdk-dev] [PATCH v3 6/7] string_fns: " Anatoly Burakov
2018-10-04 10:20   ` [dpdk-dev] [PATCH v3 7/7] eal: " Anatoly Burakov
2018-09-20 15:27 ` [dpdk-dev] [PATCH v2 1/7] linuxapp: build with _GNU_SOURCE defined by default Anatoly Burakov
2018-09-20 15:27 ` [dpdk-dev] [PATCH v2 2/7] pci/vfio: improve musl compatibility Anatoly Burakov
2018-09-20 15:27 ` [dpdk-dev] [PATCH v2 3/7] fbarray: " Anatoly Burakov
2018-09-20 15:27 ` [dpdk-dev] [PATCH v2 4/7] eal/hugepage_info: " Anatoly Burakov
2018-09-20 15:27 ` [dpdk-dev] [PATCH v2 5/7] mem: " Anatoly Burakov
2018-09-20 15:27 ` [dpdk-dev] [PATCH v2 6/7] string_fns: " Anatoly Burakov
2018-09-20 15:27 ` [dpdk-dev] [PATCH v2 7/7] eal: " Anatoly Burakov
2018-09-28 15:25 ` [dpdk-dev] [PATCH 0/7] Improve core EAL " Bruce Richardson
2018-10-03 22:56   ` Thomas Monjalon
2018-10-04  9:15     ` Burakov, Anatoly

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=75211b619a8677996601f53fc28d5c637fdac5e9.1535543250.git.anatoly.burakov@intel.com \
    --to=anatoly.burakov@intel.com \
    --cc=cristian.dumitrescu@intel.com \
    --cc=dev@dpdk.org \
    --cc=dpdk@stormmq.com \
    --cc=jasvinder.singh@intel.com \
    --cc=thomas@monjalon.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).