How to use newlib(mips)

Li Chengyuan chengyuanli@hotmail.com
Thu Jul 5 00:02:00 GMT 2001


hi,
   I have built the newlib in the directory /usr/local/mips-mips-elf/lib
   but when i want to link a program(The "Hello World") with the newlib,I 
met a problem.
   if I do:
        mips-mips-elf-gcc -o hello hello.c
   the error message is :
   /usr/local/mips-mips-elf/lib/crt0.o: In function `zerobss':
../../../../../gcc-2.95.3/libgloss/mips/crt0.S:132: undefined reference to 
`get_mem_info'
../../../../../gcc-2.95.3/libgloss/mips/crt0.S:136: undefined reference to 
`__stack'
../../../../../gcc-2.95.3/libgloss/mips/crt0.S:136: undefined reference to 
`__stack'
/usr/local/mips-mips-elf/lib/crt0.o: In function `init':
../../../../../gcc-2.95.3/libgloss/mips/crt0.S:172: undefined reference to 
`hardware_init_hook'
../../../../../gcc-2.95.3/libgloss/mips/crt0.S:172: undefined reference to 
`hardware_init_hook'
../../../../../gcc-2.95.3/libgloss/mips/crt0.S:178: undefined reference to 
`software_init_hook'
../../../../../gcc-2.95.3/libgloss/mips/crt0.S:178: undefined reference to 
`software_init_hook'
../../../../../gcc-2.95.3/libgloss/mips/crt0.S:185: undefined reference to 
`atexit'
/tmp/ccfZmRZZ.o: In function `main':
hello.c(.text+0x18): undefined reference to `printf'
/usr/local/lib/gcc-lib/mips-mips-elf/2.95.3/libgcc.a(_exit.o): In function 
`exit':
/home/lcy/src/build/gcc/gcc/../../../gcc-2.95.3/gcc/libgcc2.c(.text+0x14): 
undefined reference to `_cleanup'
collect2: ld returned 1 exit status

if i do this way:
     mips-mips-elf-gcc -c hello.c -o hello.o
     mips-mips-elf-gcc -L/usr/local/mips-mips-elf/lib -lc 
-I/usr/local/mips-mips-elf/include hello.o 
/usr/local/mips-mips-elf/lib/crt0.o -o hello

the error message is :
/usr/local/mips-mips-elf/lib/crt0.o: In function `_start':
../../../../../newlib-1.9.0/libgloss/mips/crt0.S:55: multiple definition of 
`_start'
/usr/local/mips-mips-elf/lib/crt0.o:../../../../../newlib-1.9.0/libgloss/mips/crt0.S:55: 
first defined here
/usr/local/mips-mips-elf/lib/crt0.o: In function `zerobss':
../../../../../newlib-1.9.0/libgloss/mips/crt0.S:122: multiple definition 
of `zerobss'
/usr/local/mips-mips-elf/lib/crt0.o:../../../../../newlib-1.9.0/libgloss/mips/crt0.S:122: 
first defined here
/usr/local/mips-mips-elf/lib/crt0.o: In function `init':
../../../../../newlib-1.9.0/libgloss/mips/crt0.S:172: multiple definition 
of `init'
/usr/local/mips-mips-elf/lib/crt0.o:../../../../../newlib-1.9.0/libgloss/mips/crt0.S:172: 
first defined here
/usr/local/mips-mips-elf/lib/crt0.o: In function `_exit':
../../../../../newlib-1.9.0/libgloss/mips/crt0.S:224: multiple definition 
of `_exit'
/usr/local/mips-mips-elf/lib/crt0.o:../../../../../newlib-1.9.0/libgloss/mips/crt0.S:224: 
first defined here
/usr/local/mips-mips-elf/lib/crt0.o: In function `zerobss':
../../../../../newlib-1.9.0/libgloss/mips/crt0.S:132: undefined reference 
to `get_mem_info'
../../../../../newlib-1.9.0/libgloss/mips/crt0.S:136: undefined reference 
to `__stack'
../../../../../newlib-1.9.0/libgloss/mips/crt0.S:136: undefined reference 
to `__stack'
/usr/local/mips-mips-elf/lib/crt0.o: In function `init':
../../../../../newlib-1.9.0/libgloss/mips/crt0.S:172: undefined reference 
to `hardware_init_hook'
../../../../../newlib-1.9.0/libgloss/mips/crt0.S:172: undefined reference 
to `hardware_init_hook'
../../../../../newlib-1.9.0/libgloss/mips/crt0.S:178: undefined reference 
to `software_init_hook'
../../../../../newlib-1.9.0/libgloss/mips/crt0.S:178: undefined reference 
to `software_init_hook'
/usr/local/mips-mips-elf/lib/libc.a(sbrkr.o): In function `_sbrk_r':
/home/lcy/src/build/newlib/mips-mips-elf/newlib/libc/reent/../../../../../../newlib-1.9.0/newlib/libc/reent/sbrkr.c:61: 
undefined reference to `sbrk'
hello.o: In function `main':
hello.c(.text+0x18): undefined reference to `printf'
/usr/local/mips-mips-elf/lib/crt0.o: In function `zerobss':
../../../../../newlib-1.9.0/libgloss/mips/crt0.S:132: undefined reference 
to `get_mem_info'
../../../../../newlib-1.9.0/libgloss/mips/crt0.S:136: undefined reference 
to `__stack'
../../../../../newlib-1.9.0/libgloss/mips/crt0.S:136: undefined reference 
to `__stack'
/usr/local/mips-mips-elf/lib/crt0.o: In function `init':
../../../../../newlib-1.9.0/libgloss/mips/crt0.S:172: undefined reference 
to `hardware_init_hook'
../../../../../newlib-1.9.0/libgloss/mips/crt0.S:172: undefined reference 
to `hardware_init_hook'
../../../../../newlib-1.9.0/libgloss/mips/crt0.S:178: undefined reference 
to `software_init_hook'
../../../../../newlib-1.9.0/libgloss/mips/crt0.S:178: undefined reference 
to `software_init_hook'
collect2: ld returned 1 exit status

     i'll appreciate your help.


_________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com .



More information about the Newlib mailing list