[clug] discovering gcc "<xxx.h>" (system) include directories

steve jenkin sjenkin at canb.auug.org.au
Thu Nov 22 23:05:22 MST 2012


Carlo Hamalainen wrote on 23/11/12 4:32 PM:

> I suppose as a hack you could make a hello_world C file that just
> includes stdio.h, and then grep for stdio.h on "gcc -v -H helloworld.c",
> which will show you were that particular gcc binary is looking for
> files. But I may be barking up the wrong tree...
> 

Good call. Thanks.

Wasn't aware of '-H' flag.
" -H  Print the name of each header file used, in addition to other
normal activities."

mini-too:linux-2.6.34.13 steve$ gcc -v -H t.c 2>&1|grep /inc

Configured with: ../gcc-4.3.6/configure --prefix=/opt/local
--build=x86_64-apple-darwin10
--enable-languages=c,c++,objc,obj-c++,java,fortran
--libdir=/opt/local/lib/gcc43

 --includedir=/opt/local/include/gcc43

--> why didn't that show up before??

 --infodir=/opt/local/share/info --mandir=/opt/local/share/man
--datadir=/opt/local/share/gcc43 --with-local-prefix=/opt/local
--with-libiconv-prefix=/opt/local --with-system-zlib --disable-nls
--program-suffix=-mp-4.3
--with-gxx-include-dir=/opt/local/include/gcc43/c++/
--with-gmp=/opt/local --with-mpfr=/opt/local --enable-stage1-checking
--disable-multilib --with-as=/opt/local/bin/as
--with-ld=/opt/local/bin/ld --with-ar=/opt/local/bin/ar
--with-bugurl=https://trac.macports.org/newticket
--with-pkgversion='MacPorts gcc43 4.3.6_7'

ignoring nonexistent directory
"/opt/local/lib/gcc43/gcc/x86_64-apple-darwin10/4.3.6/../../../../../x86_64-apple-darwin10/include"

==> another bad dir

 /opt/local/include
 /opt/local/lib/gcc43/gcc/x86_64-apple-darwin10/4.3.6/include
 /opt/local/lib/gcc43/gcc/x86_64-apple-darwin10/4.3.6/include-fixed
 /usr/include
. /usr/include/stdio.h
.. /usr/include/_types.h
... /usr/include/sys/_types.h
.... /usr/include/sys/cdefs.h
.... /usr/include/machine/_types.h
..... /usr/include/i386/_types.h
.. /usr/include/secure/_stdio.h
... /usr/include/secure/_common.h
/usr/include/secure/_stdio.h

==> that's quite a list of places it looked.



-- 
Steve Jenkin, Info Tech, Systems and Design Specialist.
0412 786 915 (+61 412 786 915)
PO Box 48, Kippax ACT 2615, AUSTRALIA

sjenkin at canb.auug.org.au http://members.tip.net.au/~sjenkin


More information about the linux mailing list