zephyrproject-rtos / zephyr

Primary Git Repository for the Zephyr Project. Zephyr is a new generation, scalable, optimized, secure RTOS for multiple hardware architectures.
https://docs.zephyrproject.org
Apache License 2.0
10.48k stars 6.41k forks source link

samples: build error in sample.llext.shell: implicit declaration of strnlen #68369

Closed ottojo closed 7 months ago

ottojo commented 7 months ago

Describe the bug Starting with 9dcbfa8bf23fb73a0d4ab14f93e1f14fb07022c8, the following build failure occurs

/home/jonas/Workspace/zephyr_sandbox_2/zephyr/subsys/llext/shell.c: In function 'cmd_llext_load_hex':
/home/jonas/Workspace/zephyr_sandbox_2/zephyr/subsys/llext/shell.c:124:26: error: implicit declaration of function 'strnlen'; did you mean 'strlen'? [-Werror=implicit-function-declaration]
  124 |         size_t hex_len = strnlen(argv[2], CONFIG_LLEXT_SHELL_MAX_SIZE*2+1);
      |                          ^~~~~~~
      |                          strlen

To Reproduce Steps to reproduce the behavior:

west twister --build-only --inline-logs  --platform teensy41 -s samples/subsys/llext/shell_loader/sample.llext.shell -v

Expected behavior No build error

Impact Caused CI failure for OOT board repo, which builds samples against custom board nightly: https://github.com/ottojo/otterpill_zephyr/actions/runs/7674769452/job/20919951824

Environment:

I see there is discussion around some posix stuff already, but i'm not sure if this is the same problem, as this seems to occur with default configuration?

teburd commented 7 months ago

Thank you for the report, will take a look.

At first attempt I don't see a problem, the build works fine for me on the main branch with SDK 16.2 as of commit d1ad1805674a8f2ea79e18dd11830bec599ed144

I noticed you are using sdk 0.16.0, I'd recommend using the latest SDK as there have been various picolibc fixes.

From your CI logs... /opt/toolchains/zephyr-sdk-0.16.0/arm-zephyr-eabi/bin/arm-zephyr-eabi-gcc

ottojo commented 7 months ago

It seems the outdated SDK seems to be the culprit here... Locally i had SDK 16.1 installed, updating to the latest 16.4 solved the issue locally, so it seems like the problem was indeed fixed between SDK releases 16.1 and 16.2. Thanks for the suggestion, and sorry for the false alarm :smile: