-
Notifications
You must be signed in to change notification settings - Fork 7k
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
picolibc is incompatible with xcc / xcc-clang toolchains #54336
picolibc is incompatible with xcc / xcc-clang toolchains #54336
Comments
@keith-packard @stephanosio Is picolibc supposed to work with clang ? |
Yes, picolibc is routinely tested with clang. However, the current module using cmake does not work with clang. I've got upstream changes which should resolve this, but have not tested them with Zephyr. Does someone want to give that a try and report back? I've pushed the current 'main' bits to the zephyr copy of the picolibc repository, so it should be a simple matter of 'git checkout main' in modules/lib/picolibc |
Thanks for your help! I'm now getting this for CAVS15/18/25:
And this for MTL:
So that's a lot less errors than before! Commit of main I have after fetching is zephyrproject-rtos/picolibc@a8e2e1f. |
|
Given that we are in feaure freeze I suggest to apply this for now while we work on adding clang support: --- a/lib/libc/Kconfig
+++ b/lib/libc/Kconfig
@@ -19,7 +19,7 @@ config SUPPORT_MINIMAL_LIBC
config PICOLIBC_SUPPORTED
bool
depends on !NATIVE_APPLICATION
- depends on "$(ZEPHYR_TOOLCHAIN_VARIANT)" != "arcmwdt"
+ depends on "$(ZEPHYR_TOOLCHAIN_VARIANT)" != "arcmwdt" || "$(ZEPHYR_TOOLCHAIN_VARIANT)" != "xcc" || "$(ZEPHYR_TOOLCHAIN_VARIANT)" != "xcc-clang"
depends on !(CPP && "$(ZEPHYR_TOOLCHAIN_VARIANT)" = "zephyr")
# picolibc text is outside .pinned.text on this board. #54148
depends on !BOARD_QEMU_X86_TINY |
It's a bit more subtle than that -- we're not 'adding' clang support anywhere, just fixing some wiring between the existing clang support in picolibc and the clang support in Zephyr. I'd suggest waiting a couple of days and see how the proposed fixes work out and then decide if clang+picolibc should be removed from the release. |
@keith-packard @stephanosio @teburd See #54345 (comment) @nashif Seems like the xcc-clang + MTL stuff works, the xt-xcc + CAVS stuff is what we need now |
|
Having discovered that 'xcc' is based off a 'mature' version of gcc (pre 4.5), I think half of your patch should be applied, that which disables picolibc support for the xcc compiler, until picolibc has support for that compiler integrated, and perhaps past the current Zephyr release process to see if we can't get some testing of picolibc using that compiler first. |
hmm, still getting:
|
I wonder if something like @nashif proposed patches makes sense, in that we should have The assumption in the current |
I guess the question is 'tested how?' Zephyr doesn't have comprehensive C library tests integrated, so even the minimal C library is only lightly tested today. Picolibc gets comprehensive testing in CI, but only on a subset of platforms as that testing relies on qemu support. It would be great to extend that testing to more platforms through the Zephyr testing ecosystem; the requirements for picolibc tests are intentionally very light on the OS. The recent clang issues relate only to the cmake build system added to picolibc for Zephyr support; normally picolibc is built with meson (as with the Zephyr SDK). If Zephyr were to permit the use of meson within a module, there should have been no issues with clang.
#54391 addresses the cmake issues within picolibc when using clang; the code in picolibc has been tested on arm using clang for several years, but using meson instead of cmake. I'm not aware of the Oticon toolchain, but if it's gcc or clang based (and not 13 years old), I'm confident it will work at least as well as the minimal C library. |
that's odd -- care to debug why #54345 didn't eliminate this? |
is this really closed? |
I'm not sure -- I think the clang issues are resolved now (except for your mystic problem?) -- the xcc issue relates to the GCC-based toolchain, which we do need to remove from the list of supported toolchains until support for that version of gcc (pre 4.5) is added to picolibc. |
I am not sure as well tbh, @laurenmurphyx64 are you sure the issues were resolved? I still get the same build problems with current main branch. Please retry. |
ok, we need to keep this open because #54391 was not merged yet. and I am getting this now with #54391 checked out:
hmmm, did not see all of that last week. Will have to continue debugging tomorrow.. |
btw, another issues I have seen is due to this:
PICOLIBC_SUPPORTED now triggers this to be enabled but then we select newlibc instead of picolibc, i.e. see This generate build failures in tests because the filter becomes true, but newlib is selected and if it is not supported, the test fails to build. |
Hrm. There's code in #54391 which should be filtering this flag out but it doesn't appear to be working in your configuration.
clang splits out warnings about This isn't directly picolibc related, rather it's caused by removing the |
Looks like that pattern occurs in a handful of test configuration files. What solution would you like here? Do you want to skip the test? Or do you want to use picolibc instead? And, do you want to continue to use newlib on platforms that support it? Or switch to picolibc everywhere? |
@nashif @keith-packard I cherrypicked both of those PRs and can replicate that the fix #54525 isn't working for us for some reason
|
even with
|
We need to fix that logic. It does not need to be newlib, we need to enable whatever is supported and needed, right now it is hardcoded to newlib which is wrong. |
I finally went and dug through the clang source code to figure this out. When building in This isn't related to picolibc itself, but to the removal of the -ffreestanding flag (which picolibc enables). Would a patch which changes the return type of all Is there general understanding of the benefits of removing |
IMO, removing The only time
I think that is sensible. After all, both C and C++ standards require the The Zephyr So, I am all for changing the Zephyr
That one instruction in the |
How about #54637 ? Happy to adjust to suit. |
Adds picolibc to XCC Twister quarantine file as compilation of picolibc module fails with XCC on ADSP platforms. Bug zephyrproject-rtos#54336 filed upstream. Signed-off-by: Lauren Murphy <[email protected]>
Describe the bug
Compilation of picolibc module for picolibc tests fails with XCC on ADSP platforms. Followup to #54224.
A few of the flags used by GCC to build the picolibc module are not compatible with XCC. Different flags are observed to be not working for different versions of XCC toolchain.
RI-2021.7-linux (xcc-clang)
+ MTL:RG-2017.8-linux (xcc)
+ CAVS15, 18, CAVS25:To Reproduce
Expected behavior
Compilation
Impact
Annoyance
Logs and console output
See above.
Environment
The text was updated successfully, but these errors were encountered: