* [dpdk-dev] [PATCH 0/7] Improve core EAL musl compatibility
@ 2018-08-29 11:56 Anatoly Burakov
2018-08-29 11:56 ` [dpdk-dev] [PATCH 1/7] linuxapp: build with _GNU_SOURCE defined by default Anatoly Burakov
` (15 more replies)
0 siblings, 16 replies; 36+ messages in thread
From: Anatoly Burakov @ 2018-08-29 11:56 UTC (permalink / raw)
To: dev; +Cc: dpdk
This patchset fixes numerous issues with musl compatibility
in the core EAL libraries. It does not fix anything beyond
core EAL (so, PCI driver is still broken, so are a few other
drivers), but it's a good start.
Tested on container with Alpine Linux. Alpine dependencies:
build-base bsd-compat-headers libexecinfo-dev linux-headers numactl-dev
For numactl-dev, testing repository needs to be enabled:
echo "http://dl-cdn.alpinelinux.org/alpine/edge/testing" >> /etc/apk/repositories
If successful (using a very broad definition of "success"),
the build should fail somewhere in PCI bus driver in UIO.
Anatoly Burakov (7):
linuxapp: build with _GNU_SOURCE defined by default
pci/vfio: improve musl compatibility
fbarray: improve musl compatibility
eal/hugepage_info: improve musl compatibility
mem: improve musl compatibility
string_fns: improve musl compatibility
eal: improve musl compatibility
app/meson.build | 9 ++++++++-
drivers/bus/pci/linux/Makefile | 2 --
drivers/bus/pci/linux/pci_vfio.c | 8 ++++----
drivers/meson.build | 6 ++++++
drivers/net/softnic/conn.c | 1 -
examples/meson.build | 6 ++++++
lib/librte_eal/common/eal_common_fbarray.c | 1 +
lib/librte_eal/common/eal_common_memory.c | 1 +
lib/librte_eal/common/include/rte_string_fns.h | 1 +
lib/librte_eal/linuxapp/eal/Makefile | 16 ----------------
lib/librte_eal/linuxapp/eal/eal.c | 5 +++--
lib/librte_eal/linuxapp/eal/eal_hugepage_info.c | 1 +
lib/librte_eal/linuxapp/eal/eal_memory.c | 1 +
lib/librte_eal/linuxapp/eal/eal_thread.c | 5 +++--
lib/meson.build | 6 ++++++
mk/exec-env/linuxapp/rte.vars.mk | 2 ++
test/test/meson.build | 5 +++++
17 files changed, 48 insertions(+), 28 deletions(-)
--
2.17.1
^ permalink raw reply [flat|nested] 36+ messages in thread
* [dpdk-dev] [PATCH 1/7] linuxapp: build with _GNU_SOURCE defined by default
2018-08-29 11:56 [dpdk-dev] [PATCH 0/7] Improve core EAL musl compatibility Anatoly Burakov
@ 2018-08-29 11:56 ` Anatoly Burakov
2018-08-29 11:56 ` [dpdk-dev] [PATCH 2/7] pci/vfio: improve musl compatibility Anatoly Burakov
` (14 subsequent siblings)
15 siblings, 0 replies; 36+ messages in thread
From: Anatoly Burakov @ 2018-08-29 11:56 UTC (permalink / raw)
To: dev; +Cc: Jasvinder Singh, Cristian Dumitrescu, Thomas Monjalon, dpdk
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
^ permalink raw reply [flat|nested] 36+ messages in thread
* [dpdk-dev] [PATCH 2/7] pci/vfio: improve musl compatibility
2018-08-29 11:56 [dpdk-dev] [PATCH 0/7] Improve core EAL musl compatibility Anatoly Burakov
2018-08-29 11:56 ` [dpdk-dev] [PATCH 1/7] linuxapp: build with _GNU_SOURCE defined by default Anatoly Burakov
@ 2018-08-29 11:56 ` Anatoly Burakov
2018-08-29 12:35 ` Bruce Richardson
2018-08-29 11:56 ` [dpdk-dev] [PATCH 3/7] fbarray: " Anatoly Burakov
` (13 subsequent siblings)
15 siblings, 1 reply; 36+ messages in thread
From: Anatoly Burakov @ 2018-08-29 11:56 UTC (permalink / raw)
To: dev; +Cc: dpdk
Musl already has PAGE_SIZE defined, and our define clashed with it.
Rename our define to SYS_PAGE_SIZE.
Bugzilla ID: 36
Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
---
drivers/bus/pci/linux/pci_vfio.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/bus/pci/linux/pci_vfio.c b/drivers/bus/pci/linux/pci_vfio.c
index 686386d6a..88bcfb88b 100644
--- a/drivers/bus/pci/linux/pci_vfio.c
+++ b/drivers/bus/pci/linux/pci_vfio.c
@@ -35,8 +35,8 @@
#ifdef VFIO_PRESENT
-#define PAGE_SIZE (sysconf(_SC_PAGESIZE))
-#define PAGE_MASK (~(PAGE_SIZE - 1))
+#define SYS_PAGE_SIZE (sysconf(_SC_PAGESIZE))
+#define SYS_PAGE_MASK (~(SYS_PAGE_SIZE - 1))
static struct rte_tailq_elem rte_vfio_tailq = {
.name = "VFIO_RESOURCE_LIST",
@@ -344,8 +344,8 @@ pci_vfio_mmap_bar(int vfio_dev_fd, struct mapped_pci_resource *vfio_res,
*/
uint32_t table_start = msix_table->offset;
uint32_t table_end = table_start + msix_table->size;
- table_end = (table_end + ~PAGE_MASK) & PAGE_MASK;
- table_start &= PAGE_MASK;
+ table_end = (table_end + ~SYS_PAGE_MASK) & SYS_PAGE_MASK;
+ table_start &= SYS_PAGE_MASK;
if (table_start == 0 && table_end >= bar->size) {
/* Cannot map this BAR */
--
2.17.1
^ permalink raw reply [flat|nested] 36+ messages in thread
* [dpdk-dev] [PATCH 3/7] fbarray: improve musl compatibility
2018-08-29 11:56 [dpdk-dev] [PATCH 0/7] Improve core EAL musl compatibility Anatoly Burakov
2018-08-29 11:56 ` [dpdk-dev] [PATCH 1/7] linuxapp: build with _GNU_SOURCE defined by default Anatoly Burakov
2018-08-29 11:56 ` [dpdk-dev] [PATCH 2/7] pci/vfio: improve musl compatibility Anatoly Burakov
@ 2018-08-29 11:56 ` Anatoly Burakov
2018-08-29 11:56 ` [dpdk-dev] [PATCH 4/7] eal/hugepage_info: " Anatoly Burakov
` (12 subsequent siblings)
15 siblings, 0 replies; 36+ messages in thread
From: Anatoly Burakov @ 2018-08-29 11:56 UTC (permalink / raw)
To: dev; +Cc: dpdk
When built against musl, fcntl.h doesn't silently get included.
Fix by including it explicitly.
Bugzilla ID: 34
Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
---
lib/librte_eal/common/eal_common_fbarray.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/lib/librte_eal/common/eal_common_fbarray.c b/lib/librte_eal/common/eal_common_fbarray.c
index 43caf3ced..6f0169a5c 100644
--- a/lib/librte_eal/common/eal_common_fbarray.c
+++ b/lib/librte_eal/common/eal_common_fbarray.c
@@ -2,6 +2,7 @@
* Copyright(c) 2017-2018 Intel Corporation
*/
+#include <fcntl.h>
#include <inttypes.h>
#include <limits.h>
#include <sys/mman.h>
--
2.17.1
^ permalink raw reply [flat|nested] 36+ messages in thread
* [dpdk-dev] [PATCH 4/7] eal/hugepage_info: improve musl compatibility
2018-08-29 11:56 [dpdk-dev] [PATCH 0/7] Improve core EAL musl compatibility Anatoly Burakov
` (2 preceding siblings ...)
2018-08-29 11:56 ` [dpdk-dev] [PATCH 3/7] fbarray: " Anatoly Burakov
@ 2018-08-29 11:56 ` Anatoly Burakov
2018-08-29 11:56 ` [dpdk-dev] [PATCH 5/7] mem: " Anatoly Burakov
` (11 subsequent siblings)
15 siblings, 0 replies; 36+ messages in thread
From: Anatoly Burakov @ 2018-08-29 11:56 UTC (permalink / raw)
To: dev; +Cc: dpdk
When built against musl, fcntl.h doesn't silently get included.
Fix by including it explicitly.
Bugzilla ID: 33
Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
---
lib/librte_eal/linuxapp/eal/eal_hugepage_info.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/lib/librte_eal/linuxapp/eal/eal_hugepage_info.c b/lib/librte_eal/linuxapp/eal/eal_hugepage_info.c
index 3a7d4b222..0eab1cf71 100644
--- a/lib/librte_eal/linuxapp/eal/eal_hugepage_info.c
+++ b/lib/librte_eal/linuxapp/eal/eal_hugepage_info.c
@@ -6,6 +6,7 @@
#include <sys/types.h>
#include <sys/file.h>
#include <dirent.h>
+#include <fcntl.h>
#include <stdint.h>
#include <stdlib.h>
#include <stdio.h>
--
2.17.1
^ permalink raw reply [flat|nested] 36+ messages in thread
* [dpdk-dev] [PATCH 5/7] mem: improve musl compatibility
2018-08-29 11:56 [dpdk-dev] [PATCH 0/7] Improve core EAL musl compatibility Anatoly Burakov
` (3 preceding siblings ...)
2018-08-29 11:56 ` [dpdk-dev] [PATCH 4/7] eal/hugepage_info: " Anatoly Burakov
@ 2018-08-29 11:56 ` Anatoly Burakov
2018-08-29 11:56 ` [dpdk-dev] [PATCH 6/7] string_fns: " Anatoly Burakov
` (10 subsequent siblings)
15 siblings, 0 replies; 36+ messages in thread
From: Anatoly Burakov @ 2018-08-29 11:56 UTC (permalink / raw)
To: dev; +Cc: dpdk
When built against musl, fcntl.h doesn't silently get included.
Fix by including it explicitly.
Bugzilla ID: 31
Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
---
lib/librte_eal/common/eal_common_memory.c | 1 +
lib/librte_eal/linuxapp/eal/eal_memory.c | 1 +
2 files changed, 2 insertions(+)
diff --git a/lib/librte_eal/common/eal_common_memory.c b/lib/librte_eal/common/eal_common_memory.c
index fbfb1b055..b061f7528 100644
--- a/lib/librte_eal/common/eal_common_memory.c
+++ b/lib/librte_eal/common/eal_common_memory.c
@@ -2,6 +2,7 @@
* Copyright(c) 2010-2014 Intel Corporation
*/
+#include <fcntl.h>
#include <errno.h>
#include <stdio.h>
#include <stdint.h>
diff --git a/lib/librte_eal/linuxapp/eal/eal_memory.c b/lib/librte_eal/linuxapp/eal/eal_memory.c
index dbf19499e..a62665257 100644
--- a/lib/librte_eal/linuxapp/eal/eal_memory.c
+++ b/lib/librte_eal/linuxapp/eal/eal_memory.c
@@ -5,6 +5,7 @@
#define _FILE_OFFSET_BITS 64
#include <errno.h>
+#include <fcntl.h>
#include <stdarg.h>
#include <stdbool.h>
#include <stdlib.h>
--
2.17.1
^ permalink raw reply [flat|nested] 36+ messages in thread
* [dpdk-dev] [PATCH 6/7] string_fns: improve musl compatibility
2018-08-29 11:56 [dpdk-dev] [PATCH 0/7] Improve core EAL musl compatibility Anatoly Burakov
` (4 preceding siblings ...)
2018-08-29 11:56 ` [dpdk-dev] [PATCH 5/7] mem: " Anatoly Burakov
@ 2018-08-29 11:56 ` Anatoly Burakov
2018-08-29 11:56 ` [dpdk-dev] [PATCH 7/7] eal: " Anatoly Burakov
` (9 subsequent siblings)
15 siblings, 0 replies; 36+ messages in thread
From: Anatoly Burakov @ 2018-08-29 11:56 UTC (permalink / raw)
To: dev; +Cc: dpdk
Musl wraps various string functions such as strlcpy in order to
harden them. However, the fortify wrappers are included without
including the actual string functions being wrapped, which
throws missing definition compile errors. Fix by including
string.h in string functions header.
Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
---
lib/librte_eal/common/include/rte_string_fns.h | 1 +
1 file changed, 1 insertion(+)
diff --git a/lib/librte_eal/common/include/rte_string_fns.h b/lib/librte_eal/common/include/rte_string_fns.h
index 97597a148..ffeed2cd2 100644
--- a/lib/librte_eal/common/include/rte_string_fns.h
+++ b/lib/librte_eal/common/include/rte_string_fns.h
@@ -16,6 +16,7 @@ extern "C" {
#endif
#include <stdio.h>
+#include <string.h>
/**
* Takes string "string" parameter and splits it at character "delim"
--
2.17.1
^ permalink raw reply [flat|nested] 36+ messages in thread
* [dpdk-dev] [PATCH 7/7] eal: improve musl compatibility
2018-08-29 11:56 [dpdk-dev] [PATCH 0/7] Improve core EAL musl compatibility Anatoly Burakov
` (5 preceding siblings ...)
2018-08-29 11:56 ` [dpdk-dev] [PATCH 6/7] string_fns: " Anatoly Burakov
@ 2018-08-29 11:56 ` Anatoly Burakov
2018-08-29 12:39 ` Bruce Richardson
2018-08-29 16:43 ` Stephen Hemminger
2018-09-20 15:27 ` [dpdk-dev] [PATCH v2 0/7] Improve core EAL " Anatoly Burakov
` (8 subsequent siblings)
15 siblings, 2 replies; 36+ messages in thread
From: Anatoly Burakov @ 2018-08-29 11:56 UTC (permalink / raw)
To: dev; +Cc: dpdk
Musl complains about pthread id being of wrong size. Fix it by
casting to 64-bit and printing 64-bit hex unconditionally.
Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
---
lib/librte_eal/linuxapp/eal/eal.c | 5 +++--
lib/librte_eal/linuxapp/eal/eal_thread.c | 5 +++--
2 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/lib/librte_eal/linuxapp/eal/eal.c b/lib/librte_eal/linuxapp/eal/eal.c
index e59ac6577..abd61d346 100644
--- a/lib/librte_eal/linuxapp/eal/eal.c
+++ b/lib/librte_eal/linuxapp/eal/eal.c
@@ -3,6 +3,7 @@
* Copyright(c) 2012-2014 6WIND S.A.
*/
+#include <inttypes.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
@@ -979,8 +980,8 @@ rte_eal_init(int argc, char **argv)
ret = eal_thread_dump_affinity(cpuset, sizeof(cpuset));
- RTE_LOG(DEBUG, EAL, "Master lcore %u is ready (tid=%x;cpuset=[%s%s])\n",
- rte_config.master_lcore, (int)thread_id, cpuset,
+ RTE_LOG(DEBUG, EAL, "Master lcore %u is ready (tid=%" PRIx64" ;cpuset=[%s%s])\n",
+ rte_config.master_lcore, (uint64_t)thread_id, cpuset,
ret == 0 ? "" : "...");
RTE_LCORE_FOREACH_SLAVE(i) {
diff --git a/lib/librte_eal/linuxapp/eal/eal_thread.c b/lib/librte_eal/linuxapp/eal/eal_thread.c
index b496fc711..c818375d9 100644
--- a/lib/librte_eal/linuxapp/eal/eal_thread.c
+++ b/lib/librte_eal/linuxapp/eal/eal_thread.c
@@ -3,6 +3,7 @@
*/
#include <errno.h>
+#include <inttypes.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
@@ -121,8 +122,8 @@ eal_thread_loop(__attribute__((unused)) void *arg)
ret = eal_thread_dump_affinity(cpuset, sizeof(cpuset));
- RTE_LOG(DEBUG, EAL, "lcore %u is ready (tid=%x;cpuset=[%s%s])\n",
- lcore_id, (int)thread_id, cpuset, ret == 0 ? "" : "...");
+ RTE_LOG(DEBUG, EAL, "lcore %u is ready (tid=%" PRIx64 ";cpuset=[%s%s])\n",
+ lcore_id, (uint64_t)thread_id, cpuset, ret == 0 ? "" : "...");
/* read on our pipe to get commands */
while (1) {
--
2.17.1
^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: [dpdk-dev] [PATCH 2/7] pci/vfio: improve musl compatibility
2018-08-29 11:56 ` [dpdk-dev] [PATCH 2/7] pci/vfio: improve musl compatibility Anatoly Burakov
@ 2018-08-29 12:35 ` Bruce Richardson
2018-08-29 14:08 ` Burakov, Anatoly
0 siblings, 1 reply; 36+ messages in thread
From: Bruce Richardson @ 2018-08-29 12:35 UTC (permalink / raw)
To: Anatoly Burakov; +Cc: dev, dpdk
On Wed, Aug 29, 2018 at 12:56:16PM +0100, Anatoly Burakov wrote:
> Musl already has PAGE_SIZE defined, and our define clashed with it.
> Rename our define to SYS_PAGE_SIZE.
>
> Bugzilla ID: 36
>
> Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
> ---
Would it not be easier to just do?
#ifndef PAGE_SIZE
#define PAGE_SIZE ...
#endif
> drivers/bus/pci/linux/pci_vfio.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/bus/pci/linux/pci_vfio.c b/drivers/bus/pci/linux/pci_vfio.c
> index 686386d6a..88bcfb88b 100644
> --- a/drivers/bus/pci/linux/pci_vfio.c
> +++ b/drivers/bus/pci/linux/pci_vfio.c
> @@ -35,8 +35,8 @@
>
> #ifdef VFIO_PRESENT
>
> -#define PAGE_SIZE (sysconf(_SC_PAGESIZE))
> -#define PAGE_MASK (~(PAGE_SIZE - 1))
> +#define SYS_PAGE_SIZE (sysconf(_SC_PAGESIZE))
> +#define SYS_PAGE_MASK (~(SYS_PAGE_SIZE - 1))
>
> static struct rte_tailq_elem rte_vfio_tailq = {
> .name = "VFIO_RESOURCE_LIST",
> @@ -344,8 +344,8 @@ pci_vfio_mmap_bar(int vfio_dev_fd, struct mapped_pci_resource *vfio_res,
> */
> uint32_t table_start = msix_table->offset;
> uint32_t table_end = table_start + msix_table->size;
> - table_end = (table_end + ~PAGE_MASK) & PAGE_MASK;
> - table_start &= PAGE_MASK;
> + table_end = (table_end + ~SYS_PAGE_MASK) & SYS_PAGE_MASK;
> + table_start &= SYS_PAGE_MASK;
>
> if (table_start == 0 && table_end >= bar->size) {
> /* Cannot map this BAR */
> --
> 2.17.1
^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: [dpdk-dev] [PATCH 7/7] eal: improve musl compatibility
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:43 ` Stephen Hemminger
1 sibling, 2 replies; 36+ messages in thread
From: Bruce Richardson @ 2018-08-29 12:39 UTC (permalink / raw)
To: Anatoly Burakov; +Cc: dev, dpdk
On Wed, Aug 29, 2018 at 12:56:21PM +0100, Anatoly Burakov wrote:
> Musl complains about pthread id being of wrong size. Fix it by
> casting to 64-bit and printing 64-bit hex unconditionally.
>
> Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
> ---
Given that on linux pthread_t is a pointer type, will this not give other
warnings of casting from pointer to integer of a different type when
compiling 32-bit? For safety I suggest casting to long or uintptr_t
instead, to ensure we always get an int of the right size.
/Bruce
^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: [dpdk-dev] [PATCH 7/7] eal: improve musl compatibility
2018-08-29 12:39 ` Bruce Richardson
@ 2018-08-29 12:40 ` Bruce Richardson
2018-08-29 14:09 ` Burakov, Anatoly
1 sibling, 0 replies; 36+ messages in thread
From: Bruce Richardson @ 2018-08-29 12:40 UTC (permalink / raw)
To: Anatoly Burakov; +Cc: dev, dpdk
On Wed, Aug 29, 2018 at 01:39:26PM +0100, Bruce Richardson wrote:
> On Wed, Aug 29, 2018 at 12:56:21PM +0100, Anatoly Burakov wrote:
> > Musl complains about pthread id being of wrong size. Fix it by
> > casting to 64-bit and printing 64-bit hex unconditionally.
> >
> > Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
> > ---
> Given that on linux pthread_t is a pointer type, will this not give other
> warnings of casting from pointer to integer of a different type when
s/type/size/
> compiling 32-bit? For safety I suggest casting to long or uintptr_t
> instead, to ensure we always get an int of the right size.
>
> /Bruce
^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: [dpdk-dev] [PATCH 2/7] pci/vfio: improve musl compatibility
2018-08-29 12:35 ` Bruce Richardson
@ 2018-08-29 14:08 ` Burakov, Anatoly
0 siblings, 0 replies; 36+ messages in thread
From: Burakov, Anatoly @ 2018-08-29 14:08 UTC (permalink / raw)
To: Bruce Richardson; +Cc: dev, dpdk
On 29-Aug-18 1:35 PM, Bruce Richardson wrote:
> On Wed, Aug 29, 2018 at 12:56:16PM +0100, Anatoly Burakov wrote:
>> Musl already has PAGE_SIZE defined, and our define clashed with it.
>> Rename our define to SYS_PAGE_SIZE.
>>
>> Bugzilla ID: 36
>>
>> Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
>> ---
>
> Would it not be easier to just do?
>
> #ifndef PAGE_SIZE
> #define PAGE_SIZE ...
> #endif
Sure, that can work.
--
Thanks,
Anatoly
^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: [dpdk-dev] [PATCH 7/7] eal: improve musl compatibility
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
1 sibling, 1 reply; 36+ messages in thread
From: Burakov, Anatoly @ 2018-08-29 14:09 UTC (permalink / raw)
To: Bruce Richardson; +Cc: dev, dpdk
On 29-Aug-18 1:39 PM, Bruce Richardson wrote:
> On Wed, Aug 29, 2018 at 12:56:21PM +0100, Anatoly Burakov wrote:
>> Musl complains about pthread id being of wrong size. Fix it by
>> casting to 64-bit and printing 64-bit hex unconditionally.
>>
>> Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
>> ---
> Given that on linux pthread_t is a pointer type, will this not give other
> warnings of casting from pointer to integer of a different type when
> compiling 32-bit? For safety I suggest casting to long or uintptr_t
> instead, to ensure we always get an int of the right size.
>
> /Bruce
>
Sure, will fix.
--
Thanks,
Anatoly
^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: [dpdk-dev] [PATCH 7/7] eal: improve musl compatibility
2018-08-29 11:56 ` [dpdk-dev] [PATCH 7/7] eal: " Anatoly Burakov
2018-08-29 12:39 ` Bruce Richardson
@ 2018-08-29 16:43 ` Stephen Hemminger
1 sibling, 0 replies; 36+ messages in thread
From: Stephen Hemminger @ 2018-08-29 16:43 UTC (permalink / raw)
To: Anatoly Burakov; +Cc: dev, dpdk
On Wed, 29 Aug 2018 12:56:21 +0100
Anatoly Burakov <anatoly.burakov@intel.com> wrote:
> Musl complains about pthread id being of wrong size. Fix it by
> casting to 64-bit and printing 64-bit hex unconditionally.
>
> Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
What is pthread_t on musl? On Linux it is unsigned long.
^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: [dpdk-dev] [PATCH 7/7] eal: improve musl compatibility
2018-08-29 14:09 ` Burakov, Anatoly
@ 2018-08-29 16:47 ` Stephen Hemminger
2018-08-30 9:13 ` Burakov, Anatoly
0 siblings, 1 reply; 36+ messages in thread
From: Stephen Hemminger @ 2018-08-29 16:47 UTC (permalink / raw)
To: Burakov, Anatoly; +Cc: Bruce Richardson, dev, dpdk
On Wed, 29 Aug 2018 15:09:47 +0100
"Burakov, Anatoly" <anatoly.burakov@intel.com> wrote:
> On 29-Aug-18 1:39 PM, Bruce Richardson wrote:
> > On Wed, Aug 29, 2018 at 12:56:21PM +0100, Anatoly Burakov wrote:
> >> Musl complains about pthread id being of wrong size. Fix it by
> >> casting to 64-bit and printing 64-bit hex unconditionally.
> >>
> >> Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
> >> ---
> > Given that on linux pthread_t is a pointer type, will this not give other
> > warnings of casting from pointer to integer of a different type when
> > compiling 32-bit? For safety I suggest casting to long or uintptr_t
> > instead, to ensure we always get an int of the right size.
> >
> > /Bruce
> >
>
> Sure, will fix.
>
> --
> Thanks,
> Anatoly
Maybe use gettid() to get thread id which is actually way more useful
than the pointer value. Of course, glibc doesn't want to provide a syscall
wrapper for this.
^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: [dpdk-dev] [PATCH 7/7] eal: improve musl compatibility
2018-08-29 16:47 ` Stephen Hemminger
@ 2018-08-30 9:13 ` Burakov, Anatoly
0 siblings, 0 replies; 36+ messages in thread
From: Burakov, Anatoly @ 2018-08-30 9:13 UTC (permalink / raw)
To: Stephen Hemminger; +Cc: Bruce Richardson, dev, dpdk
On 29-Aug-18 5:47 PM, Stephen Hemminger wrote:
> On Wed, 29 Aug 2018 15:09:47 +0100
> "Burakov, Anatoly" <anatoly.burakov@intel.com> wrote:
>
>> On 29-Aug-18 1:39 PM, Bruce Richardson wrote:
>>> On Wed, Aug 29, 2018 at 12:56:21PM +0100, Anatoly Burakov wrote:
>>>> Musl complains about pthread id being of wrong size. Fix it by
>>>> casting to 64-bit and printing 64-bit hex unconditionally.
>>>>
>>>> Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
>>>> ---
>>> Given that on linux pthread_t is a pointer type, will this not give other
>>> warnings of casting from pointer to integer of a different type when
>>> compiling 32-bit? For safety I suggest casting to long or uintptr_t
>>> instead, to ensure we always get an int of the right size.
>>>
>>> /Bruce
>>>
>>
>> Sure, will fix.
>>
>> --
>> Thanks,
>> Anatoly
>
> Maybe use gettid() to get thread id which is actually way more useful
> than the pointer value. Of course, glibc doesn't want to provide a syscall
> wrapper for this.
>
>
We have rte_gettid() call.
--
Thanks,
Anatoly
^ permalink raw reply [flat|nested] 36+ messages in thread
* [dpdk-dev] [PATCH v2 0/7] Improve core EAL musl compatibility
2018-08-29 11:56 [dpdk-dev] [PATCH 0/7] Improve core EAL musl compatibility Anatoly Burakov
` (6 preceding siblings ...)
2018-08-29 11:56 ` [dpdk-dev] [PATCH 7/7] eal: " Anatoly Burakov
@ 2018-09-20 15:27 ` Anatoly Burakov
2018-10-04 10:20 ` [dpdk-dev] [PATCH v3 " Anatoly Burakov
` (7 more replies)
2018-09-20 15:27 ` [dpdk-dev] [PATCH v2 1/7] linuxapp: build with _GNU_SOURCE defined by default Anatoly Burakov
` (7 subsequent siblings)
15 siblings, 8 replies; 36+ messages in thread
From: Anatoly Burakov @ 2018-09-20 15:27 UTC (permalink / raw)
To: dev; +Cc: dpdk, bruce.richardson, stephen
This patchset fixes numerous issues with musl compatibility
in the core EAL libraries. It does not fix anything beyond
core EAL (so, PCI driver is still broken, so are a few other
drivers), but it's a good start.
Tested on container with Alpine Linux. Alpine dependencies:
build-base bsd-compat-headers libexecinfo-dev linux-headers numactl-dev
For numactl-dev, testing repository needs to be enabled:
echo "http://dl-cdn.alpinelinux.org/alpine/edge/testing" >> /etc/apk/repositories
If successful (using a very broad definition of "success"),
the build should fail somewhere in PCI bus driver in UIO.
v2 -> v1:
- Fixed patch 2 to use existing define if available
- Fixed patch 7 to use proper format specifier and
cast pthread ID to unsigned pointer type
Anatoly Burakov (7):
linuxapp: build with _GNU_SOURCE defined by default
pci/vfio: improve musl compatibility
fbarray: improve musl compatibility
eal/hugepage_info: improve musl compatibility
mem: improve musl compatibility
string_fns: improve musl compatibility
eal: improve musl compatibility
app/meson.build | 9 ++++++++-
drivers/bus/pci/linux/Makefile | 2 --
drivers/bus/pci/linux/pci_vfio.c | 2 ++
drivers/meson.build | 6 ++++++
drivers/net/softnic/conn.c | 1 -
examples/meson.build | 6 ++++++
lib/librte_eal/common/eal_common_fbarray.c | 1 +
lib/librte_eal/common/eal_common_memory.c | 1 +
lib/librte_eal/common/include/rte_string_fns.h | 1 +
lib/librte_eal/linuxapp/eal/Makefile | 16 ----------------
lib/librte_eal/linuxapp/eal/eal.c | 4 ++--
lib/librte_eal/linuxapp/eal/eal_hugepage_info.c | 1 +
lib/librte_eal/linuxapp/eal/eal_memory.c | 1 +
lib/librte_eal/linuxapp/eal/eal_thread.c | 4 ++--
lib/meson.build | 6 ++++++
mk/exec-env/linuxapp/rte.vars.mk | 2 ++
test/test/meson.build | 5 +++++
17 files changed, 44 insertions(+), 24 deletions(-)
--
2.17.1
^ permalink raw reply [flat|nested] 36+ messages in thread
* [dpdk-dev] [PATCH v2 1/7] linuxapp: build with _GNU_SOURCE defined by default
2018-08-29 11:56 [dpdk-dev] [PATCH 0/7] Improve core EAL musl compatibility Anatoly Burakov
` (7 preceding siblings ...)
2018-09-20 15:27 ` [dpdk-dev] [PATCH v2 0/7] Improve core EAL " Anatoly Burakov
@ 2018-09-20 15:27 ` Anatoly Burakov
2018-09-20 15:27 ` [dpdk-dev] [PATCH v2 2/7] pci/vfio: improve musl compatibility Anatoly Burakov
` (6 subsequent siblings)
15 siblings, 0 replies; 36+ messages in thread
From: Anatoly Burakov @ 2018-09-20 15:27 UTC (permalink / raw)
To: dev
Cc: Jasvinder Singh, Cristian Dumitrescu, Thomas Monjalon, dpdk,
bruce.richardson, stephen
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 47b4215a3..74fec716d 100644
--- a/drivers/meson.build
+++ b/drivers/meson.build
@@ -16,6 +16,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 3acc67e6e..2c7ea436a 100644
--- a/lib/meson.build
+++ b/lib/meson.build
@@ -32,6 +32,12 @@ if cc.has_argument('-Wno-format-truncation')
endif
enabled_libs = [] # used to print summary at the end
+
+# 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
^ permalink raw reply [flat|nested] 36+ messages in thread
* [dpdk-dev] [PATCH v2 2/7] pci/vfio: improve musl compatibility
2018-08-29 11:56 [dpdk-dev] [PATCH 0/7] Improve core EAL musl compatibility Anatoly Burakov
` (8 preceding siblings ...)
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 ` Anatoly Burakov
2018-09-20 15:27 ` [dpdk-dev] [PATCH v2 3/7] fbarray: " Anatoly Burakov
` (5 subsequent siblings)
15 siblings, 0 replies; 36+ messages in thread
From: Anatoly Burakov @ 2018-09-20 15:27 UTC (permalink / raw)
To: dev; +Cc: dpdk, bruce.richardson, stephen
Musl already has PAGE_SIZE defined, and our define clashed with it.
Rename our define to SYS_PAGE_SIZE.
Bugzilla ID: 36
Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
---
drivers/bus/pci/linux/pci_vfio.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/bus/pci/linux/pci_vfio.c b/drivers/bus/pci/linux/pci_vfio.c
index 686386d6a..85f6c9803 100644
--- a/drivers/bus/pci/linux/pci_vfio.c
+++ b/drivers/bus/pci/linux/pci_vfio.c
@@ -35,7 +35,9 @@
#ifdef VFIO_PRESENT
+#ifndef PAGE_SIZE
#define PAGE_SIZE (sysconf(_SC_PAGESIZE))
+#endif
#define PAGE_MASK (~(PAGE_SIZE - 1))
static struct rte_tailq_elem rte_vfio_tailq = {
--
2.17.1
^ permalink raw reply [flat|nested] 36+ messages in thread
* [dpdk-dev] [PATCH v2 3/7] fbarray: improve musl compatibility
2018-08-29 11:56 [dpdk-dev] [PATCH 0/7] Improve core EAL musl compatibility Anatoly Burakov
` (9 preceding siblings ...)
2018-09-20 15:27 ` [dpdk-dev] [PATCH v2 2/7] pci/vfio: improve musl compatibility Anatoly Burakov
@ 2018-09-20 15:27 ` Anatoly Burakov
2018-09-20 15:27 ` [dpdk-dev] [PATCH v2 4/7] eal/hugepage_info: " Anatoly Burakov
` (4 subsequent siblings)
15 siblings, 0 replies; 36+ messages in thread
From: Anatoly Burakov @ 2018-09-20 15:27 UTC (permalink / raw)
To: dev; +Cc: dpdk, bruce.richardson, stephen
When built against musl, fcntl.h doesn't silently get included.
Fix by including it explicitly.
Bugzilla ID: 34
Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
---
lib/librte_eal/common/eal_common_fbarray.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/lib/librte_eal/common/eal_common_fbarray.c b/lib/librte_eal/common/eal_common_fbarray.c
index ba6c4ae39..ea0735cb8 100644
--- a/lib/librte_eal/common/eal_common_fbarray.c
+++ b/lib/librte_eal/common/eal_common_fbarray.c
@@ -2,6 +2,7 @@
* Copyright(c) 2017-2018 Intel Corporation
*/
+#include <fcntl.h>
#include <inttypes.h>
#include <limits.h>
#include <sys/mman.h>
--
2.17.1
^ permalink raw reply [flat|nested] 36+ messages in thread
* [dpdk-dev] [PATCH v2 4/7] eal/hugepage_info: improve musl compatibility
2018-08-29 11:56 [dpdk-dev] [PATCH 0/7] Improve core EAL musl compatibility Anatoly Burakov
` (10 preceding siblings ...)
2018-09-20 15:27 ` [dpdk-dev] [PATCH v2 3/7] fbarray: " Anatoly Burakov
@ 2018-09-20 15:27 ` Anatoly Burakov
2018-09-20 15:27 ` [dpdk-dev] [PATCH v2 5/7] mem: " Anatoly Burakov
` (3 subsequent siblings)
15 siblings, 0 replies; 36+ messages in thread
From: Anatoly Burakov @ 2018-09-20 15:27 UTC (permalink / raw)
To: dev; +Cc: dpdk, bruce.richardson, stephen
When built against musl, fcntl.h doesn't silently get included.
Fix by including it explicitly.
Bugzilla ID: 33
Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
---
lib/librte_eal/linuxapp/eal/eal_hugepage_info.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/lib/librte_eal/linuxapp/eal/eal_hugepage_info.c b/lib/librte_eal/linuxapp/eal/eal_hugepage_info.c
index 3a7d4b222..0eab1cf71 100644
--- a/lib/librte_eal/linuxapp/eal/eal_hugepage_info.c
+++ b/lib/librte_eal/linuxapp/eal/eal_hugepage_info.c
@@ -6,6 +6,7 @@
#include <sys/types.h>
#include <sys/file.h>
#include <dirent.h>
+#include <fcntl.h>
#include <stdint.h>
#include <stdlib.h>
#include <stdio.h>
--
2.17.1
^ permalink raw reply [flat|nested] 36+ messages in thread
* [dpdk-dev] [PATCH v2 5/7] mem: improve musl compatibility
2018-08-29 11:56 [dpdk-dev] [PATCH 0/7] Improve core EAL musl compatibility Anatoly Burakov
` (11 preceding siblings ...)
2018-09-20 15:27 ` [dpdk-dev] [PATCH v2 4/7] eal/hugepage_info: " Anatoly Burakov
@ 2018-09-20 15:27 ` Anatoly Burakov
2018-09-20 15:27 ` [dpdk-dev] [PATCH v2 6/7] string_fns: " Anatoly Burakov
` (2 subsequent siblings)
15 siblings, 0 replies; 36+ messages in thread
From: Anatoly Burakov @ 2018-09-20 15:27 UTC (permalink / raw)
To: dev; +Cc: dpdk, bruce.richardson, stephen
When built against musl, fcntl.h doesn't silently get included.
Fix by including it explicitly.
Bugzilla ID: 31
Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
---
lib/librte_eal/common/eal_common_memory.c | 1 +
lib/librte_eal/linuxapp/eal/eal_memory.c | 1 +
2 files changed, 2 insertions(+)
diff --git a/lib/librte_eal/common/eal_common_memory.c b/lib/librte_eal/common/eal_common_memory.c
index 0b69804ff..9b5eacc57 100644
--- a/lib/librte_eal/common/eal_common_memory.c
+++ b/lib/librte_eal/common/eal_common_memory.c
@@ -2,6 +2,7 @@
* Copyright(c) 2010-2014 Intel Corporation
*/
+#include <fcntl.h>
#include <errno.h>
#include <stdio.h>
#include <stdint.h>
diff --git a/lib/librte_eal/linuxapp/eal/eal_memory.c b/lib/librte_eal/linuxapp/eal/eal_memory.c
index e3ac24815..256cab526 100644
--- a/lib/librte_eal/linuxapp/eal/eal_memory.c
+++ b/lib/librte_eal/linuxapp/eal/eal_memory.c
@@ -5,6 +5,7 @@
#define _FILE_OFFSET_BITS 64
#include <errno.h>
+#include <fcntl.h>
#include <stdarg.h>
#include <stdbool.h>
#include <stdlib.h>
--
2.17.1
^ permalink raw reply [flat|nested] 36+ messages in thread
* [dpdk-dev] [PATCH v2 6/7] string_fns: improve musl compatibility
2018-08-29 11:56 [dpdk-dev] [PATCH 0/7] Improve core EAL musl compatibility Anatoly Burakov
` (12 preceding siblings ...)
2018-09-20 15:27 ` [dpdk-dev] [PATCH v2 5/7] mem: " Anatoly Burakov
@ 2018-09-20 15:27 ` 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
15 siblings, 0 replies; 36+ messages in thread
From: Anatoly Burakov @ 2018-09-20 15:27 UTC (permalink / raw)
To: dev; +Cc: dpdk, bruce.richardson, stephen
Musl wraps various string functions such as strlcpy in order to
harden them. However, the fortify wrappers are included without
including the actual string functions being wrapped, which
throws missing definition compile errors. Fix by including
string.h in string functions header.
Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
---
lib/librte_eal/common/include/rte_string_fns.h | 1 +
1 file changed, 1 insertion(+)
diff --git a/lib/librte_eal/common/include/rte_string_fns.h b/lib/librte_eal/common/include/rte_string_fns.h
index ecd141b85..295844ad2 100644
--- a/lib/librte_eal/common/include/rte_string_fns.h
+++ b/lib/librte_eal/common/include/rte_string_fns.h
@@ -16,6 +16,7 @@ extern "C" {
#endif
#include <stdio.h>
+#include <string.h>
/**
* Takes string "string" parameter and splits it at character "delim"
--
2.17.1
^ permalink raw reply [flat|nested] 36+ messages in thread
* [dpdk-dev] [PATCH v2 7/7] eal: improve musl compatibility
2018-08-29 11:56 [dpdk-dev] [PATCH 0/7] Improve core EAL musl compatibility Anatoly Burakov
` (13 preceding siblings ...)
2018-09-20 15:27 ` [dpdk-dev] [PATCH v2 6/7] string_fns: " Anatoly Burakov
@ 2018-09-20 15:27 ` Anatoly Burakov
2018-09-28 15:25 ` [dpdk-dev] [PATCH 0/7] Improve core EAL " Bruce Richardson
15 siblings, 0 replies; 36+ messages in thread
From: Anatoly Burakov @ 2018-09-20 15:27 UTC (permalink / raw)
To: dev; +Cc: dpdk, bruce.richardson, stephen
Musl complains about pthread id being of wrong size, because on
musl, pthread_t is a struct pointer, not an unsinged int. Fix the
printing code by casting pthread id to unsigned pointer type and
adjusting the format specifier to be of appropriate size.
Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
---
lib/librte_eal/linuxapp/eal/eal.c | 4 ++--
lib/librte_eal/linuxapp/eal/eal_thread.c | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/lib/librte_eal/linuxapp/eal/eal.c b/lib/librte_eal/linuxapp/eal/eal.c
index e59ac6577..1d6a9ac44 100644
--- a/lib/librte_eal/linuxapp/eal/eal.c
+++ b/lib/librte_eal/linuxapp/eal/eal.c
@@ -979,8 +979,8 @@ rte_eal_init(int argc, char **argv)
ret = eal_thread_dump_affinity(cpuset, sizeof(cpuset));
- RTE_LOG(DEBUG, EAL, "Master lcore %u is ready (tid=%x;cpuset=[%s%s])\n",
- rte_config.master_lcore, (int)thread_id, cpuset,
+ RTE_LOG(DEBUG, EAL, "Master lcore %u is ready (tid=%zx;cpuset=[%s%s])\n",
+ rte_config.master_lcore, (uintptr_t)thread_id, cpuset,
ret == 0 ? "" : "...");
RTE_LCORE_FOREACH_SLAVE(i) {
diff --git a/lib/librte_eal/linuxapp/eal/eal_thread.c b/lib/librte_eal/linuxapp/eal/eal_thread.c
index b496fc711..379773b68 100644
--- a/lib/librte_eal/linuxapp/eal/eal_thread.c
+++ b/lib/librte_eal/linuxapp/eal/eal_thread.c
@@ -121,8 +121,8 @@ eal_thread_loop(__attribute__((unused)) void *arg)
ret = eal_thread_dump_affinity(cpuset, sizeof(cpuset));
- RTE_LOG(DEBUG, EAL, "lcore %u is ready (tid=%x;cpuset=[%s%s])\n",
- lcore_id, (int)thread_id, cpuset, ret == 0 ? "" : "...");
+ RTE_LOG(DEBUG, EAL, "lcore %u is ready (tid=%zx;cpuset=[%s%s])\n",
+ lcore_id, (uintptr_t)thread_id, cpuset, ret == 0 ? "" : "...");
/* read on our pipe to get commands */
while (1) {
--
2.17.1
^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: [dpdk-dev] [PATCH 0/7] Improve core EAL musl compatibility
2018-08-29 11:56 [dpdk-dev] [PATCH 0/7] Improve core EAL musl compatibility Anatoly Burakov
` (14 preceding siblings ...)
2018-09-20 15:27 ` [dpdk-dev] [PATCH v2 7/7] eal: " Anatoly Burakov
@ 2018-09-28 15:25 ` Bruce Richardson
2018-10-03 22:56 ` Thomas Monjalon
15 siblings, 1 reply; 36+ messages in thread
From: Bruce Richardson @ 2018-09-28 15:25 UTC (permalink / raw)
To: Anatoly Burakov; +Cc: dev, dpdk
On Wed, Aug 29, 2018 at 12:56:14PM +0100, Anatoly Burakov wrote:
> This patchset fixes numerous issues with musl compatibility
> in the core EAL libraries. It does not fix anything beyond
> core EAL (so, PCI driver is still broken, so are a few other
> drivers), but it's a good start.
>
> Tested on container with Alpine Linux. Alpine dependencies:
>
> build-base bsd-compat-headers libexecinfo-dev linux-headers numactl-dev
>
> For numactl-dev, testing repository needs to be enabled:
>
> echo "http://dl-cdn.alpinelinux.org/alpine/edge/testing" >> /etc/apk/repositories
>
> If successful (using a very broad definition of "success"),
> the build should fail somewhere in PCI bus driver in UIO.
>
Disabling the kernel drivers, I get a build of EAL and the other libraries
to compile as static libraries. However, shared library builds - and
therefore meson builds fail due to missing backtrace function when linking.
There is still work to do here, but this does fix a number of build errors
on alpine.
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: [dpdk-dev] [PATCH 0/7] Improve core EAL musl compatibility
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
0 siblings, 1 reply; 36+ messages in thread
From: Thomas Monjalon @ 2018-10-03 22:56 UTC (permalink / raw)
To: Anatoly Burakov; +Cc: dev, Bruce Richardson, dpdk
28/09/2018 17:25, Bruce Richardson:
> On Wed, Aug 29, 2018 at 12:56:14PM +0100, Anatoly Burakov wrote:
> > This patchset fixes numerous issues with musl compatibility
> > in the core EAL libraries. It does not fix anything beyond
> > core EAL (so, PCI driver is still broken, so are a few other
> > drivers), but it's a good start.
> >
> > Tested on container with Alpine Linux. Alpine dependencies:
> >
> > build-base bsd-compat-headers libexecinfo-dev linux-headers numactl-dev
> >
> > For numactl-dev, testing repository needs to be enabled:
> >
> > echo "http://dl-cdn.alpinelinux.org/alpine/edge/testing" >> /etc/apk/repositories
> >
> > If successful (using a very broad definition of "success"),
> > the build should fail somewhere in PCI bus driver in UIO.
> >
>
> Disabling the kernel drivers, I get a build of EAL and the other libraries
> to compile as static libraries. However, shared library builds - and
> therefore meson builds fail due to missing backtrace function when linking.
> There is still work to do here, but this does fix a number of build errors
> on alpine.
>
> Acked-by: Bruce Richardson <bruce.richardson@intel.com>
I see this error with meson GCC-8.2 static:
examples/ip_pipeline/conn.c:11: error: "__USE_GNU" redefined
^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: [dpdk-dev] [PATCH 0/7] Improve core EAL musl compatibility
2018-10-03 22:56 ` Thomas Monjalon
@ 2018-10-04 9:15 ` Burakov, Anatoly
0 siblings, 0 replies; 36+ messages in thread
From: Burakov, Anatoly @ 2018-10-04 9:15 UTC (permalink / raw)
To: Thomas Monjalon; +Cc: dev, Bruce Richardson, dpdk
On 03-Oct-18 11:56 PM, Thomas Monjalon wrote:
> 28/09/2018 17:25, Bruce Richardson:
>> On Wed, Aug 29, 2018 at 12:56:14PM +0100, Anatoly Burakov wrote:
>>> This patchset fixes numerous issues with musl compatibility
>>> in the core EAL libraries. It does not fix anything beyond
>>> core EAL (so, PCI driver is still broken, so are a few other
>>> drivers), but it's a good start.
>>>
>>> Tested on container with Alpine Linux. Alpine dependencies:
>>>
>>> build-base bsd-compat-headers libexecinfo-dev linux-headers numactl-dev
>>>
>>> For numactl-dev, testing repository needs to be enabled:
>>>
>>> echo "http://dl-cdn.alpinelinux.org/alpine/edge/testing" >> /etc/apk/repositories
>>>
>>> If successful (using a very broad definition of "success"),
>>> the build should fail somewhere in PCI bus driver in UIO.
>>>
>>
>> Disabling the kernel drivers, I get a build of EAL and the other libraries
>> to compile as static libraries. However, shared library builds - and
>> therefore meson builds fail due to missing backtrace function when linking.
>> There is still work to do here, but this does fix a number of build errors
>> on alpine.
>>
>> Acked-by: Bruce Richardson <bruce.richardson@intel.com>
>
> I see this error with meson GCC-8.2 static:
> examples/ip_pipeline/conn.c:11: error: "__USE_GNU" redefined
>
Why are we defining these? __USE_GNU is defined by <features.h> and
isn't supposed to be defined/undefined by the user in the first place.
--
Thanks,
Anatoly
^ permalink raw reply [flat|nested] 36+ messages in thread
* [dpdk-dev] [PATCH v3 0/7] Improve core EAL musl compatibility
2018-09-20 15:27 ` [dpdk-dev] [PATCH v2 0/7] Improve core EAL " Anatoly Burakov
@ 2018-10-04 10:20 ` 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
` (6 subsequent siblings)
7 siblings, 1 reply; 36+ messages in thread
From: Anatoly Burakov @ 2018-10-04 10:20 UTC (permalink / raw)
To: dev; +Cc: dpdk, bruce.richardson, stephen, thomas
This patchset fixes numerous issues with musl compatibility
in the core EAL libraries. It does not fix anything beyond
core EAL (so, PCI driver is still broken, so are a few other
drivers), but it's a good start.
Tested on container with Alpine Linux. Alpine dependencies:
build-base bsd-compat-headers libexecinfo-dev linux-headers numactl-dev
For numactl-dev, testing repository needs to be enabled:
echo "http://dl-cdn.alpinelinux.org/alpine/edge/testing" >> /etc/apk/repositories
If successful (using a very broad definition of "success"),
the build should fail somewhere in PCI bus driver in UIO.
v3 -> v2:
- Made _GNU_SOURCE unconditional for all DPDK targets
- Fixed usage of __USE_GNU and _GNU_SOURCE accross DPDK
v2 -> v1:
- Fixed patch 2 to use existing define if available
- Fixed patch 7 to use proper format specifier and
cast pthread ID to unsigned pointer type
Anatoly Burakov (7):
mk: build with _GNU_SOURCE defined by default
pci/vfio: improve musl compatibility
fbarray: improve musl compatibility
eal/hugepage_info: improve musl compatibility
mem: improve musl compatibility
string_fns: improve musl compatibility
eal: improve musl compatibility
app/meson.build | 7 +++++-
app/test-pmd/Makefile | 2 --
buildtools/pmdinfogen/pmdinfogen.c | 1 -
drivers/bus/dpaa/Makefile | 1 -
drivers/bus/dpaa/meson.build | 1 -
drivers/bus/fslmc/meson.build | 1 -
drivers/bus/pci/linux/Makefile | 2 --
drivers/bus/pci/linux/pci_vfio.c | 2 ++
drivers/bus/pci/meson.build | 1 -
drivers/crypto/dpaa2_sec/Makefile | 1 -
drivers/crypto/dpaa_sec/Makefile | 1 -
drivers/mempool/dpaa/Makefile | 1 -
drivers/meson.build | 4 ++++
drivers/net/mlx5/mlx5_ethdev.c | 2 --
drivers/net/mlx5/mlx5_socket.c | 2 --
drivers/net/softnic/conn.c | 1 -
examples/cmdline/Makefile | 1 -
examples/ethtool/ethtool-app/Makefile | 2 +-
examples/ip_pipeline/conn.c | 1 -
examples/l2fwd-cat/Makefile | 2 --
examples/l2fwd-cat/meson.build | 1 -
examples/load_balancer/Makefile | 1 -
examples/meson.build | 4 ++++
.../performance-thread/l3fwd-thread/main.c | 2 --
.../performance-thread/pthread_shim/main.c | 1 -
.../pthread_shim/pthread_shim.c | 1 -
examples/qos_sched/Makefile | 2 --
examples/tep_termination/Makefile | 1 -
examples/vhost/Makefile | 1 -
examples/vhost_crypto/Makefile | 1 -
examples/vhost_crypto/meson.build | 2 +-
examples/vhost_scsi/Makefile | 4 ++--
examples/vhost_scsi/meson.build | 2 +-
lib/librte_cmdline/Makefile | 1 -
lib/librte_cmdline/cmdline.c | 24 -------------------
lib/librte_eal/bsdapp/eal/Makefile | 5 ----
lib/librte_eal/common/eal_common_fbarray.c | 1 +
lib/librte_eal/common/eal_common_memory.c | 1 +
.../common/include/rte_string_fns.h | 1 +
lib/librte_eal/linuxapp/eal/Makefile | 16 -------------
lib/librte_eal/linuxapp/eal/eal.c | 4 ++--
.../linuxapp/eal/eal_hugepage_info.c | 1 +
lib/librte_eal/linuxapp/eal/eal_memory.c | 1 +
lib/librte_eal/linuxapp/eal/eal_thread.c | 4 ++--
lib/librte_eal/meson.build | 1 -
lib/librte_pdump/Makefile | 1 -
lib/librte_sched/Makefile | 2 --
lib/meson.build | 4 ++++
mk/target/generic/rte.vars.mk | 3 +++
test/test/Makefile | 2 --
test/test/meson.build | 3 +++
51 files changed, 40 insertions(+), 94 deletions(-)
--
2.17.1
^ permalink raw reply [flat|nested] 36+ messages in thread
* [dpdk-dev] [PATCH v3 1/7] mk: build with _GNU_SOURCE defined by default
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-04 10:20 ` Anatoly Burakov
2018-10-04 10:20 ` [dpdk-dev] [PATCH v3 2/7] pci/vfio: improve musl compatibility Anatoly Burakov
` (5 subsequent siblings)
7 siblings, 0 replies; 36+ messages in thread
From: Anatoly Burakov @ 2018-10-04 10:20 UTC (permalink / raw)
To: dev
Cc: Wenzhuo Lu, Jingjing Wu, Bernard Iremonger, Neil Horman,
Hemant Agrawal, Shreyansh Jain, Akhil Goyal, Shahaf Shuler,
Yongseok Koh, Jasvinder Singh, Cristian Dumitrescu, Olivier Matz,
Remy Horton, Ori Kam, Bruce Richardson, Pablo de Lara,
Radu Nicolau, Tomasz Kantecki, John McNamara, Harry van Haaren,
Xiaoyun Li, Maxime Coquelin, Tiwei Bie, Zhihong Wang,
Reshma Pattan, Thomas Monjalon, dpdk, stephen
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
builds.
Remove all usages of _GNU_SOURCE in source files and makefiles,
and also fixup a couple of instances of using __USE_GNU instead
of _GNU_SOURCE.
Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
---
app/meson.build | 7 +++++-
app/test-pmd/Makefile | 2 --
buildtools/pmdinfogen/pmdinfogen.c | 1 -
drivers/bus/dpaa/Makefile | 1 -
drivers/bus/dpaa/meson.build | 1 -
drivers/bus/fslmc/meson.build | 1 -
drivers/bus/pci/linux/Makefile | 2 --
drivers/bus/pci/meson.build | 1 -
drivers/crypto/dpaa2_sec/Makefile | 1 -
drivers/crypto/dpaa_sec/Makefile | 1 -
drivers/mempool/dpaa/Makefile | 1 -
drivers/meson.build | 4 ++++
drivers/net/mlx5/mlx5_ethdev.c | 2 --
drivers/net/mlx5/mlx5_socket.c | 2 --
drivers/net/softnic/conn.c | 1 -
examples/cmdline/Makefile | 1 -
examples/ethtool/ethtool-app/Makefile | 2 +-
examples/ip_pipeline/conn.c | 1 -
examples/l2fwd-cat/Makefile | 2 --
examples/l2fwd-cat/meson.build | 1 -
examples/load_balancer/Makefile | 1 -
examples/meson.build | 4 ++++
.../performance-thread/l3fwd-thread/main.c | 2 --
.../performance-thread/pthread_shim/main.c | 1 -
.../pthread_shim/pthread_shim.c | 1 -
examples/qos_sched/Makefile | 2 --
examples/tep_termination/Makefile | 1 -
examples/vhost/Makefile | 1 -
examples/vhost_crypto/Makefile | 1 -
examples/vhost_crypto/meson.build | 2 +-
examples/vhost_scsi/Makefile | 4 ++--
examples/vhost_scsi/meson.build | 2 +-
lib/librte_cmdline/Makefile | 1 -
lib/librte_cmdline/cmdline.c | 24 -------------------
lib/librte_eal/bsdapp/eal/Makefile | 5 ----
lib/librte_eal/linuxapp/eal/Makefile | 16 -------------
lib/librte_eal/meson.build | 1 -
lib/librte_pdump/Makefile | 1 -
lib/librte_sched/Makefile | 2 --
lib/meson.build | 4 ++++
mk/target/generic/rte.vars.mk | 3 +++
test/test/Makefile | 2 --
test/test/meson.build | 3 +++
43 files changed, 29 insertions(+), 90 deletions(-)
diff --git a/app/meson.build b/app/meson.build
index 99e0b93ec..e68d949e9 100644
--- a/app/meson.build
+++ b/app/meson.build
@@ -11,13 +11,18 @@ apps = ['pdump',
# for BSD only
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
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/app/test-pmd/Makefile b/app/test-pmd/Makefile
index 2b4d604b8..3694a5e31 100644
--- a/app/test-pmd/Makefile
+++ b/app/test-pmd/Makefile
@@ -70,8 +70,6 @@ endif
endif
-CFLAGS_cmdline.o := -D_GNU_SOURCE
-
include $(RTE_SDK)/mk/rte.app.mk
endif
diff --git a/buildtools/pmdinfogen/pmdinfogen.c b/buildtools/pmdinfogen/pmdinfogen.c
index 0f35ca46b..dc0b6d5ff 100644
--- a/buildtools/pmdinfogen/pmdinfogen.c
+++ b/buildtools/pmdinfogen/pmdinfogen.c
@@ -8,7 +8,6 @@
*
*/
-#define _GNU_SOURCE
#include <stdio.h>
#include <ctype.h>
#include <string.h>
diff --git a/drivers/bus/dpaa/Makefile b/drivers/bus/dpaa/Makefile
index bffaa9d92..9c90e53f8 100644
--- a/drivers/bus/dpaa/Makefile
+++ b/drivers/bus/dpaa/Makefile
@@ -14,7 +14,6 @@ CFLAGS := -I$(SRCDIR) $(CFLAGS)
CFLAGS += -O3 $(WERROR_FLAGS)
CFLAGS += -Wno-pointer-arith
CFLAGS += -Wno-cast-qual
-CFLAGS += -D _GNU_SOURCE
CFLAGS += -I$(RTE_BUS_DPAA)/
CFLAGS += -I$(RTE_BUS_DPAA)/include
CFLAGS += -I$(RTE_BUS_DPAA)/base/qbman
diff --git a/drivers/bus/dpaa/meson.build b/drivers/bus/dpaa/meson.build
index d10b62c03..065a07dfd 100644
--- a/drivers/bus/dpaa/meson.build
+++ b/drivers/bus/dpaa/meson.build
@@ -26,4 +26,3 @@ if cc.has_argument('-Wno-cast-qual')
endif
includes += include_directories('include', 'base/qbman')
-cflags += ['-D_GNU_SOURCE']
diff --git a/drivers/bus/fslmc/meson.build b/drivers/bus/fslmc/meson.build
index 22a56a6fc..6b70882b2 100644
--- a/drivers/bus/fslmc/meson.build
+++ b/drivers/bus/fslmc/meson.build
@@ -24,4 +24,3 @@ sources = files('fslmc_bus.c',
allow_experimental_apis = true
includes += include_directories('mc', 'qbman/include', 'portal')
-cflags += ['-D_GNU_SOURCE']
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/bus/pci/meson.build b/drivers/bus/pci/meson.build
index 23d6a5fec..1236d477e 100644
--- a/drivers/bus/pci/meson.build
+++ b/drivers/bus/pci/meson.build
@@ -11,7 +11,6 @@ if host_machine.system() == 'linux'
'linux/pci_uio.c',
'linux/pci_vfio.c')
includes += include_directories('linux')
- cflags += ['-D_GNU_SOURCE']
else
sources += files('bsd/pci.c')
includes += include_directories('bsd')
diff --git a/drivers/crypto/dpaa2_sec/Makefile b/drivers/crypto/dpaa2_sec/Makefile
index da3d8f84f..6197452be 100644
--- a/drivers/crypto/dpaa2_sec/Makefile
+++ b/drivers/crypto/dpaa2_sec/Makefile
@@ -20,7 +20,6 @@ LIB = librte_pmd_dpaa2_sec.a
CFLAGS += -DALLOW_EXPERIMENTAL_API
CFLAGS += -O3
CFLAGS += $(WERROR_FLAGS)
-CFLAGS += -D _GNU_SOURCE
ifeq ($(CONFIG_RTE_TOOLCHAIN_GCC),y)
ifeq ($(shell test $(GCC_VERSION) -gt 70 && echo 1), 1)
diff --git a/drivers/crypto/dpaa_sec/Makefile b/drivers/crypto/dpaa_sec/Makefile
index 9be447041..afe8639e3 100644
--- a/drivers/crypto/dpaa_sec/Makefile
+++ b/drivers/crypto/dpaa_sec/Makefile
@@ -11,7 +11,6 @@ LIB = librte_pmd_dpaa_sec.a
# build flags
CFLAGS += -DALLOW_EXPERIMENTAL_API
-CFLAGS += -D _GNU_SOURCE
CFLAGS += -O3
CFLAGS += $(WERROR_FLAGS)
diff --git a/drivers/mempool/dpaa/Makefile b/drivers/mempool/dpaa/Makefile
index da8da1e90..4f22fbc76 100644
--- a/drivers/mempool/dpaa/Makefile
+++ b/drivers/mempool/dpaa/Makefile
@@ -10,7 +10,6 @@ LIB = librte_mempool_dpaa.a
CFLAGS := -I$(SRCDIR) $(CFLAGS)
CFLAGS += -O3 $(WERROR_FLAGS)
-CFLAGS += -D _GNU_SOURCE
CFLAGS += -I$(RTE_SDK)/drivers/bus/dpaa
CFLAGS += -I$(RTE_SDK)/drivers/bus/dpaa/include/
CFLAGS += -I$(RTE_SDK)/drivers/mempool/dpaa
diff --git a/drivers/meson.build b/drivers/meson.build
index 47b4215a3..567f4a19c 100644
--- a/drivers/meson.build
+++ b/drivers/meson.build
@@ -16,6 +16,10 @@ default_cflags = machine_args
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:driver_classes
drivers = []
std_deps = []
diff --git a/drivers/net/mlx5/mlx5_ethdev.c b/drivers/net/mlx5/mlx5_ethdev.c
index 34c5b95ee..3ab448a21 100644
--- a/drivers/net/mlx5/mlx5_ethdev.c
+++ b/drivers/net/mlx5/mlx5_ethdev.c
@@ -3,8 +3,6 @@
* Copyright 2015 Mellanox Technologies, Ltd
*/
-#define _GNU_SOURCE
-
#include <stddef.h>
#include <assert.h>
#include <inttypes.h>
diff --git a/drivers/net/mlx5/mlx5_socket.c b/drivers/net/mlx5/mlx5_socket.c
index a3a522911..00106171d 100644
--- a/drivers/net/mlx5/mlx5_socket.c
+++ b/drivers/net/mlx5/mlx5_socket.c
@@ -3,8 +3,6 @@
* Copyright 2016 Mellanox Technologies, Ltd
*/
-#define _GNU_SOURCE
-
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/un.h>
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/cmdline/Makefile b/examples/cmdline/Makefile
index 7893c85b3..a617cce11 100644
--- a/examples/cmdline/Makefile
+++ b/examples/cmdline/Makefile
@@ -56,7 +56,6 @@ SRCS-y := main.c commands.c parse_obj_list.c
CFLAGS += -O3
CFLAGS += $(WERROR_FLAGS)
-CFLAGS_parse_obj_list.o := -D_GNU_SOURCE
include $(RTE_SDK)/mk/rte.extapp.mk
diff --git a/examples/ethtool/ethtool-app/Makefile b/examples/ethtool/ethtool-app/Makefile
index 4cd9efdd5..9ecfc0b89 100644
--- a/examples/ethtool/ethtool-app/Makefile
+++ b/examples/ethtool/ethtool-app/Makefile
@@ -16,7 +16,7 @@ APP = ethtool
# all source are stored in SRCS-y
SRCS-y := main.c ethapp.c
-CFLAGS += -O3 -D_GNU_SOURCE -pthread -I$(SRCDIR)/../lib
+CFLAGS += -O3 -pthread -I$(SRCDIR)/../lib
CFLAGS += $(WERROR_FLAGS)
LDLIBS += -L$(subst ethtool-app,lib,$(RTE_OUTPUT))/lib
diff --git a/examples/ip_pipeline/conn.c b/examples/ip_pipeline/conn.c
index 6b08e9e8e..30fca80c1 100644
--- a/examples/ip_pipeline/conn.c
+++ b/examples/ip_pipeline/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/l2fwd-cat/Makefile b/examples/l2fwd-cat/Makefile
index aec770c28..b6eeabde1 100644
--- a/examples/l2fwd-cat/Makefile
+++ b/examples/l2fwd-cat/Makefile
@@ -23,7 +23,6 @@ CFLAGS += -O3 $(shell pkg-config --cflags libdpdk)
LDFLAGS_SHARED = $(shell pkg-config --libs libdpdk)
LDFLAGS_STATIC = -Wl,-Bstatic $(shell pkg-config --static --libs libdpdk)
-CFLAGS += -D_GNU_SOURCE
LDFLAGS += -lpqos
build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build
@@ -66,7 +65,6 @@ endif
EXTRA_CFLAGS += -O3 -g -Wfatal-errors
CFLAGS += -I$(PQOS_INSTALL_PATH)/../include
-CFLAGS_cat.o := -D_GNU_SOURCE
LDLIBS += -L$(PQOS_INSTALL_PATH)
LDLIBS += -lpqos
diff --git a/examples/l2fwd-cat/meson.build b/examples/l2fwd-cat/meson.build
index 1234e7b55..4e2777a03 100644
--- a/examples/l2fwd-cat/meson.build
+++ b/examples/l2fwd-cat/meson.build
@@ -9,7 +9,6 @@
pqos = cc.find_library('pqos', required: false)
build = pqos.found()
ext_deps += pqos
-cflags += '-D_GNU_SOURCE'
cflags += '-I/usr/local/include' # assume pqos lib installed in /usr/local
sources = files(
'cat.c', 'l2fwd-cat.c'
diff --git a/examples/load_balancer/Makefile b/examples/load_balancer/Makefile
index fc8df71e8..197b019d5 100644
--- a/examples/load_balancer/Makefile
+++ b/examples/load_balancer/Makefile
@@ -50,7 +50,6 @@ include $(RTE_SDK)/mk/rte.vars.mk
CFLAGS += -O3 -g
CFLAGS += $(WERROR_FLAGS)
-CFLAGS_config.o := -D_GNU_SOURCE
# workaround for a gcc bug with noreturn attribute
# http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12603
diff --git a/examples/meson.build b/examples/meson.build
index 4ee7a1114..af81c762e 100644
--- a/examples/meson.build
+++ b/examples/meson.build
@@ -22,6 +22,10 @@ default_cflags = machine_args
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/examples/performance-thread/l3fwd-thread/main.c b/examples/performance-thread/l3fwd-thread/main.c
index 50fd1b00a..4f8747bc3 100644
--- a/examples/performance-thread/l3fwd-thread/main.c
+++ b/examples/performance-thread/l3fwd-thread/main.c
@@ -2,8 +2,6 @@
* Copyright(c) 2010-2016 Intel Corporation
*/
-#define _GNU_SOURCE
-
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
diff --git a/examples/performance-thread/pthread_shim/main.c b/examples/performance-thread/pthread_shim/main.c
index 7d0d58116..03ff39436 100644
--- a/examples/performance-thread/pthread_shim/main.c
+++ b/examples/performance-thread/pthread_shim/main.c
@@ -2,7 +2,6 @@
* Copyright(c) 2015 Intel Corporation
*/
-#define _GNU_SOURCE
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
diff --git a/examples/performance-thread/pthread_shim/pthread_shim.c b/examples/performance-thread/pthread_shim/pthread_shim.c
index 53f12437f..a02de0677 100644
--- a/examples/performance-thread/pthread_shim/pthread_shim.c
+++ b/examples/performance-thread/pthread_shim/pthread_shim.c
@@ -6,7 +6,6 @@
#include <stdlib.h>
#include <sys/types.h>
#include <errno.h>
-#define __USE_GNU
#include <sched.h>
#include <dlfcn.h>
diff --git a/examples/qos_sched/Makefile b/examples/qos_sched/Makefile
index a7ecf9788..45b0a9eb6 100644
--- a/examples/qos_sched/Makefile
+++ b/examples/qos_sched/Makefile
@@ -57,8 +57,6 @@ else
CFLAGS += -O3
CFLAGS += $(WERROR_FLAGS)
-CFLAGS_args.o := -D_GNU_SOURCE
-CFLAGS_cfg_file.o := -D_GNU_SOURCE
include $(RTE_SDK)/mk/rte.extapp.mk
diff --git a/examples/tep_termination/Makefile b/examples/tep_termination/Makefile
index 8ec1a38ef..4c1564325 100644
--- a/examples/tep_termination/Makefile
+++ b/examples/tep_termination/Makefile
@@ -60,7 +60,6 @@ endif
CFLAGS += -DALLOW_EXPERIMENTAL_API
CFLAGS += -O3
CFLAGS += $(WERROR_FLAGS)
-CFLAGS += -D_GNU_SOURCE
include $(RTE_SDK)/mk/rte.extapp.mk
endif
diff --git a/examples/vhost/Makefile b/examples/vhost/Makefile
index a2ea97a0c..c6964381b 100644
--- a/examples/vhost/Makefile
+++ b/examples/vhost/Makefile
@@ -61,7 +61,6 @@ else
CFLAGS += -DALLOW_EXPERIMENTAL_API
CFLAGS += -O2 -D_FILE_OFFSET_BITS=64
CFLAGS += $(WERROR_FLAGS)
-CFLAGS += -D_GNU_SOURCE
include $(RTE_SDK)/mk/rte.extapp.mk
diff --git a/examples/vhost_crypto/Makefile b/examples/vhost_crypto/Makefile
index 83d331012..a620abf49 100644
--- a/examples/vhost_crypto/Makefile
+++ b/examples/vhost_crypto/Makefile
@@ -25,7 +25,6 @@ SRCS-y := main.c
CFLAGS += -DALLOW_EXPERIMENTAL_API
CFLAGS += -O2 -D_FILE_OFFSET_BITS=64
CFLAGS += $(WERROR_FLAGS)
-CFLAGS += -D_GNU_SOURCE
include $(RTE_SDK)/mk/rte.extapp.mk
diff --git a/examples/vhost_crypto/meson.build b/examples/vhost_crypto/meson.build
index 0f4876f06..daf19fb87 100644
--- a/examples/vhost_crypto/meson.build
+++ b/examples/vhost_crypto/meson.build
@@ -8,7 +8,7 @@
allow_experimental_apis = true
deps += ['vhost', 'cryptodev']
-cflags += ['-D_GNU_SOURCE','-D_FILE_OFFSET_BITS=64']
+cflags += ['-D_FILE_OFFSET_BITS=64']
sources = files(
'main.c'
)
diff --git a/examples/vhost_scsi/Makefile b/examples/vhost_scsi/Makefile
index fa0cf727e..523aee0bf 100644
--- a/examples/vhost_scsi/Makefile
+++ b/examples/vhost_scsi/Makefile
@@ -18,7 +18,7 @@ shared: build/$(APP)-shared
static: build/$(APP)-static
ln -sf $(APP)-static build/$(APP)
-CFLAGS += -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64
+CFLAGS += -D_FILE_OFFSET_BITS=64
LDFLAGS += -pthread
PC_FILE := $(shell pkg-config --path libdpdk)
@@ -57,7 +57,7 @@ please change the definition of the RTE_TARGET environment variable)
all:
else
-CFLAGS += -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64
+CFLAGS += -D_FILE_OFFSET_BITS=64
CFLAGS += -O2
CFLAGS += $(WERROR_FLAGS)
diff --git a/examples/vhost_scsi/meson.build b/examples/vhost_scsi/meson.build
index 5f92370f5..2303bcaed 100644
--- a/examples/vhost_scsi/meson.build
+++ b/examples/vhost_scsi/meson.build
@@ -10,7 +10,7 @@ if host_machine.system() != 'linux'
build = false
endif
deps += 'vhost'
-cflags += ['-D_GNU_SOURCE','-D_FILE_OFFSET_BITS=64']
+cflags += ['-D_FILE_OFFSET_BITS=64']
sources = files(
'scsi.c', 'vhost_scsi.c'
)
diff --git a/lib/librte_cmdline/Makefile b/lib/librte_cmdline/Makefile
index ddae1cfde..c64142b8d 100644
--- a/lib/librte_cmdline/Makefile
+++ b/lib/librte_cmdline/Makefile
@@ -25,7 +25,6 @@ SRCS-$(CONFIG_RTE_LIBRTE_CMDLINE) += cmdline_vt100.c
SRCS-$(CONFIG_RTE_LIBRTE_CMDLINE) += cmdline_socket.c
SRCS-$(CONFIG_RTE_LIBRTE_CMDLINE) += cmdline_parse_portlist.c
-CFLAGS += -D_GNU_SOURCE
LDLIBS += -lrte_eal
# install includes
diff --git a/lib/librte_cmdline/cmdline.c b/lib/librte_cmdline/cmdline.c
index 591b78b0f..d9042f048 100644
--- a/lib/librte_cmdline/cmdline.c
+++ b/lib/librte_cmdline/cmdline.c
@@ -126,35 +126,11 @@ cmdline_printf(const struct cmdline *cl, const char *fmt, ...)
if (!cl || !fmt)
return;
-#ifdef _GNU_SOURCE
if (cl->s_out < 0)
return;
va_start(ap, fmt);
vdprintf(cl->s_out, fmt, ap);
va_end(ap);
-#else
- int ret;
- char *buf;
-
- if (cl->s_out < 0)
- return;
-
- buf = malloc(BUFSIZ);
- if (buf == NULL)
- return;
- va_start(ap, fmt);
- ret = vsnprintf(buf, BUFSIZ, fmt, ap);
- va_end(ap);
- if (ret < 0) {
- free(buf);
- return;
- }
- if (ret >= BUFSIZ)
- ret = BUFSIZ - 1;
- ret = write(cl->s_out, buf, ret);
- (void)ret;
- free(buf);
-#endif
}
int
diff --git a/lib/librte_eal/bsdapp/eal/Makefile b/lib/librte_eal/bsdapp/eal/Makefile
index d27da3d15..7c8e00a2e 100644
--- a/lib/librte_eal/bsdapp/eal/Makefile
+++ b/lib/librte_eal/bsdapp/eal/Makefile
@@ -77,11 +77,6 @@ SRCS-y += rte_cycles.c
CFLAGS_eal_common_cpuflags.o := $(CPUFLAGS_LIST)
-CFLAGS_eal.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
-
# 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/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/librte_eal/meson.build b/lib/librte_eal/meson.build
index e1fde15d1..f68c6733c 100644
--- a/lib/librte_eal/meson.build
+++ b/lib/librte_eal/meson.build
@@ -25,7 +25,6 @@ version = 8 # the version of the EAL API
allow_experimental_apis = true
deps += 'compat'
deps += 'kvargs'
-cflags += '-D_GNU_SOURCE'
sources = common_sources + env_sources
objs = common_objs + env_objs
headers = common_headers + env_headers
diff --git a/lib/librte_pdump/Makefile b/lib/librte_pdump/Makefile
index ee14dba7a..b241151dc 100644
--- a/lib/librte_pdump/Makefile
+++ b/lib/librte_pdump/Makefile
@@ -8,7 +8,6 @@ LIB = librte_pdump.a
CFLAGS += -DALLOW_EXPERIMENTAL_API
CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR) -O3
-CFLAGS += -D_GNU_SOURCE
LDLIBS += -lrte_eal -lrte_mempool -lrte_mbuf -lrte_ethdev
EXPORT_MAP := rte_pdump_version.map
diff --git a/lib/librte_sched/Makefile b/lib/librte_sched/Makefile
index 55d9c6989..46c53ed71 100644
--- a/lib/librte_sched/Makefile
+++ b/lib/librte_sched/Makefile
@@ -11,8 +11,6 @@ LIB = librte_sched.a
CFLAGS += -O3
CFLAGS += $(WERROR_FLAGS)
-CFLAGS_rte_red.o := -D_GNU_SOURCE
-
LDLIBS += -lm
LDLIBS += -lrt
LDLIBS += -lrte_eal -lrte_mempool -lrte_mbuf -lrte_net
diff --git a/lib/meson.build b/lib/meson.build
index 3acc67e6e..24351cc40 100644
--- a/lib/meson.build
+++ b/lib/meson.build
@@ -32,6 +32,10 @@ if cc.has_argument('-Wno-format-truncation')
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/mk/target/generic/rte.vars.mk b/mk/target/generic/rte.vars.mk
index 98085cd31..dd149acc9 100644
--- a/mk/target/generic/rte.vars.mk
+++ b/mk/target/generic/rte.vars.mk
@@ -108,6 +108,9 @@ CFLAGS += -include $(RTE_SDK_BIN)/include/rte_config.h
LDFLAGS += -L$(RTE_SDK_BIN)/lib
endif
+# always define _GNU_SOURCE
+CFLAGS += -D_GNU_SOURCE
+
export CFLAGS
export LDFLAGS
diff --git a/test/test/Makefile b/test/test/Makefile
index dcea4410d..0b7b56ca2 100644
--- a/test/test/Makefile
+++ b/test/test/Makefile
@@ -209,8 +209,6 @@ CFLAGS += -DALLOW_EXPERIMENTAL_API
CFLAGS += -O3
CFLAGS += $(WERROR_FLAGS)
-CFLAGS += -D_GNU_SOURCE
-
LDLIBS += -lm
ifeq ($(CONFIG_RTE_COMPRESSDEV_TEST),y)
ifeq ($(CONFIG_RTE_LIBRTE_COMPRESSDEV),y)
diff --git a/test/test/meson.build b/test/test/meson.build
index bacb5b144..02ce75959 100644
--- a/test/test/meson.build
+++ b/test/test/meson.build
@@ -251,6 +251,9 @@ if cc.has_argument('-Wno-format-truncation')
cflags += '-Wno-format-truncation'
endif
+# specify -D_GNU_SOURCE unconditionally
+default_cflags += '-D_GNU_SOURCE'
+
test_dep_objs = []
compress_test_dep = dependency('zlib', required: false)
if compress_test_dep.found()
--
2.17.1
^ permalink raw reply [flat|nested] 36+ messages in thread
* [dpdk-dev] [PATCH v3 2/7] pci/vfio: improve musl compatibility
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-04 10:20 ` [dpdk-dev] [PATCH v3 1/7] mk: build with _GNU_SOURCE defined by default Anatoly Burakov
@ 2018-10-04 10:20 ` Anatoly Burakov
2018-10-04 10:20 ` [dpdk-dev] [PATCH v3 3/7] fbarray: " Anatoly Burakov
` (4 subsequent siblings)
7 siblings, 0 replies; 36+ messages in thread
From: Anatoly Burakov @ 2018-10-04 10:20 UTC (permalink / raw)
To: dev; +Cc: dpdk, bruce.richardson, stephen, thomas
Musl already has PAGE_SIZE defined, and our define clashed with it.
Rename our define to SYS_PAGE_SIZE.
Bugzilla ID: 36
Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
---
drivers/bus/pci/linux/pci_vfio.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/bus/pci/linux/pci_vfio.c b/drivers/bus/pci/linux/pci_vfio.c
index 686386d6a..85f6c9803 100644
--- a/drivers/bus/pci/linux/pci_vfio.c
+++ b/drivers/bus/pci/linux/pci_vfio.c
@@ -35,7 +35,9 @@
#ifdef VFIO_PRESENT
+#ifndef PAGE_SIZE
#define PAGE_SIZE (sysconf(_SC_PAGESIZE))
+#endif
#define PAGE_MASK (~(PAGE_SIZE - 1))
static struct rte_tailq_elem rte_vfio_tailq = {
--
2.17.1
^ permalink raw reply [flat|nested] 36+ messages in thread
* [dpdk-dev] [PATCH v3 3/7] fbarray: improve musl compatibility
2018-09-20 15:27 ` [dpdk-dev] [PATCH v2 0/7] Improve core EAL " Anatoly Burakov
` (2 preceding siblings ...)
2018-10-04 10:20 ` [dpdk-dev] [PATCH v3 2/7] pci/vfio: improve musl compatibility Anatoly Burakov
@ 2018-10-04 10:20 ` Anatoly Burakov
2018-10-04 10:20 ` [dpdk-dev] [PATCH v3 4/7] eal/hugepage_info: " Anatoly Burakov
` (3 subsequent siblings)
7 siblings, 0 replies; 36+ messages in thread
From: Anatoly Burakov @ 2018-10-04 10:20 UTC (permalink / raw)
To: dev; +Cc: dpdk, bruce.richardson, stephen, thomas
When built against musl, fcntl.h doesn't silently get included.
Fix by including it explicitly.
Bugzilla ID: 34
Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
---
lib/librte_eal/common/eal_common_fbarray.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/lib/librte_eal/common/eal_common_fbarray.c b/lib/librte_eal/common/eal_common_fbarray.c
index ba6c4ae39..ea0735cb8 100644
--- a/lib/librte_eal/common/eal_common_fbarray.c
+++ b/lib/librte_eal/common/eal_common_fbarray.c
@@ -2,6 +2,7 @@
* Copyright(c) 2017-2018 Intel Corporation
*/
+#include <fcntl.h>
#include <inttypes.h>
#include <limits.h>
#include <sys/mman.h>
--
2.17.1
^ permalink raw reply [flat|nested] 36+ messages in thread
* [dpdk-dev] [PATCH v3 4/7] eal/hugepage_info: improve musl compatibility
2018-09-20 15:27 ` [dpdk-dev] [PATCH v2 0/7] Improve core EAL " Anatoly Burakov
` (3 preceding siblings ...)
2018-10-04 10:20 ` [dpdk-dev] [PATCH v3 3/7] fbarray: " Anatoly Burakov
@ 2018-10-04 10:20 ` Anatoly Burakov
2018-10-04 10:20 ` [dpdk-dev] [PATCH v3 5/7] mem: " Anatoly Burakov
` (2 subsequent siblings)
7 siblings, 0 replies; 36+ messages in thread
From: Anatoly Burakov @ 2018-10-04 10:20 UTC (permalink / raw)
To: dev; +Cc: dpdk, bruce.richardson, stephen, thomas
When built against musl, fcntl.h doesn't silently get included.
Fix by including it explicitly.
Bugzilla ID: 33
Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
---
lib/librte_eal/linuxapp/eal/eal_hugepage_info.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/lib/librte_eal/linuxapp/eal/eal_hugepage_info.c b/lib/librte_eal/linuxapp/eal/eal_hugepage_info.c
index 3a7d4b222..0eab1cf71 100644
--- a/lib/librte_eal/linuxapp/eal/eal_hugepage_info.c
+++ b/lib/librte_eal/linuxapp/eal/eal_hugepage_info.c
@@ -6,6 +6,7 @@
#include <sys/types.h>
#include <sys/file.h>
#include <dirent.h>
+#include <fcntl.h>
#include <stdint.h>
#include <stdlib.h>
#include <stdio.h>
--
2.17.1
^ permalink raw reply [flat|nested] 36+ messages in thread
* [dpdk-dev] [PATCH v3 5/7] mem: improve musl compatibility
2018-09-20 15:27 ` [dpdk-dev] [PATCH v2 0/7] Improve core EAL " Anatoly Burakov
` (4 preceding siblings ...)
2018-10-04 10:20 ` [dpdk-dev] [PATCH v3 4/7] eal/hugepage_info: " Anatoly Burakov
@ 2018-10-04 10:20 ` 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
7 siblings, 0 replies; 36+ messages in thread
From: Anatoly Burakov @ 2018-10-04 10:20 UTC (permalink / raw)
To: dev; +Cc: dpdk, bruce.richardson, stephen, thomas
When built against musl, fcntl.h doesn't silently get included.
Fix by including it explicitly.
Bugzilla ID: 31
Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
---
lib/librte_eal/common/eal_common_memory.c | 1 +
lib/librte_eal/linuxapp/eal/eal_memory.c | 1 +
2 files changed, 2 insertions(+)
diff --git a/lib/librte_eal/common/eal_common_memory.c b/lib/librte_eal/common/eal_common_memory.c
index 0b69804ff..9b5eacc57 100644
--- a/lib/librte_eal/common/eal_common_memory.c
+++ b/lib/librte_eal/common/eal_common_memory.c
@@ -2,6 +2,7 @@
* Copyright(c) 2010-2014 Intel Corporation
*/
+#include <fcntl.h>
#include <errno.h>
#include <stdio.h>
#include <stdint.h>
diff --git a/lib/librte_eal/linuxapp/eal/eal_memory.c b/lib/librte_eal/linuxapp/eal/eal_memory.c
index e3ac24815..256cab526 100644
--- a/lib/librte_eal/linuxapp/eal/eal_memory.c
+++ b/lib/librte_eal/linuxapp/eal/eal_memory.c
@@ -5,6 +5,7 @@
#define _FILE_OFFSET_BITS 64
#include <errno.h>
+#include <fcntl.h>
#include <stdarg.h>
#include <stdbool.h>
#include <stdlib.h>
--
2.17.1
^ permalink raw reply [flat|nested] 36+ messages in thread
* [dpdk-dev] [PATCH v3 6/7] string_fns: improve musl compatibility
2018-09-20 15:27 ` [dpdk-dev] [PATCH v2 0/7] Improve core EAL " Anatoly Burakov
` (5 preceding siblings ...)
2018-10-04 10:20 ` [dpdk-dev] [PATCH v3 5/7] mem: " Anatoly Burakov
@ 2018-10-04 10:20 ` Anatoly Burakov
2018-10-04 10:20 ` [dpdk-dev] [PATCH v3 7/7] eal: " Anatoly Burakov
7 siblings, 0 replies; 36+ messages in thread
From: Anatoly Burakov @ 2018-10-04 10:20 UTC (permalink / raw)
To: dev; +Cc: dpdk, bruce.richardson, stephen, thomas
Musl wraps various string functions such as strlcpy in order to
harden them. However, the fortify wrappers are included without
including the actual string functions being wrapped, which
throws missing definition compile errors. Fix by including
string.h in string functions header.
Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
---
lib/librte_eal/common/include/rte_string_fns.h | 1 +
1 file changed, 1 insertion(+)
diff --git a/lib/librte_eal/common/include/rte_string_fns.h b/lib/librte_eal/common/include/rte_string_fns.h
index ecd141b85..295844ad2 100644
--- a/lib/librte_eal/common/include/rte_string_fns.h
+++ b/lib/librte_eal/common/include/rte_string_fns.h
@@ -16,6 +16,7 @@ extern "C" {
#endif
#include <stdio.h>
+#include <string.h>
/**
* Takes string "string" parameter and splits it at character "delim"
--
2.17.1
^ permalink raw reply [flat|nested] 36+ messages in thread
* [dpdk-dev] [PATCH v3 7/7] eal: improve musl compatibility
2018-09-20 15:27 ` [dpdk-dev] [PATCH v2 0/7] Improve core EAL " Anatoly Burakov
` (6 preceding siblings ...)
2018-10-04 10:20 ` [dpdk-dev] [PATCH v3 6/7] string_fns: " Anatoly Burakov
@ 2018-10-04 10:20 ` Anatoly Burakov
7 siblings, 0 replies; 36+ messages in thread
From: Anatoly Burakov @ 2018-10-04 10:20 UTC (permalink / raw)
To: dev; +Cc: dpdk, bruce.richardson, stephen, thomas
Musl complains about pthread id being of wrong size, because on
musl, pthread_t is a struct pointer, not an unsinged int. Fix the
printing code by casting pthread id to unsigned pointer type and
adjusting the format specifier to be of appropriate size.
Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
---
lib/librte_eal/linuxapp/eal/eal.c | 4 ++--
lib/librte_eal/linuxapp/eal/eal_thread.c | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/lib/librte_eal/linuxapp/eal/eal.c b/lib/librte_eal/linuxapp/eal/eal.c
index e59ac6577..1d6a9ac44 100644
--- a/lib/librte_eal/linuxapp/eal/eal.c
+++ b/lib/librte_eal/linuxapp/eal/eal.c
@@ -979,8 +979,8 @@ rte_eal_init(int argc, char **argv)
ret = eal_thread_dump_affinity(cpuset, sizeof(cpuset));
- RTE_LOG(DEBUG, EAL, "Master lcore %u is ready (tid=%x;cpuset=[%s%s])\n",
- rte_config.master_lcore, (int)thread_id, cpuset,
+ RTE_LOG(DEBUG, EAL, "Master lcore %u is ready (tid=%zx;cpuset=[%s%s])\n",
+ rte_config.master_lcore, (uintptr_t)thread_id, cpuset,
ret == 0 ? "" : "...");
RTE_LCORE_FOREACH_SLAVE(i) {
diff --git a/lib/librte_eal/linuxapp/eal/eal_thread.c b/lib/librte_eal/linuxapp/eal/eal_thread.c
index b496fc711..379773b68 100644
--- a/lib/librte_eal/linuxapp/eal/eal_thread.c
+++ b/lib/librte_eal/linuxapp/eal/eal_thread.c
@@ -121,8 +121,8 @@ eal_thread_loop(__attribute__((unused)) void *arg)
ret = eal_thread_dump_affinity(cpuset, sizeof(cpuset));
- RTE_LOG(DEBUG, EAL, "lcore %u is ready (tid=%x;cpuset=[%s%s])\n",
- lcore_id, (int)thread_id, cpuset, ret == 0 ? "" : "...");
+ RTE_LOG(DEBUG, EAL, "lcore %u is ready (tid=%zx;cpuset=[%s%s])\n",
+ lcore_id, (uintptr_t)thread_id, cpuset, ret == 0 ? "" : "...");
/* read on our pipe to get commands */
while (1) {
--
2.17.1
^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: [dpdk-dev] [PATCH v3 0/7] Improve core EAL musl compatibility
2018-10-04 10:20 ` [dpdk-dev] [PATCH v3 " Anatoly Burakov
@ 2018-10-22 9:33 ` Thomas Monjalon
0 siblings, 0 replies; 36+ messages in thread
From: Thomas Monjalon @ 2018-10-22 9:33 UTC (permalink / raw)
To: Anatoly Burakov; +Cc: dev, dpdk, bruce.richardson, stephen
04/10/2018 12:20, Anatoly Burakov:
> This patchset fixes numerous issues with musl compatibility
> in the core EAL libraries. It does not fix anything beyond
> core EAL (so, PCI driver is still broken, so are a few other
> drivers), but it's a good start.
>
> Tested on container with Alpine Linux. Alpine dependencies:
>
> build-base bsd-compat-headers libexecinfo-dev linux-headers numactl-dev
>
> For numactl-dev, testing repository needs to be enabled:
>
> echo "http://dl-cdn.alpinelinux.org/alpine/edge/testing" >> /etc/apk/repositories
>
> If successful (using a very broad definition of "success"),
> the build should fail somewhere in PCI bus driver in UIO.
>
> v3 -> v2:
> - Made _GNU_SOURCE unconditional for all DPDK targets
> - Fixed usage of __USE_GNU and _GNU_SOURCE accross DPDK
>
> v2 -> v1:
> - Fixed patch 2 to use existing define if available
> - Fixed patch 7 to use proper format specifier and
> cast pthread ID to unsigned pointer type
>
> Anatoly Burakov (7):
> mk: build with _GNU_SOURCE defined by default
> pci/vfio: improve musl compatibility
> fbarray: improve musl compatibility
> eal/hugepage_info: improve musl compatibility
> mem: improve musl compatibility
> string_fns: improve musl compatibility
> eal: improve musl compatibility
Applied, thanks
Hope the _GNU_SOURCE source won't bring too much compilation surprises.
^ permalink raw reply [flat|nested] 36+ messages in thread
end of thread, other threads:[~2018-10-22 9:33 UTC | newest]
Thread overview: 36+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-08-29 11:56 [dpdk-dev] [PATCH 0/7] Improve core EAL musl compatibility Anatoly Burakov
2018-08-29 11:56 ` [dpdk-dev] [PATCH 1/7] linuxapp: build with _GNU_SOURCE defined by default Anatoly Burakov
2018-08-29 11:56 ` [dpdk-dev] [PATCH 2/7] pci/vfio: improve musl compatibility 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
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).