GNU Info

Info Node: (gcc-295.info)Cross Headers

(gcc-295.info)Cross Headers


Next: Cross Runtime Prev: Tools and Libraries Up: Cross-Compiler
Enter node , (file) or (file)node

Cross-Compilers and Header Files
--------------------------------

   If you are cross-compiling a standalone program or a program for an
embedded system, then you may not need any header files except the few
that are part of GNU CC (and those of your program).  However, if you
intend to link your program with a standard C library such as `libc.a',
then you probably need to compile with the header files that go with
the library you use.

   The GNU C compiler does not come with these files, because (1) they
are system-specific, and (2) they belong in a C library, not in a
compiler.

   If the GNU C library supports your target machine, then you can get
the header files from there (assuming you actually use the GNU library
when you link your program).

   If your target machine comes with a C compiler, it probably comes
with suitable header files also.  If you make these files accessible
from the host machine, the cross-compiler can use them also.

   Otherwise, you're on your own in finding header files to use when
cross-compiling.

   When you have found suitable header files, put them in the directory
`/usr/local/TARGET/include', before building the cross compiler.  Then
installation will run fixincludes properly and install the corrected
versions of the header files where the compiler will use them.

   Provide the header files before you build the cross-compiler, because
the build stage actually runs the cross-compiler to produce parts of
`libgcc.a'.  (These are the parts that *can* be compiled with GNU CC.)
Some of them need suitable header files.

   Here's an example showing how to copy the header files from a target
machine.  On the target machine, do this:

     (cd /usr/include; tar cf - .) > tarfile

   Then, on the host machine, do this:

     ftp TARGET-MACHINE
     lcd /usr/local/TARGET/include
     get tarfile
     quit
     tar xf tarfile


automatically generated by info2www version 1.2.2.9