Skip to content
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

Compiler cannot include C++ headers when both PICOLIBC and LIB_CPLUSPLUS options are set #52559

Closed
r2r0 opened this issue Nov 25, 2022 · 2 comments
Assignees
Labels
area: C++ area: picolibc Picolibc C Standard Library Enhancement Changes/Updates/Additions to existing features

Comments

@r2r0
Copy link
Member

r2r0 commented Nov 25, 2022

Describe the bug
When CONFIG_PICOLIBC and CONFIG_LIB_CPLUSPLUS options are set at the same time then compiler is not able to include C++ headers i.e. cstdint.
When there is used picolib without enableing usage of C++ standard library then everything works well.
After adding CONFIG_LIB_CPLUSPLUS standard C++ headers cannot be found (see log below).

To Reproduce
Steps to reproduce the behavior:
Enable picolibc
Enable C++
Enable C++ standard library

Expected behavior
If C++ standard library cannot be used with picolib then this should be blocked at the kconfig level, otherwise compilation should succeed.

Impact
Showstopper for switching from newlib to picolib.

Logs and console output

ccache /opt/zephyr-sdk/arm-zephyr-eabi/bin/arm-zephyr-eabi-g++ ......
In file included from /home/hid/aurora/app/src/low_power/wakeup_button.cpp:18:
/home/hid/aurora/app/../shared/src/std_def.h:10:10: fatal error: cstdint: No such file or directory
   10 | #include <cstdint>
      |          ^~~~~~~~~

Environment (please complete the following information):

  • OS: Linux
  • Toolchain Zephyr SDK 0.15.2
  • Commit SHA 27ec69e

Additional context
C++ related config:

CONFIG_PICOLIBC=y
CONFIG_CPLUSPLUS=y
CONFIG_STD_CPP17=y
CONFIG_LIB_CPLUSPLUS=y
CONFIG_CPP_MAIN=y
@r2r0 r2r0 added the bug The issue is a bug, or the PR is fixing a bug label Nov 25, 2022
@stephanosio stephanosio added Enhancement Changes/Updates/Additions to existing features and removed bug The issue is a bug, or the PR is fixing a bug labels Nov 25, 2022
@stephanosio stephanosio self-assigned this Nov 25, 2022
@stephanosio stephanosio added area: C++ area: picolibc Picolibc C Standard Library labels Nov 25, 2022
@stephanosio
Copy link
Member

Using libstdc++ with picolibc requires the toolchains (i.e. Zephyr SDK) to include the picolibc, which is not currently the case.

The upcoming Zephyr SDK 0.16.0 release will include picolibc and the libstdc++ compiled for it: see #49922 (comment).

@r2r0
Copy link
Member Author

r2r0 commented Nov 25, 2022

Thanks a lot for a prompt answer.
Do you think that it would be a good idea to not allow users to select this combination of options for now?

@r2r0 r2r0 closed this as completed Jan 5, 2023
@r2r0 r2r0 reopened this Mar 16, 2023
@r2r0 r2r0 closed this as completed Mar 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: C++ area: picolibc Picolibc C Standard Library Enhancement Changes/Updates/Additions to existing features
Projects
None yet
Development

No branches or pull requests

2 participants