Question

I have been using gcc on Linux for quite long, but I still don't know its internals. First of all, I would like to know where does the glibc resides. Secondly, where are the headers. I want to know the basic directory structure of gcc.

No correct solution

OTHER TIPS

The header files are in /usr/include/. For more information on GCC, you might want to look through gcc.gnu.org. It has a lot of information on GCC, the internals, and how it works.

Do you know about the Filesystem Hierarchy Standard?

For example, on Linux version 2.6.18-274.3.1.el5 (mockbuild@builder10.centos.org) (gcc version 4.1.2 20080704 (Red Hat 4.1.2-51)) you can find the glibc shared objects in /usr/lib/gcc and in /lib:

locate libgcc
/lib/libgcc_s-4.1.2-20080825.so.1
/lib/libgcc_s.so.1 // symbolic link to 
/usr/lib/gcc/i386-redhat-linux/3.4.6/libgcc.a
/usr/lib/gcc/i386-redhat-linux/3.4.6/libgcc_eh.a
/usr/lib/gcc/i386-redhat-linux/3.4.6/libgcc_s.so
/usr/lib/gcc/i386-redhat-linux/4.1.1/libgcc.a
/usr/lib/gcc/i386-redhat-linux/4.1.1/libgcc_eh.a
/usr/lib/gcc/i386-redhat-linux/4.1.1/libgcc_s.so
...

Includes are located in /usr/include:

>locate stdio.h
/usr/include/stdio.h
/usr/include/bits/stdio.h
/usr/include/boost/iostreams/filter/stdio.hpp
...

The files are almost in the same directories in Linux version 2.6.38-13-generic (buildd@yellow) (gcc version 4.5.2 (Ubuntu/Linaro 4.5.2-8ubuntu4) ) (x86_64 architecture):

locate libgcc
/lib/x86_64-linux-gnu/libgcc_s.so.1
/usr/lib/libgccpp.so.1
/usr/lib/libgccpp.so.1.0.2
/usr/lib/ure/lib/libgcc3_uno.so
/usr/lib/x86_64-linux-gnu/gcc/x86_64-linux-gnu/4.5/libgcc.a
/usr/lib/x86_64-linux-gnu/gcc/x86_64-linux-gnu/4.5/libgcc_eh.a
/usr/lib/x86_64-linux-gnu/gcc/x86_64-linux-gnu/4.5/libgcc_s.so
/usr/lib/x86_64-linux-gnu/gcc/x86_64-linux-gnu/4.5/libgcc_s_32.so
/usr/lib/x86_64-linux-gnu/gcc/x86_64-linux-gnu/4.5/32/libgcc.a
/usr/lib/x86_64-linux-gnu/gcc/x86_64-linux-gnu/4.5/32/libgcc_eh.a
/usr/lib/x86_64-linux-gnu/gcc/x86_64-linux-gnu/4.5/32/libgcc_s.so
/usr/lib32/libgcc_s.so.1
...
locate stdio.h
/usr/include/stdio.h
/usr/include/bits/stdio.h
/usr/include/c++/4.5/tr1/stdio.h
...

You can find a good website to know the directory structure of gcc here : Source Tree

And about the headers, you can go there : Headers GCC

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top