System headers

The system header files should still be found in /usr/include for Snapcraft’s build environment. Are you instead talking about other people’s code that you’ve added to your snap through extra parts?

If you can’t fix the warnings in those projects’ headers, one option is to selectively disable warnings while including those headers. For example, if a header triggers the -Wcast-align warning, you can include it like so:

#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wcast-align"
#include <problem-header.h>
#pragma GCC diagnostic pop

The push/pop pair make sure that any diagnostic changes you make don’t affect code lower down in the file. And by only ignoring specific warnings, you’re not just giving them a free pass. More details of the compiler feature can be found here:

https://gcc.gnu.org/onlinedocs/gcc/Diagnostic-Pragmas.html