glaucuslinux / glaucus

A simple and lightweight Linux® distribution based on musl libc and toybox
https://glaucuslinux.org/
ISC License
281 stars 6 forks source link

[cross] [gcc] [build]: cc1: error: no include path in which to search for stdc-predef.h #8

Closed firasuke closed 4 years ago

firasuke commented 4 years ago

This seems to be a rather common issue when working with cross-compilation toolchains, specially those involving the use of musl as their libc of choice.

Previously, musl didn't provide stdc-predef.h which was thought to be the main cause for this ignored error, but it seems that this error is surfacing again without a valid cause.

Initially, I got rid of this error by specifying the following flag--with-native-system-header-dir=/include (the trailing slash before include is needed) to the configure function for cross gcc, which when combined with --with-sysroot=$DIRECTORY (according to gcc's current documentation), will cause gcc to search for header files within $DIRECTORY/include.

But now, it seems that this error managed to pop up again with no apparent reason, and it should be treated as an ignored warning more or less.

Debian recommends creating an empty stdc-predef.h file to silence this error, according to Debian's bootstrap issues.

In my opinion, the real reason why this error is showing is due to the C library (which is musl in our case) not being available in $sysroot (along with its headers, including stdc-predef.h) at the time of running the build function, which means that it's a harmless error and should remain ignored.

Since the build is continuing just fine, and isn't exiting with various missing header files, creating an empty stdc-predef.h in $sysroot's appropriate include directory seems the right way to go.

For further reading: