This is the mail archive of the
newlib@sourceware.org
mailing list for the newlib project.
Error linking C program
- From: siv Kumar <kvkskumar1 at gmail dot com>
- To: newlib at sourceware dot org
- Date: Wed, 27 Mar 2013 10:06:01 +0530
- Subject: Error linking C program
Hi,
I have built a cross compiler for Powerpc on my Centos 5.5 running on
intel pentium 4, with all the latest builds like gmp-5.1.1,
mpfr-3.1.2,mpc-1.0.1,binutils-2.23.1, bootstrap gcc-4.8.0,
newlib-2.0.0, binutils and gcc again with newlib and then gdb, in the
same order as shown above. I have seen this procedure somewhere in
internet and used it. I have tried running a simple exit program as
main()
{
exit(1);
}
When I try executing it, I get the error undefined _exit
powerpc-elf-gcc -o fail fail.c -fno-builtin-exit -e 0x1000
/usr/local/lib/gcc/powerpc-elf/4.7.2/../../../../powerpc-elf/lib/libc.a(lib_a-exit.o):
In function `exit':
/usr/src/newlib-1.20.0/newlib/libc/stdlib/exit.c:65: undefined
reference to `_exit'
collect2: error: ld returned 1 exit status
I have tried adding the stdlib.h and unistd.h header responsible for
_exit (found by reading exit.c file)in my program.But then it didnot
work. Could you please help me dealing with the error. I am short of
time now. Please help me.
Thank You,
kvks