Subject: bug#30756: gcc7 doesn't find stdlib.h

From: [email-masked] (Ludovic Courtès)
Date: Fri, 09 Mar 2018 13:42:40 +0100

julien lepiller <[email-masked]> skribis:

> I'm trying to build a software that requires gcc>=7.2. Unfortunately,
> the process crashes and ends with:
>
> /gnu/store/a4vwdk8r6p6l2mnffz4yaqlr1z6z6w3r-gcc-7.3.0/include/c++/cstdlib:75:15:
> fatal error: stdlib.h: No such file or directory.

On IRC Marius mentioned this bug report:

  https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70129#c3

Note that we use C_INCLUDE_PATH, which is equivalent to ‘-isystem’.
Quoth (gnu packages gcc):

      (native-search-paths
       ;; Use the language-specific variables rather than 'CPATH' because they
       ;; are equivalent to '-isystem' whereas 'CPATH' is equivalent to '-I'.
       ;; The intent is to allow headers that are in the search path to be
       ;; treated as "system headers" (headers exempt from warnings) just like
       ;; the typical /usr/include headers on an FHS system.
       (list (search-path-specification
              (variable "C_INCLUDE_PATH")
              (files '("include")))
             (search-path-specification
              (variable "CPLUS_INCLUDE_PATH")
              (files '("include")))
             (search-path-specification
              (variable "LIBRARY_PATH")
              (files '("lib" "lib64")))))

Ludo’.