Skip to contentSkip to conversation

eal: fix build with glibc < 2.12

PATCH Applied Ferruh Yigit 3 participants 3 messages Oct 25, 2017 – Oct 26, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 eal: fix build with glibc < 2.12

build error:
CC rte_cycles.o
cc1: warnings being treated as errors ...dpdk/lib/librte_eal/common/arch/x86/rte_cycles.c: In function ‘rdmsr’:
...dpdk/lib/librte_eal/common/arch/x86/rte_cycles.c:67:2: error:
implicit declaration of function ‘pread’ ...dpdk/lib/librte_eal/common/arch/x86/rte_cycles.c:67:2: error:
nested extern declaration of ‘pread’

from pread man page:
pread(), pwrite():
_XOPEN_SOURCE >= 500
|| /* Since glibc 2.12: */ _POSIX_C_SOURCE >= 200809L

For glibc < 2.12 _XOPEN_SOURCE >= 500 is required.

Adding _GNU_SOURCE define to the file which implies _XOPEN_SOURCE=700

Fixes ad3516bb4ae1 ("eal/x86: implement arch-specific TSC freq query")
---
 lib/librte_eal/linuxapp/eal/Makefile | 1 +
 1 file changed, 1 insertion(+)
lib/librte_eal/linuxapp/eal/Makefile +1 -0
index 965da6e30..edfb8ff03 100644
@@ -139,6 +139,7 @@ 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
Signature · 1 line
2.13.6
Acked-by on v1 1/1
#1 lore raw
Quoted 32 lines · Ferruh Yigit

build error:
CC rte_cycles.o
cc1: warnings being treated as errors ...dpdk/lib/librte_eal/common/arch/x86/rte_cycles.c: In function ‘rdmsr’:
...dpdk/lib/librte_eal/common/arch/x86/rte_cycles.c:67:2: error:
implicit declaration of function ‘pread’ ...dpdk/lib/librte_eal/common/arch/x86/rte_cycles.c:67:2: error:
nested extern declaration of ‘pread’

from pread man page:
pread(), pwrite():

    _XOPEN_SOURCE >= 500
    || /* Since glibc 2.12: */ _POSIX_C_SOURCE >= 200809L

For glibc < 2.12 _XOPEN_SOURCE >= 500 is required.

Adding _GNU_SOURCE define to the file which implies _XOPEN_SOURCE=700

Fixes ad3516bb4ae1 ("eal/x86: implement arch-specific TSC freq query")
---
  lib/librte_eal/linuxapp/eal/Makefile | 1 +
  1 file changed, 1 insertion(+)
lib/librte_eal/linuxapp/eal/Makefile +0 -0
index 965da6e30..edfb8ff03 100644

lib/librte_eal/linuxapp/eal/Makefile CFLAGS_eal_common_whitelist.o := -D_GNU_SOURCE · line 145

Quoted 7 lines
lib/librte_eal/linuxapp/eal/Makefile +1 -0
@@ -139,6 +139,7 @@ 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
#2 lore raw

26/10/2017 16:05, Gonzalez Monroy, Sergio:

Quoted 18 lines · Ferruh Yigit
Quoted 17 lines

build error:
CC rte_cycles.o
cc1: warnings being treated as errors ...dpdk/lib/librte_eal/common/arch/x86/rte_cycles.c: In function ‘rdmsr’:
...dpdk/lib/librte_eal/common/arch/x86/rte_cycles.c:67:2: error:
implicit declaration of function ‘pread’ ...dpdk/lib/librte_eal/common/arch/x86/rte_cycles.c:67:2: error:
nested extern declaration of ‘pread’

from pread man page:
pread(), pwrite():

    _XOPEN_SOURCE >= 500
    || /* Since glibc 2.12: */ _POSIX_C_SOURCE >= 200809L

For glibc < 2.12 _XOPEN_SOURCE >= 500 is required.

Quoted 8 lines
Quoted 6 lines

Adding _GNU_SOURCE define to the file which implies _XOPEN_SOURCE=700

Fixes ad3516bb4ae1 ("eal/x86: implement arch-specific TSC freq query")

Applied, thanks