Skip to content

SDK 2.1.0: clang 19.1.1 picolibc_interface compile error #2107

@geurtv

Description

@geurtv

pico-sdk 2.1.0 compiles fine with clang 18.1.3 (LVM-ET-Arm-18.1.3) but with clang 19.1.1 (LLVM-ET-Arm-19.1.1) I get the following compile error:

pico-sdk/2.1.0/src/rp2_common/pico_clib_interface/picolibc_interface.c:102:83: error: use of undeclared identifier 'CLOCKS_PER_SEC'
  102 |     tms->tms_utime = (clock_t)(to_us_since_boot(get_absolute_time()) / (1000000 / CLOCKS_PER_SEC));
      |                                                                                   ^

I don't know what a correct fix is. For example, if I add the following code to picolibc_interface.c:

#include <time.h>

It compiles and CLOCKS_PER_SEC == 1000000.

clang 18's time.h includes machine/time.h, clang 19's does not. So if instead I add:

#include <machine/time.h>
#include <time.h>

It again compiles, but now CLOCKS_PER_SEC == 100 (same as clang 18).

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions