Path: ...!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!eternal-september.org!.POSTED!not-for-mail From: Kaz Kylheku <643-408-1753@kylheku.com> Newsgroups: comp.lang.c Subject: Re: What are GCC's "Standard system directories" on GNU/Linux? Date: Wed, 5 Feb 2025 18:46:22 -0000 (UTC) Organization: A noiseless patient Spider Lines: 50 Message-ID: <20250205103030.662@kylheku.com> References: Injection-Date: Wed, 05 Feb 2025 19:46:22 +0100 (CET) Injection-Info: dont-email.me; posting-host="98cabd0b9521933d57db6352b7d68c33"; logging-data="2636939"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18S0shLXQPCOw3JF4z44+CtRzkYWEYhG58=" User-Agent: slrn/pre1.0.4-9 (Linux) Cancel-Lock: sha1:7PC5M1Jynlb4qx6DgHTj1Vxk6KE= Bytes: 2594 On 2025-02-05, Alan Mackenzie wrote: > Hello, comp.lang.c. > > In the GCC manual, section 3.16 "Options for Directory Search" partially > describes where, how, and in what order GCC finds #include files when > compiling. > > It's the "partially" bit which is getting on my nerves. The manual > section contains a priority list for finding #include files, but the > fifth item just vaguely states: > > 5. Standard system directories are scanned. > > . Which directories are these? Where is this documented? All that stuff depends on the GCC installation, and therefore cannot be specified in concrete terms in a general document. Unfortunately gcc -print-search-dirs does not have info about the include file search directories. I'm guessing that could have to do with the split between the compiler and preprocessor. Anyway, we can coax the information out of the preprocessing stuff, by adding the -v option to gcc -E. Try this: $ echo | gcc -xc -E -v - 2>&1 | awk '/include.*search starts here/,/End of search list/' #include "..." search starts here: #include <...> search starts here: /usr/lib/gcc/i686-linux-gnu/7/include /usr/local/include /usr/lib/gcc/i686-linux-gnu/7/include-fixed /usr/include/i386-linux-gnu /usr/include End of search list. The above happens to come from a 32 bit Ubuntu 18 VM, that I maintain for compiling for 32 bit Intel. (You cannot install that from scratch; 32 bit support started to be deprecated after Ubuntu 16; I created that VM by upgrading from 16.) -- TXR Programming Language: http://nongnu.org/txr Cygnal: Cygwin Native Application Library: http://kylheku.com/cygnal Mastodon: @Kazinator@mstdn.ca