Products
and Services Support
and Docs Training Partner Programs About Red
Hat
  download storecart
red hat logo
redhat.comredhat network

Red Hat Documentation

Cross-Compilers and Header Files Contents|Index|Previous|Next
Cross-compilers and header files  

If you are cross-compiling a stand-alone 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 ‘/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.

To copy header files from a target machine, use the following example’s input.

    (cd /usr/include; tar cf - .) > tarfile
Then, on the host machine, use the following example’s input where target-machine represents your intended target machine.
    ftp target-machine 
    lcd /usr/local/target/include 
    get tarfile 
    quit 
    tar xf tarfile


Top|Contents|Index|Previous|Next
<

 

 


 
© 2001 Red Hat, Inc. All rights reserved.
About Red Hat  :  Legal statement  :  Privacy statement  :  Y2K statement  :  Contact Red Hat