Skip to content

localtime_r is missing definition when using the clang compiler #2420

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
NolanBrad opened this issue Apr 13, 2025 · 3 comments
Open

localtime_r is missing definition when using the clang compiler #2420

NolanBrad opened this issue Apr 13, 2025 · 3 comments
Assignees
Milestone

Comments

@NolanBrad
Copy link

NolanBrad commented Apr 13, 2025

When compiling using bazel build, and using the clang compiler, localtime_r is missing definition

i.e. in bazelrc

build --@pico-sdk//bazel/config:PICO_TOOLCHAIN=clang
build --@pico-sdk//bazel/config:PICO_CLIB=auto

Results in error:
ld.lld: error: undefined symbol: localtime_r
referenced by datetime.c:11 (/proc/self/cwd/external/pico-sdk+/src/common/pico_util/datetime.c:11)
datetime.o:(pico_localtime_r) in archive bazel-out/k8-dbg/bin/external/pico-sdk+/src/common/pico_util/libpico_util.a
clang++: error: ld.lld command failed with exit code 1 (use -v to see invocation)

localtime_r has this declared in pico-sdk/src/rp2_common/pico_clib_interface/include/llvm_libc/time.h
struct tm* localtime_r(const time_t* timer, struct tm* buf);

I am using the pico_aon_timer library, specifically the aon_timer_set_time function

It looks as though the libc for clang doesnt support localtime_r. See https://libc.llvm.org/headers/time.html

@lurch
Copy link
Contributor

lurch commented Apr 14, 2025

ping @armandomontanez

@kilograham kilograham self-assigned this Apr 14, 2025
@kilograham kilograham added this to the 2.1.2 milestone Apr 14, 2025
@armandomontanez
Copy link
Contributor

@petrhosek FYI

@petrhosek
Copy link
Contributor

localtime_r is under development, see llvm/llvm-project#110363.

@kilograham kilograham modified the milestones: 2.1.2, 2.2.0 Apr 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants