Linking problem in m68k-uclinux toolchain: crt0.o not found

Rob Landley rob at landley.net
Tue Jun 26 14:55:48 UTC 2007


On Tuesday 26 June 2007 10:02:12 Denis Vlasenko wrote:
> Hi Paul, Rob, folks,
>
> At http://qemu.org/download.html I see:
>
> coldfire-test-0.1.tar.bz2 Coldfire Linux 2.6 test kernel and initrd
> disk image (thanx to Paul Brook)
>
> I downloaded and it works for me. I plan to test newer busybox in a
> similar way. I built a cross-compiler toolchain using current releases
> of needed tools:
>
> binutils-2.17-m68k-uclinux
> gcc-4.1.2-m68k-uclinux
> uclibc-0.9.29-m68k-uclinux

I keep meaning to play with coldfire, but if I can't do it with stock 
binutils/gcc/uClibc then it's not a real platform yet...

> And I try to cross-compile busybox. It works up to the final link,
> where it complains about crt0.o missing. I tried to cross compile
> trivial C program and got the same error:
>
>  /usr/app/gcc-4.1.2-m68k-uclinux/libexec/gcc/m68k-uclinux/4.1.2/collect2
>  crt0.o
>  -L/usr/app/gcc-4.1.2-m68k-uclinux/bin/../lib/gcc/m68k-uclinux/4.1.2
>  -L/usr/app/gcc-4.1.2-m68k-uclinux/bin/../lib/gcc
>  -L/usr/lib/../m68k-uclinux/lib
>  /tmp/cccr3rdn.o -lgcc -lc -lgcc
> /usr/lib/../m68k-uclinux/bin/ld: crt0.o: No such file: No such file or
> directory collect2: ld returned 1 exit status
>
> I do not see crt0.o anywhere in my cross-compiling toolchain. Not in
> binutils, not in gcc, not in uclibc. So where should it come from?
>
> I am not experienced in this, but IIUC crt0.o is used by toolchains
> which support static linking only, because I see that native compiler
> and AMB64 cross-compiler does not try to link against crt0.o, but uses
> crt1.o etc instead, even if I use -static on gcc command line.
>
> Thus maybe the problem is that I failed to explain to uclibc that it
> needs to produce crt0.o, or maybe I chose wrong cross-compiling prefix
> (did I need to build m68k-elf cross instead?).

Symlink one to the other?  I believe they're sort of interchangeable and it 
should ever only be using one...

I asked all these questions long ago, and here was Erik's reply from the 
mailing list:

http://busybox.net/lists/uclibc/2003-September/006857.html

You might want to read the old threads "reinventing the wheel" 
and "understanding what the build wrapper does" from that time period, both 
of which were me pestering Erik Andersen for information... :)

Rob
-- 
"One of my most productive days was throwing away 1000 lines of code."
  - Ken Thompson.



More information about the uClibc mailing list