https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80677
Sam James <sjames at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- See Also| |https://bugs.gentoo.org/sho | |w_bug.cgi?id=854834 --- Comment #8 from Sam James <sjames at gcc dot gnu.org> --- The case that I hit it in was with Gentoo's crossdev but we don't use the Debian multilib layout at all, nor do we patch anything like that in. There's some analysis at https://bugs.gentoo.org/854834#c0 (which I ended up rediscovering, only found that bug report this weekend): """ My understanding of what GCC (cross-arm-none-eabi/gcc-12.1.1_p20220625) does when it is building itself is that it attempts to locate an existing limits.h header, and if it does, it adds some forwarding wrappers around its own implementation to also include the found limits.h. However, in my case GCC was not finding newlib's limits.h header. Debugging the GCC build process led me to the gcc/Makefile in the build directory. In here, a check is defined by the LIMITS_H_TEST variable. Hacking together something so I can see what that expands to at the time of the check, I was able to identify it as the following: [ -f /usr/arm-none-eabi/usr/include/limits.h ] Of note, this header _does not_ exist. Newlib installed its header to /usr/arm-none-eabi/include/limits.h (note the missing usr between the triplet and the include). In other words, GCC is looking for the header (per the Makefile) in the cross-compiler-prefix + /usr/include. I haven't tried it yet, but it may be possible to fix this by telling GCC to look in cross-compiler-prefix + /include possibly with the use of --with-native-system-header-dir=/include . Alternatively, if it's possible to have newlib install to /usr/arm-none-eabi/usr/, for example, GCC should pick up the headers. By hacking the Makefile to use `NATIVE_SYSTEM_HEADER_DIR = /include` instead of `NATIVE_SYSTEM_HEADER_DIR = /usr/include`, I was able to get GCC to find the newlib limits.h header and set up its own limits.h header properly. """