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]

Problem in linking newlib


Dear Mr. Johnston,

The summary of the procedure adopted to make cross-gcc is as follows :

$ export TARGET=m68k-coff
$ export PREFIX=/usr/m68k-coff
$ export PATH=${PREFIX}/bin:$PATH

/*making binutils-2.10.91.0.2*/
unpack binutils under /usr/m68k-coff
$ mkdir /usr/m68k-coff/build-binutils
$ cdr /usr/m68k-coff/build-binutils
$../binutils-2.10.91.0.2/configure --target=$TARGET \
    --prefix=$PREFIX 2>&1 | tee configure.log
$ make all install 2>&1 | tee make.log

/*making gcc-3.0.4*/
unpack gcc under /usr/m68k-coff
$ mkdir /usr/m68k-coff/build-gcc
$ cdr /usr/m68k-coff/build-gcc
$../gcc-3.0.4/configure --target=$TARGET  \
    --prefix=$PREFIX --without-headers --with-newlib \
    2>&1 | tee configure.log
$ make all -gcc install -gcc 2>&1 | tee make.log

/*making newlib1.10.0*/
1. unpack newlib under /usr/m68k-coff
2. put the patches that stop the newlib to make executables while compiling.
$ mkdir /usr/m68k-coff/build-newlib
$ cdr /usr/m68k-coff/build-newlib
$../newlib-1.10.0/configure --target=$TARGET  \
    --prefix=$PREFIX     2>&1 | tee configure.log
$ make all install 2>&1 | tee make.log

after this I compile the gcc again for its full functionality --

/*making complete gcc-3.0.4*/
$ mkdir /usr/m68k-coff/build-gcc-again
$ cdr /usr/m68k-coff/build-gcc-again
$../gcc-3.0.4/configure --target=$TARGET  \
    --prefix=$PREFIX --with-newlib \
    2>&1 | tee configure.log
$ make all install 2>&1 | tee make.log

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 -

$ 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


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