Why can't I link to the newlib
brian
brian@ciitec.com
Fri May 9 12:03:00 GMT 2003
hello all,
I counter a question when I compile a hello-world, in which there is a strcpy function. The error info is 'undefined reference strcpy'.
Following is my step to build mips-elf-gcc.
1.build binutils
<build-bin>../binutils-2.13.2.1/./configure --target=mips-elf
make all install
2.build gcc
<build-gcc>../gcc-3.2.2/./configure --target=mips-elf --enable-languages=c --disable-shared --without-headers --with-newlib --with-gnu-ld --with-gnu-as --with-gnu-ar
make all-gcc install-gcc
3.build newlib
(1)add a file mt-mips(I named it), in /newlib-1.10.0/config/. Content of the file is:
ASFLAGS_FOR_TARGET = $(ASFLAGS) -mips1 -EL -m4010
CFLAGS_FOR_TARGET = $(CFLAGS) -mips1 -EL -Wa,-m4010 -nostartfiles
ARFLAGS_FOR_TARGET = elf32-littlemips
(2)modify configure.in at Line 365 and add the following:
mips*-*-*)
target_makefile_frag = "${target_makefile_frag} config/mt-mips"
;;
(3)
<build-newlib>../newlib-1.10.0/./configure --target=mips-elf
make all install
4.rebuild gcc
<build-gcc2>../gcc-3.2.2/./configure --target=mips-elf --enable-languages=c --with-newlib --with-gnu-ld --with-gnu-as --with-gnu-ar --with-headers=../newlib-1.10.0/newlib/libc/include
make all install
By this step, no question. And I try to compile a hello.c with newlib, but a error merged.,'undefined reference strcpy'. I find the libc.a in /usr/local/miips-elf/lib, and the header files also there.
The chip for the project is mips r300 architecture, mips1 instruction.
Please help me, tell me why, or give me some advice, thanks.
Best regards,
Brian
More information about the Gcc-help
mailing list