This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


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: Link error


On 08/09/2010 02:59 PM, Phung Nguyen wrote:
> Dear all,
> 
> I am trying to build cross compiler for xc16x. I built successfully
> binutils 2.18; gcc 4.0 and newlib 1.18. Everything is fine when
> compiling a simple C file without any library call. It is also fine
> when making a simple call to printf like printf("Hello world").
> However, i got error message from linker when call printf("i=%i",i);
> The error message is as follows
> 
> /home/guest/xc16x/lib/gcc/xc16x-elf/lib/xc16xl/libc.a(lib_a-sbrkr.o):
> In function _sbrk_r:
> /home/guest/newlib-1.18.0/newlib/libc/reent/sbrkr.c:60: undefined
> reference to __sbrk
> /home/guest/fromKpit/newlib-1.18.0/newlib/libc/reent/sbrkr.c:60:
> undefined reference to __sbrk
> ....
> 
> collect2: ld returned 1 exit status
> make: *** [bubble.out] Error 1
> 
> 
> Is there any idea how to solve the problem? I highly appreciate any help.

You have to provide sbrk.

See http://sca.uwaterloo.ca/coldfire/gcc-doc/docs/porting_3.html

Andrew.


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