Bug 756

Summary: performance-thread example fails to build on Alpine linux
Product: DPDK Reporter: Brandon Lo (blo)
Component: examplesAssignee: dev
Status: UNCONFIRMED ---    
Severity: normal CC: admin, blo, daxuex.gao, ktraynor
Priority: Normal    
Version: 21.08   
Target Milestone: ---   
Hardware: All   
OS: All   
Attachments: Full Log

Description Brandon Lo 2021-07-15 18:41:12 CEST
When compiling DPDK with all examples, the performance thread fails to build due to implicit declaration of pthread-related functions.

Here is some example output:

# meson dpdk dpdk/build -Dexamples=all --buildtype=debugoptimized

The Meson build system
Version: 0.58.1
...
Project version: 21.08.0-rc1
C compiler for the host machine: ccache cc (gcc 10.3.1 "cc (Alpine 10.3.1_git20210424) 10.3.1 20210424")
C linker for the host machine: cc ld.bfd 2.35.2
Host machine cpu family: x86_64
Host machine cpu: x86_64
Message: ## Building in Developer Mode ##
...
Option buildtype is: debugoptimized [default: release]
Found ninja-1.10.0.git.kitware.jobserver-1 at /usr/bin/ninja

# ninja -C dpdk/build
...
../examples/performance-thread/pthread_shim/main.c: In function 'initial_lthread':
../examples/performance-thread/pthread_shim/main.c:158:3: warning: implicit declaration of function 'pthread_attr_setaffinity_np'; did you mean 'pthread_setaffinity_np'? [-Wimplicit-function-declaration]
  158 |   pthread_attr_setaffinity_np(&attr, sizeof(rte_cpuset_t), &cpuset);
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~
      |   pthread_setaffinity_np
../examples/performance-thread/pthread_shim/main.c:158:3: warning: nested extern declaration of 'pthread_attr_setaffinity_np' [-Wnested-externs]
[137/2865] Compiling C object examples/dpdk-bbdev_app.p/bbdev_app_main.c.o
ninja: build stopped: subcommand failed.
Comment 1 Brandon Lo 2021-07-15 18:48:21 CEST
Created attachment 167 [details]
Full Log
Comment 2 Thomas Monjalon 2021-07-15 22:43:06 CEST
Maybe that we should just drop this example.
Comment 3 gaodaxue 2022-07-21 10:00:06 CEST
git info: dpdk stable 21.11.2-rc1
OS: Fedora Linux 36 (Server Edition)/Linux 5.17.7-300.fc36.x86_64
gcc: version 12.1.1 20220507
build command: 
  CC=gcc meson --werror -Denable_kmods=True -Dlibdir=lib -Dexamples=all --default-library=static gcc-linux-app  &&  ninja -C gcc-linux-app
Comment 4 Kevin Traynor 2022-08-24 12:07:19 CEST
(In reply to gaodaxue from comment #3)
> git info: dpdk stable 21.11.2-rc1
> OS: Fedora Linux 36 (Server Edition)/Linux 5.17.7-300.fc36.x86_64
> gcc: version 12.1.1 20220507
> build command: 
>   CC=gcc meson --werror -Denable_kmods=True -Dlibdir=lib -Dexamples=all
> --default-library=static gcc-linux-app  &&  ninja -C gcc-linux-app

This gives the compile test setup, but it doesn't say what the issue you are seeing is. Are you reporting the same -Wimplicit-function-declaration issue?

I am seeing a "-Wmaybe-uninitialized" warning with GCC12. I have sent a patch [1] to squash the warning in 21.11 branch with GCC12. Performance-thread example has been removed from DPDK main branch.

[1] http://inbox.dpdk.org/stable/20220824095816.1449620-1-ktraynor@redhat.com/T/#u
Comment 5 Kevin Traynor 2022-08-26 10:21:54 CEST
The 21.11 branch issue I referenced in Comment 4 was reported separately in
https://bugs.dpdk.org/show_bug.cgi?id=1061 . It is now resolved.

The original reported bug on DPDK main is no longer relevant as performance-thread example has been removed. Proposing to close this Bug if there no further comments.