From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by dpdk.org (Postfix) with ESMTP id B028F5A for ; Wed, 29 Aug 2018 13:56:26 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 29 Aug 2018 04:56:25 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.53,303,1531810800"; d="scan'208";a="87292407" Received: from irvmail001.ir.intel.com ([163.33.26.43]) by orsmga002.jf.intel.com with ESMTP; 29 Aug 2018 04:56:24 -0700 Received: from sivswdev01.ir.intel.com (sivswdev01.ir.intel.com [10.237.217.45]) by irvmail001.ir.intel.com (8.14.3/8.13.6/MailSET/Hub) with ESMTP id w7TBuNf8028619; Wed, 29 Aug 2018 12:56:24 +0100 Received: from sivswdev01.ir.intel.com (localhost [127.0.0.1]) by sivswdev01.ir.intel.com with ESMTP id w7TBuMdT010309; Wed, 29 Aug 2018 12:56:22 +0100 Received: (from aburakov@localhost) by sivswdev01.ir.intel.com with LOCAL id w7TBuMow010305; Wed, 29 Aug 2018 12:56:22 +0100 From: Anatoly Burakov To: dev@dpdk.org Cc: Jasvinder Singh , Cristian Dumitrescu , Thomas Monjalon , dpdk@stormmq.com Date: Wed, 29 Aug 2018 12:56:15 +0100 Message-Id: <75211b619a8677996601f53fc28d5c637fdac5e9.1535543250.git.anatoly.burakov@intel.com> X-Mailer: git-send-email 1.7.0.7 In-Reply-To: References: In-Reply-To: References: Subject: [dpdk-dev] [PATCH 1/7] linuxapp: build with _GNU_SOURCE defined by default 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: , X-List-Received-Date: Wed, 29 Aug 2018 11:56:27 -0000 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 --- 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 #include -#define __USE_GNU #include #include 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