This is the mail archive of the crossgcc@sources.redhat.com mailing list for the crossgcc project.

See the CrossGCC FAQ for lots more information.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: problem building cross compiler for powerpc


Hi,

The _start symbol can not be found because your compiler does not know how
your embedded target looks like.  (i.e. where is the stack, what registers
should be initialized, is the target running an OS like linux or eCos, ... )

I see in your email that you are using vxWorks. You should include the
startup object file from the vxWorks directory. (sorry I can provide more
info, but I don't work with vxWorks).

The _start function can be found in the crt0.o files, somewhere in
/usr/local/powerpc-eabi/lib.
(just do an 'powerpc-eabi-objdump -x -S -D crt0.o' to disassemble it and
learn from it)

Take note that mixing object code from the vxWork toolchain and a custom
self-made toolchain can lead to unpredictable results.

The "undefined reference to printf" is a bit of a easy-to-fix error:
You forgot to link in the C-library where this function is defined.

Just try to do this:
[prompt]$ powerpc-eabi-gcc
-I/usr/local/src/gnu/newlib-1.8.2/newlib/libc/include -o hello\
          hello.c \
          /usr/local/powerpc-eabi/lib/crt0.o \
          -lc -lg

And see if it works then. (if not, try to include a flag to point to your
newlib libraries (-L<path to newlibs> ).

These mistakes are common for people new to crosscompiling with a 'bare'
toolchain (without the help of the commercial toolchains that sets up the
paths for include and library files for you + provide tools/IDEs to compile
any kind of C file with default settings.)

I suggest you read up on how to compile programs using the GNU toolchain.
A good start would be:
http://www.penguinppc.org/embedded/howto/index.html
for general embedded work.

and of course:
http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_toc.html#SEC_Contents
to learn about compiler options.

Best regards,
Jan



-----Original Message-----
From: VND Zhang ShaoBo [mailto:ShaoBo.Zhang@alcatel-sbell.com.cn]
Sent: maandag 30 september 2002 4:07
To: dnevil@snmc.com
Cc: crossgcc@sources.redhat.com
Subject: problem building cross compiler for powerpc


Sorry to bother you !  I have a qusetion to ask you about the cross compiler
for powerpc.
I want to build a cross compiler in linux for powerpc/vxworks. I download
the binutils-2.9.1, gcc-2.95.1,newlib-1.8.2. 
I successful build the cross compiler powerpc-eabi-gcc as following:
1.build the binutils
2.build the gcc-2.95.1 to get powerpc-eabi-gcc
3.build the newlib using powerpc-eabi-gcc
4.rebuild the gcc-2.95.1 to get the powerpc-eabi-gcc

then ,i program test program, but  i met some error when i using the
powerpc-eabi-gcc to build the test program 
the error is as following:
powerpc-eabi-gcc  -I/usr/local/src/gnu/newlib-1.8.2/newlib/libc/include -o
hello\
hello.c
/usr/local/powerpc/powerpc-eabi/bin/ld: warning: cannot find entry symbol
_start; defaulting to 01800074
/tmp/ccD5t0Jf.o: In function `main':
/tmp/ccD5t0Jf.o(.text+0x24): undefined reference to `printf'
collect2: ld returned 1 exit status
make: *** [hello] Error 1

Why have these errors? I don't slove this matter though i do my best. can
you give me an advice? thanks!

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

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


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