[dpdk-dev] [PATCH] ppc64le: fix build with Clang and without glibc

Piotr Kubaj pkubaj at anongoth.pl
Tue Mar 23 00:42:46 CET 2021


Looks like I forgot to commit the change that includes headers for sysctlbyname().

Patch attached.

On 21-03-15 12:48:19, David Christensen wrote:
> 
> 
> On 3/11/21 8:11 AM, Piotr Kubaj wrote:
> > There are couple of issues when building with Clang:
> > 1. vector is a keyword and should not be used in code. I undefined it,
> > but it would probably be better to just change the variable name.
> > 2. vector long is deprecated by Clang and should not be used. I switched
> > here to vector int.
> > 3. Additionally, sys/platform/ppc.h is glibc-dependant and is not
> > available in other libc's. Use the portable method of reading TBR when
> > glibc is not used.  Taken from
> > https://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/powerpc/sys/platform/ppc.h
> > 
> > Signed-off-by: Piotr Kubaj <pkubaj at FreeBSD.org>
> > ---
> 
> Build with patch on my POWER9 system with RHEL 8.3 (gcc 8.3.1 20191121) 
> generates the following errors:
> 
> 
> ninja -C build
> ninja: Entering directory `build'
> [1221/2455] Compiling C object 
> 'drivers/a715181@@tmp_rte_net_i40e at sta/net_i40e_i40e_rxtx_vec_altivec.c.o'.
> ../drivers/net/i40e/i40e_rxtx_vec_altivec.c: In function 
> ‘_recv_raw_pkts_vec’:
> ../drivers/net/i40e/i40e_rxtx_vec_altivec.c:243:35: warning: conversion 
> from ‘long long unsigned int’ to ‘unsigned int’ changes value from 
> ‘4294967297’ to ‘1’ [-Woverflow]
>    dd_check = (vector unsigned int){0x0000000100000001ULL,
>                                     ^~~~~~~~~~~~~~~~~~~~~
> ../drivers/net/i40e/i40e_rxtx_vec_altivec.c:244:8: warning: conversion 
> from ‘long long unsigned int’ to ‘unsigned int’ changes value from 
> ‘4294967297’ to ‘1’ [-Woverflow]
>          0x0000000100000001ULL};
>          ^~~~~~~~~~~~~~~~~~~~~
> ../drivers/net/i40e/i40e_rxtx_vec_altivec.c:247:36: warning: conversion 
> from ‘long long unsigned int’ to ‘unsigned int’ changes value from 
> ‘8589934594’ to ‘2’ [-Woverflow]
>    eop_check = (vector unsigned int){0x0000000200000002ULL,
>                                      ^~~~~~~~~~~~~~~~~~~~~
> ../drivers/net/i40e/i40e_rxtx_vec_altivec.c:248:9: warning: conversion 
> from ‘long long unsigned int’ to ‘unsigned int’ changes value from 
> ‘8589934594’ to ‘2’ [-Woverflow]
>           0x0000000200000002ULL};
>           ^~~~~~~~~~~~~~~~~~~~~
> [1736/2455] Compiling C object 
> 'drivers/a715181@@tmp_rte_event_dsw at sta/event_dsw_dsw_evdev.c.o'.
> In file included from ../drivers/event/dsw/dsw_evdev.c:7:
> ../lib/librte_eal/ppc/include/rte_cycles.h: In function ‘rte_rdtsc’:
> ../lib/librte_eal/ppc/include/rte_cycles.h:32:9: warning: implicit 
> declaration of function ‘__ppc_get_timebase’; did you mean 
> ‘__builtin_ppc_get_timebase’? [-Wimplicit-function-declaration]
>    return __ppc_get_timebase();
>           ^~~~~~~~~~~~~~~~~~
>           __builtin_ppc_get_timebase
> ../lib/librte_eal/ppc/include/rte_cycles.h:32:9: warning: nested extern 
> declaration of ‘__ppc_get_timebase’ [-Wnested-externs]
> [1862/2455] Compiling C object 
> 'app/a172ced@@dpdk-testpmd at exe/test-pmd_ieee1588fwd.c.o'.
> In file included from ../app/test-pmd/ieee1588fwd.c:6:
> ../lib/librte_eal/ppc/include/rte_cycles.h: In function ‘rte_rdtsc’:
> ../lib/librte_eal/ppc/include/rte_cycles.h:32:9: warning: implicit 
> declaration of function ‘__ppc_get_timebase’; did you mean 
> ‘__builtin_ppc_get_timebase’? [-Wimplicit-function-declaration]
>    return __ppc_get_timebase();
>           ^~~~~~~~~~~~~~~~~~
>           __builtin_ppc_get_timebase
> ../lib/librte_eal/ppc/include/rte_cycles.h:32:9: warning: nested extern 
> declaration of ‘__ppc_get_timebase’ [-Wnested-externs]
> [2330/2455] Linking target drivers/librte_event_dsw.so.21.2.
> FAILED: drivers/librte_event_dsw.so.21.2
> cc  -o drivers/librte_event_dsw.so.21.2 
> 'drivers/a715181@@rte_event_dsw at sha/meson-generated_.._rte_event_dsw.pmd.c.o' 
> 'drivers/a715181@@tmp_rte_event_dsw at sta/event_dsw_dsw_evdev.c.o' 
> 'drivers/a715181@@tmp_rte_event_dsw at sta/event_dsw_dsw_event.c.o' 
> 'drivers/a715181@@tmp_rte_event_dsw at sta/event_dsw_dsw_xstats.c.o' 
> -Wl,--no-undefined -Wl,--as-needed -Wl,-O1 -shared -fPIC 
> -Wl,--start-group -Wl,-soname,librte_event_dsw.so.21 -Wl,--no-as-needed 
> -pthread -lm -ldl -lnuma lib/librte_eventdev.so.21.2 
> lib/librte_eal.so.21.2 lib/librte_kvargs.so.21.2 
> lib/librte_telemetry.so.21.2 lib/librte_ring.so.21.2 
> lib/librte_ethdev.so.21.2 lib/librte_net.so.21.2 lib/librte_mbuf.so.21.2 
> lib/librte_mempool.so.21.2 lib/librte_meter.so.21.2 
> lib/librte_hash.so.21.2 lib/librte_rcu.so.21.2 lib/librte_timer.so.21.2 
> lib/librte_cryptodev.so.21.2 drivers/librte_bus_vdev.so.21.2 
> -Wl,--end-group 
> -Wl,--version-script=/home/drc/src/dpdk/drivers/event/dsw/version.map 
> '-Wl,-rpath,$ORIGIN/../lib:$ORIGIN/' 
> -Wl,-rpath-link,/home/drc/src/dpdk/build/lib:/home/drc/src/dpdk/build/drivers
> drivers/a715181@@tmp_rte_event_dsw at sta/event_dsw_dsw_evdev.c.o: In 
> function `dsw_start':
> dsw_evdev.c:(.text+0x1078): undefined reference to `__ppc_get_timebase'
> collect2: error: ld returned 1 exit status
> [2359/2455] Compiling C object 
> 'app/test/3062f5d@@dpdk-test at exe/test_trace_perf.c.o'.
> In file included from ../app/test/test_trace_perf.c:5:
> ../lib/librte_eal/ppc/include/rte_cycles.h: In function ‘rte_rdtsc’:
> ../lib/librte_eal/ppc/include/rte_cycles.h:32:9: warning: implicit 
> declaration of function ‘__ppc_get_timebase’; did you mean 
> ‘__builtin_ppc_get_timebase’? [-Wimplicit-function-declaration]
>    return __ppc_get_timebase();
>           ^~~~~~~~~~~~~~~~~~
>           __builtin_ppc_get_timebase
> ../lib/librte_eal/ppc/include/rte_cycles.h:32:9: warning: nested extern 
> declaration of ‘__ppc_get_timebase’ [-Wnested-externs]
> [2366/2455] Compiling C object 
> 'drivers/a715181@@tmp_rte_event_octeontx2 at sta/event_octeontx2_otx2_worker_dual.c.o'.
> ninja: build stopped: subcommand failed.


More information about the dev mailing list