-
Notifications
You must be signed in to change notification settings - Fork 7.4k
Missing stdlib.h
include when C++ standard library is used.
#17564
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
Comments
@simonmarti could you please try with the Zephyr SDK instead of GNU Arm Embedded and let us know if you can reproduce the same issue? EDIT: I tried and the SDK doesn't seem to be able to find
|
I'm unable to reproduce this with I can confirm the problem as reported is present when @carlescufi it appears you're using a C source file |
Thanks @pabigot. I can confirm the same in master. There is clearly an issue with GNU Arm Embedded and newlib/C++. @galak or @SebastianBoe is that something you could take a look at? |
I think that I've got the same error couple of months ago... this solved the issue
Can somebody confirm? |
I can confirm that the problem goes away by making newlib headers not system headers, but given 7d2df83 was just merged I'm not convinced it's the right solution. Presumably Zephyr and ARM do something different in builds that affects how system include files are handed. |
Hi, I have proposed a solution to the related issue #15603 here: #18189 The PR is intended to also fix this issue (17564), but I've not been able to reproduce all the reports here, so I'm not certain that it does so. Reports that show that #18189 does not fix #17564 for all environments would be welcome. |
@cszawisza Thanks, the change fixes the problem for my environment. @SebastianBoe I tested the change proposed in #18189 with my environment, but it does not solve the issue. The error message is still the same. The environment I used for the test:
|
Based on this and other investigations I think a solution based on @cszawisza's patch is the right way forward, but it requires additional changes to reverse #15627 and re-solve that change's issue another way. @SebastianBoe I can take that on unless you want to handle it. |
Hi, please do take this off my hands, I've haven't made much progress. |
The solution from zephyrproject-rtos#14312 of using -isystem to prioritize the position of the libc directory bypasses the effect of -ffreestanding with respect to libc symbols expected to be present in a non-hosted environment. Further, it breaks C++ with the ARM Embedded toolchain as the system fails to find the right file with #include_next. Use a more fine-grained solution that explicitly includes the underlying newlib header required for <inttypes.h> support before moving on to include the next available one, whether system or non-system. Closes zephyrproject-rtos#17564 Signed-off-by: Peter Bigot <[email protected]>
The solution from #14312 of using -isystem to prioritize the position of the libc directory bypasses the effect of -ffreestanding with respect to libc symbols expected to be present in a non-hosted environment. Further, it breaks C++ with the ARM Embedded toolchain as the system fails to find the right file with #include_next. Use a more fine-grained solution that explicitly includes the underlying newlib header required for <inttypes.h> support before moving on to include the next available one, whether system or non-system. Closes #17564 Signed-off-by: Peter Bigot <[email protected]>
The solution from zephyrproject-rtos#14312 of using -isystem to prioritize the position of the libc directory bypasses the effect of -ffreestanding with respect to libc symbols expected to be present in a non-hosted environment. Further, it breaks C++ with the ARM Embedded toolchain as the system fails to find the right file with #include_next. Use a more fine-grained solution that explicitly includes the underlying newlib header required for <inttypes.h> support before moving on to include the next available one, whether system or non-system. Closes zephyrproject-rtos#17564 Backport: 96c1b05 Signed-off-by: Peter Bigot <[email protected]>
The solution from zephyrproject-rtos#14312 of using -isystem to prioritize the position of the libc directory bypasses the effect of -ffreestanding with respect to libc symbols expected to be present in a non-hosted environment. Further, it breaks C++ with the ARM Embedded toolchain as the system fails to find the right file with #include_next. Use a more fine-grained solution that explicitly includes the underlying newlib header required for <inttypes.h> support before moving on to include the next available one, whether system or non-system. Closes zephyrproject-rtos#17564 Signed-off-by: Peter Bigot <[email protected]>
The solution from #14312 of using -isystem to prioritize the position of the libc directory bypasses the effect of -ffreestanding with respect to libc symbols expected to be present in a non-hosted environment. Further, it breaks C++ with the ARM Embedded toolchain as the system fails to find the right file with #include_next. Use a more fine-grained solution that explicitly includes the underlying newlib header required for <inttypes.h> support before moving on to include the next available one, whether system or non-system. Closes #17564 Backport: 96c1b05 Signed-off-by: Peter Bigot <[email protected]>
Describe the bug
stdlib.h
is not in the GCC search path when the C++ standard library is used.To Reproduce
prj.conf:
main.cpp:
Steps to reproduce the behavior:
Expected behavior
The example code above should compile.
Impact
I can not use the C++ standard library for my current project.
Screenshots or console output
Environment (please complete the following information):
Additional context
This might be related to issue #15603. I tried the suggested workaround, but it does not help.
I tried several Zephyr versions:
v1.14.0-rc1 works but in this version the shell is not C++ compatible yet, so there are other problems to work around.
I also tried the latest GNU ARM Embedded toolchain (8-2019-q3-update), but also no success here.
If you can point my in the right direction, I will happily provide a fix myself.
The text was updated successfully, but these errors were encountered: