Skip to content

Cannot build picolibc module for Xtensa if __STDC_WANT_LIB_EXT1__ is not defined #104666

@ttmut

Description

@ttmut

Describe the bug

I am trying to build picolibc module for an out-of-tree Xtensa board using xt-clang toolchain. The build process fails with errors as shown in log output.

If I pass __STDC_WANT_LIB_EXT1__ flag to picolibc, the build succeeds.

zephyr_compile_options_ifdef(CONFIG_PICOLIBC_USE_MODULE -D__STDC_WANT_LIB_EXT1__=1)

However, I understand that this is against the standard and not really an appropriate method to fix this issue (picolibc/picolibc#868 (comment)).

So, I am wondering if the problem lies within picolibc or the toolchain itself. I have tried building the module for an ARM board and have not encountered any issues.

Regression

  • This is a regression.

Steps to reproduce

No response

Relevant log output

build/modules/picolibc/picolibc/include/stdlib.h:415:9: error: unknown type name '__errno_t'; did you mean '__ino_t'?
typedef __errno_t errno_t;
        ^
build/modules/picolibc/picolibc/include/sys/_types.h:126:24: note: '__ino_t' declared here
typedef unsigned short __ino_t;
                       ^
In file included from zephyr/modules/lib/picolibc/newlib/libc/posix/regerror.c:46:
build/modules/picolibc/picolibc/include/stdlib.h:420:9: error: unknown type name '__rsize_t'
typedef __rsize_t rsize_t;
        ^
build/modules/picolibc/picolibc/include/stdlib.h:425:60: error: unknown type name '__errno_t'; did you mean 'errno_t'?
                                     void *__restrict ptr, __errno_t error);
                                                           ^
build/modules/picolibc/picolibc/include/stdlib.h:415:19: note: 'errno_t' declared here
typedef __errno_t errno_t;
                  ^
build/modules/picolibc/picolibc/include/stdlib.h:429:22: error: unknown type name '__errno_t'; did you mean 'errno_t'?
                     __errno_t error);
                     ^
build/modules/picolibc/picolibc/include/stdlib.h:415:19: note: 'errno_t' declared here
typedef __errno_t errno_t;
                  ^
build/modules/picolibc/picolibc/include/stdlib.h:431:22: error: unknown type name '__errno_t'; did you mean 'errno_t'?
                     __errno_t error);
                     ^
build/modules/picolibc/picolibc/include/stdlib.h:415:19: note: 'errno_t' declared here
typedef __errno_t errno_t;

Impact

Functional Limitation – Some features not working as expected, but system usable.

Environment

  • OS: WSL Linux
  • Toolchain: xt-clang RJ-2025.5-linux
  • Zephyr version: 4.3

Additional Context

No response

Metadata

Metadata

Assignees

Labels

area: picolibcPicolibc C Standard LibrarybugThe issue is a bug, or the PR is fixing a bug

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions