Skip to content

Conversation

cfriedt
Copy link
Member

@cfriedt cfriedt commented May 14, 2025

In https://github.com/zephyrproject-rtos/zephyr/actions/runs/15014534061/job/42189411225

we were seeing a linker error of the form

picolibc/x86_64-zephyr-elf/lib/32/libc.a(libc_time_time.c.o):  in function `time':
time.c:(.text.time+0x11): undefined reference to `gettimeofday'

Update the dependency from CONFIG_POSIX_TIMERS to CONFIG_XSI_SINGLE_PROCESS for gettimeofday().

Note: this is really only a workaround. The proper solution would be to have libc functions not depend on POSIX functions.

Specifically, here and here.

Also mentioned in #89068

@github-actions github-actions bot added size: XS A PR changing only a single line of code area: LWM2M area: Samples Samples labels May 14, 2025
@cfriedt cfriedt added the Hotfix Fix for issues blocking development, i.e. CI issues, tests failing in CI, etc. label May 14, 2025
@kartben
Copy link
Contributor

kartben commented May 14, 2025

@cfriedt I think

depends on (POSIX_TIMERS && RING_BUFFER)
might need to be updated as well?

@jhedberg
Copy link
Member

Any update on this? I have several PRs blocked where CI is failing due to this issue.

@cfriedt
Copy link
Member Author

cfriedt commented May 14, 2025

I won't be at my desk for at least another hour. Feel free to make another PR for the time being

https://github.com/zephyrproject-rtos/zephyr/actions/runs/\
15014534061/job/42189411225

We were seeing a linker error of the form

```
picolibc/x86_64-zephyr-elf/lib/32/libc.a(libc_time_time.c.o): \
  in function `time':
time.c:(.text.time+0x11): undefined reference to `gettimeofday'
```

Update the dependency from CONFIG_POSIX_TIMERS to
CONFIG_XSI_SINGLE_PROCESS for gettimeofday().

Note: this is really only a workaround. The proper solution would
be to have libc functions not depend on POSIX functions.

Specifically, here

https://github.com/zephyrproject-rtos/picolibc/blob/\
51a8b32857e75345c37652a80b5cda98b28d69e5/newlib/libc/time/\
time.c#L54

and here

https://github.com/zephyrproject-rtos/zephyr/blob/\
3a4e128/lib/libc/common/\
source/time/time.c#L17

Also mentioned in zephyrproject-rtos#89068

Signed-off-by: Chris Friedt <[email protected]>
@cfriedt cfriedt force-pushed the samples-net-lwm2m-client-undefined-ref-to-gettimeofday branch from 6901edb to 4b72cab Compare May 15, 2025 01:47
@cfriedt
Copy link
Member Author

cfriedt commented May 15, 2025

@kartben @jhedberg - should be ok to review now.

Copy link

@kartben kartben merged commit 3934461 into zephyrproject-rtos:main May 15, 2025
27 checks passed
@cfriedt cfriedt deleted the samples-net-lwm2m-client-undefined-ref-to-gettimeofday branch May 15, 2025 10:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: LWM2M area: Samples Samples Hotfix Fix for issues blocking development, i.e. CI issues, tests failing in CI, etc. size: XS A PR changing only a single line of code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants