Skip to content

localtime_r is missing definition when using the clang compiler #2420

Open
@NolanBrad

Description

@NolanBrad

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

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions