[EXTERNAL] [RFC v3 3/3] examples: add lcore topology API calls
Varghese, Vipin
Vipin.Varghese at amd.com
Wed Oct 30 13:37:10 CET 2024
> Hi Pavan,
>
> Snipped
>
> >
> > I see compilation failure on ARM platforms due to missing header include.
> >
> > ../examples/helloworld/main.c: In function 'parse_topology':
> > ../examples/helloworld/main.c:83:13: error: implicit declaration of
> > function 'strtoul'; did you mean 'strtok'? [-Wimplicit-function-declaration]
> > 83 | n = strtoul(q_arg, &end, 10);
> > | ^~~~~~~
> > | strtok
> > ../examples/helloworld/main.c:83:13: warning: nested extern
> > declaration of 'strtoul' [- Wnested-externs]
> > ../examples/helloworld/main.c: In function 'helloworld_parse_args':
> > ../examples/helloworld/main.c:115:42: error: 'EXIT_FAILURE' undeclared
> > (first use in this function)
> > 115 | rte_exit(EXIT_FAILURE, "Invalid Topology
> selection\n");
> > | ^~~~~~~~~~~~
> > ../examples/helloworld/main.c:13:1: note: 'EXIT_FAILURE' is defined in
> > header '<stdlib.h>'; this is probably fixable by adding '#include <stdlib.h>'
> > 12 | #include <rte_memory.h>
> > +++ |+#include <stdlib.h>
> > 13 | #include <rte_launch.h>
> > ../examples/helloworld/main.c:115:42: note: each undeclared identifier
> > is reported only once for each function it appears in
> > 115 | rte_exit(EXIT_FAILURE, "Invalid Topology
> selection\n");
> > | ^~~~~~~~~~~~
> > ../examples/helloworld/main.c: In function 'main':
> > ../examples/helloworld/main.c:153:26: error: 'EXIT_FAILURE' undeclared
> > (first use in this function)
> > 153 | rte_exit(EXIT_FAILURE, "Invalid arguments\n");
> > | ^~~~~~~~~~~~
> > ../examples/helloworld/main.c:153:26: note: 'EXIT_FAILURE' is defined
> > in header '<stdlib.h>'; thi
> >
> > Below header include should fix it.
> >
> > diff --git a/examples/helloworld/main.c b/examples/helloworld/main.c
> > index
> > 9845c3775c3a..f49bd0108f74 100644
> > --- a/examples/helloworld/main.c
> > +++ b/examples/helloworld/main.c
> > @@ -3,6 +3,7 @@
> > */
> >
> > #include <stdio.h>
> > +#include <stdlib.h>
> > #include <string.h>
> > #include <stdint.h>
> > #include <errno.h>
>
> Thank you for helping me here, I did run with `check_includes & developer_mode`,
> it did not throw this error.
> Before patch submission I tried `devtools/test-meson-builds.sh` too. I think internally
> this is not using ` check_includes & developer_mode `.
> Let me recheck and fix this in version 4.
Thank you, I found the reason for my miss on this.
When build using cross compiler manually, no issues with the steps
```
meson arm64-build --cross-file config/arm/arm64_armv8_linux_gcc
ninja -C arm64-build
cd example/helloworld
make
```
But building using cross compiler with examples manually, no issues with the steps
```
meson arm64-build --cross-file config/arm/arm64_armv8_linux_gcc -Dexamples=helloworld
ninja -C arm64-build
```
We get the logs as
```
../examples/helloworld/main.c: In function 'parse_topology':
../examples/helloworld/main.c:83:13: warning: implicit declaration of function 'strtoul'; did you mean 'strtok'? [-Wimplicit-function-declaration]
83 | n = strtoul(q_arg, &end, 10);
| ^~~~~~~
| strtok
../examples/helloworld/main.c:83:13: warning: nested extern declaration of 'strtoul' [-Wnested-externs]
../examples/helloworld/main.c: In function 'helloworld_parse_args':
../examples/helloworld/main.c:115:42: error: 'EXIT_FAILURE' undeclared (first use in this function)
115 | rte_exit(EXIT_FAILURE, "Invalid Topology selection\n");
| ^~~~~~~~~~~~
../examples/helloworld/main.c:13:1: note: 'EXIT_FAILURE' is defined in header '<stdlib.h>'; did you forget to '#include <stdlib.h>'?
12 | #include <rte_memory.h>
+++ |+#include <stdlib.h>
13 | #include <rte_launch.h>
../examples/helloworld/main.c:115:42: note: each undeclared identifier is reported only once for each function it appears in
115 | rte_exit(EXIT_FAILURE, "Invalid Topology selection\n");
| ^~~~~~~~~~~~
../examples/helloworld/main.c: In function 'main':
../examples/helloworld/main.c:153:26: error: 'EXIT_FAILURE' undeclared (first use in this function)
153 | rte_exit(EXIT_FAILURE, "Invalid arguments\n");
| ^~~~~~~~~~~~
../examples/helloworld/main.c:153:26: note: 'EXIT_FAILURE' is defined in header '<stdlib.h>'; did you forget to '#include <stdlib.h>'?
[2963/4590] Compiling C object drivers/libtmp_rte_event_cnxk.a.p/event_cnxk_tx_cn10k_tx_112_127_seg.c.o
ninja: build stopped: subcommand failed.
```
More information about the dev
mailing list