This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: Problem in linking newlib
- From: "J. Johnston" <jjohnstn at redhat dot com>
- To: Naveen Malik <maliknaveen at hotmail dot com>
- Cc: gcc-help <gcc-help at gcc dot gnu dot org>
- Date: Mon, 06 May 2002 11:23:28 -0400
- Subject: Re: Problem in linking newlib
- Organization: Red Hat Inc.
- References: <OE75UAaTzvb5YI9IJsa0000680d@hotmail.com>
Naveen Malik wrote:
>
> during all this process I don't get any error and the process ends happily.
> Now, when I run the command to compile a simple c programme of hello world -
>
> #include<stdio.h>
> int main(void)
> {
> printf("Hello World\n");
> }
>
> I get errors.
>
> If I compile upto the assembling phase ( -c option) or upto compilation
> phase (-S option) no errors are found, but as soon as I want to make
> executable, long list of errors appear as follows -
>
Naveen,
You have to specify an ld script from libgloss. If you are building to run on
the simulator, specify -Tsim.ld with your compile/link. If you are building for
other boards, check the .ld scripts in the libgloss/m68k directory and choose
the one most appropriate for you.
-- Jeff J.
> $ m68k-coff-gcc -o abc abc.c
> /usr/m68k-coff/lib/gcc-lib/m68k-coff/3.0.4/m68000/libgcc.a(__main.o): In
> function `__do_global_dtors':
> /usr/m68k-coff/build-gcc-again/gcc/../../gcc-3.0.4/gcc/libgcc2.c(.text+0x30)
> : undefined reference to `__EH_FRAME_BEGIN__'
> /usr/m68k-coff/lib/gcc-lib/m68k-coff/3.0.4/m68000/libgcc.a(__main.o): In
> function `__do_global_ctors':
> /usr/m68k-coff/build-gcc-again/gcc/../../gcc-3.0.4/gcc/libgcc2.c(.text+0x4e)
> : undefined reference to `__EH_FRAME_BEGIN__'
> /usr/m68k-coff/lib/gcc-lib/m68k-coff/3.0.4/../../../../m68k-coff/lib/m68000/
> libc.a(abort.o): In function `abort':
> /usr/m68k-coff/build-newlib/m68k-coff/m68000/newlib/libc/stdlib/../../../../
> ../../newlib-1.10.0/newlib/libc/stdlib/abort.c:63: undefined reference to
> `_exit'
> /usr/m68k-coff/lib/gcc-lib/m68k-coff/3.0.4/../../../../m68k-coff/lib/m68000/
> libc.a(signalr.o): In function `_kill_r':
> /usr/m68k-coff/build-newlib/m68k-coff/m68000/newlib/libc/reent/../../../../.
> ./../newlib-1.10.0/newlib/libc/reent/signalr.c:61: undefined reference to
> `kill'
> /usr/m68k-coff/lib/gcc-lib/m68k-coff/3.0.4/../../../../m68k-coff/lib/m68000/
> libc.a(signalr.o): In function `_getpid_r':
> /usr/m68k-coff/build-newlib/m68k-coff/m68000/newlib/libc/reent/../../../../.
> ./../newlib-1.10.0/newlib/libc/reent/signalr.c:96: undefined reference to
> `getpid'
> /usr/m68k-coff/lib/gcc-lib/m68k-coff/3.0.4/../../../../m68k-coff/lib/m68000/
> libc.a(sbrkr.o): In function `_sbrk_r':
> /usr/m68k-coff/build-newlib/m68k-coff/m68000/newlib/libc/reent/../../../../.
> ./../newlib-1.10.0/newlib/libc/reent/sbrkr.c:60: undefined reference to
> `sbrk'
> /usr/m68k-coff/lib/gcc-lib/m68k-coff/3.0.4/../../../../m68k-coff/lib/m68000/
> libc.a(makebuf.o): In function `__smakebuf':
> /usr/m68k-coff/build-newlib/m68k-coff/m68000/newlib/libc/stdio/../../../../.
> ./../newlib-1.10.0/newlib/libc/stdio/makebuf.c:93: undefined reference to
> `isatty'
> /usr/m68k-coff/lib/gcc-lib/m68k-coff/3.0.4/../../../../m68k-coff/lib/m68000/
> libc.a(readr.o): In function `_read_r':
> /usr/m68k-coff/build-newlib/m68k-coff/m68000/newlib/libc/reent/../../../../.
> ./../newlib-1.10.0/newlib/libc/reent/readr.c:58: undefined reference to
> `read'
> /usr/m68k-coff/lib/gcc-lib/m68k-coff/3.0.4/../../../../m68k-coff/lib/m68000/
> libc.a(lseekr.o): In function `_lseek_r':
> /usr/m68k-coff/build-newlib/m68k-coff/m68000/newlib/libc/reent/../../../../.
> ./../newlib-1.10.0/newlib/libc/reent/lseekr.c:58: undefined reference to
> `lseek'
> /usr/m68k-coff/lib/gcc-lib/m68k-coff/3.0.4/../../../../m68k-coff/lib/m68000/
> libc.a(writer.o): In function `_write_r':
> /usr/m68k-coff/build-newlib/m68k-coff/m68000/newlib/libc/reent/../../../../.
> ./../newlib-1.10.0/newlib/libc/reent/writer.c:58: undefined reference to
> `write'
> /usr/m68k-coff/lib/gcc-lib/m68k-coff/3.0.4/../../../../m68k-coff/lib/m68000/
> libc.a(closer.o): In function `_close_r':
> /usr/m68k-coff/build-newlib/m68k-coff/m68000/newlib/libc/reent/../../../../.
> ./../newlib-1.10.0/newlib/libc/reent/closer.c:53: undefined reference to
> `close'
> /usr/m68k-coff/lib/gcc-lib/m68k-coff/3.0.4/../../../../m68k-coff/lib/m68000/
> libc.a(fstatr.o): In function `_fstat_r':
> /usr/m68k-coff/build-newlib/m68k-coff/m68000/newlib/libc/reent/../../../../.
> ./../newlib-1.10.0/newlib/libc/reent/fstatr.c:62: undefined reference to
> `fstat'
> collect2: ld returned 1 exit status
>
> even using -lnosys at the end of command line has no effect.
>
> Please advice - whether I have installed newlibs wrongly or I am not using
> the cross gcc properly.
>
> Please help me to resolve this issue.
>
> With Best Regards
>
> Naveen Malik