This is the mail archive of the crossgcc@sourceware.cygnus.com mailing list for the crossgcc project.

See the CrossGCC FAQ for lots more infromation.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Painful newbie questions...


Chan Shih-Ping Richard wrote:

> Folks, hope you don't mind some painful newbie
> questions about building cross gcc for embedded systems.
> Can you folks clarify the steps about building cross gcc for
> bare targets, i.e., no OS, headers or libaries.
> I will contrast this experience with building a cross-gcc
> for a full target (OS with headers and libraries).
>
> Host is i686-linux-pc-gnu.
> Hypothetically, say I have a bare system with
> arm and Angel-type monitor. For contrast
> let's say I also want to build a cross gcc for
> a full target like sparc-sun-solaris2.7.
>
> 1) Build binutils
> For Solaris would do
>   configure --target=sparc-sun-solaris2.7
> For bare arm system would do
>   configure --target=arm-elf
>
> These steps will typically both succeed.
>
> (BTW: How do cross-lds determine whether
> to output relocatable (a.out/coff/elf) binaries
> or absolute (ROMable) binaries?
> Is the magic purely in the ld scripts?
> I.e., can a single cross-ld binary output
> both relocatable binaries and absolute binaries
> just based on different script files?)

I think it is target dependent for the output types.
I think i386 targets can produce a.out and elf.
m68k could only produce coff until recent releases of gcc.  It can now do elf.

Yes, ld can output static or relocatable binaries.
ld command line arguments of -Bstatic or -Bdynamic.
The specs files and ld scripts will probably specify these.
ld itself might have a built in default for various targets.


> 2) Build cross gcc for bare target - HOW?
>
> For a *full* target I think I know how to do this.
> I can ./configure with --with-lib or --with-headers
> or I can copy over all the target headers, libraries,
> to ${prefix}/${target}/include,lib. This method
> uses the target OS headers and standard libraries.
>
> For a bare system what would you do at *this stage*???
> given that there are no target headers and libraries
> to prepare on the host system. Do you just ignore this step?
> If I ignore this step, the build dies at choose-temp.c.
> Obviously, there are no include files to compile with.

I'm pretty sure you need some header files, but I'm not 100% sure.
Try it without specifying --with-headers and see what happens.
If it fails, use --with-headers and point it to the latest newlib include
directoy.


> build1/gcc/xgcc  -Bbuild1/gcc/
>  -B/usr/test//arm-elf/bin/ -c -DHAVE_CONFIG_H -g -O2 -I.
> -I../../../src/libiberty/.
> ./include  ../../../src/libiberty/choose-temp.c
> ../../../src/libiberty/choose-temp.c:29: stdio.h: No such file or
> directory
> ../../../src/libiberty/choose-temp.c:30: sys/types.h: No such file or
> directory
> ../../../src/libiberty/choose-temp.c:32: unistd.h: No such file or
> directory
> ../../../src/libiberty/choose-temp.c:35: stdlib.h: No such file or
> directory
> ../../../src/libiberty/choose-temp.c:38: sys/file.h: No such file or
> directory
> make[1]: *** [choose-temp.o] Error 1
> make[1]: Leaving directory
> `/home1/cshihpin/src/gnu-toolchain/build1/arm-elf/libiberty'
> make: *** [all-target-libiberty] Error 2

Theese errors indicate that gcc is expecting C library headers and system library
headers.  You will find most of these in the newlib distribution.  See
http://sourceware.cygnus.com/

Brendan Simon.



------
Want more information?  See the CrossGCC FAQ, http://www.objsw.com/CrossGCC/
Want to unsubscribe? Send a note to crossgcc-unsubscribe@sourceware.cygnus.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]