crt1.o not found in mipsel-linux

Kai Ruottu
Fri Dec 9 10:01:00 GMT 2005

pati (sent by wrote:

> can you explain me why this object file is used for.....

The 'crt1.o' is the 'shell' around the 'main()' function, the
program entry symbol, '_start' (usually), is in it. It does
some initializing before calling 'main()' and when 'main()'
exits, it does some 'atexit()' etc. tasks before going to

All the previous should be told on a "primary course in C"...

> Also when I use gcc linker ld  with the following linker options , 
>  mipsel-linux-ld  -o main.elf main.o -L /usr/lib -lc -I /lib

Using the linker directly is very rare. The GCC used should know
where to search the standard C libraries. So the 'gcc' driver will
be used also in linking, like :

   mipsel-linux-gcc -o main.elf main.o

The '-L /usr/lib -lc -I /lib' has no sanity !  The stuff in these
places has the native libraries, not the Linux/MIPS libraries!

> this is what I get...
> mipsel-linux-ld: skipping incompatible /lib/ when searching for /lib/
> mipsel-linux-ld: cannot find /lib/

Of course the native stuff is incompatible with the Linux/MIPS

> what is this ???. From what I figure out, the linker
 > is looking for in /lib instead of /usr/lib.

The '' is the name for the 'real' shared C library, 'libc
version 6', in current Linuces. The earlier was 'libc version 5',
and its shared library name was ''. Distros like Red Hat 4,
SuSE 5 etc. still used the 'libc5'.

The '/usr/lib/' is only a 'linker script' which tells which
real libraries should be linked against when the linker tries to
link against the ''. Currently a native glibc has the row:

   GROUP( /lib/ /usr/lib/libc_nonshared.a )

in it telling what to link against. In a cross GCC this file is
usually edited to have only the base library names :

   GROUP( libc_nonshared.a )

The linker takes care about finding them from their right places.

Please try the '-v' and '-Wl,-verbose' ("give '-verbose' to the linker)
commands on your 'mipsel-linux-gcc' command line in order to learn
something about what happens during "compiling and linking" !  Like:

   mipsel-linux-gcc -v -Wl,-verbose -O2 \
   -o hi_mips-linux.x hello.c > Logfile 2>&1

The '> Logfile 2>&1' should cause the output text going into a logfile
instead of the screen...

Want more information?  See the CrossGCC FAQ,
Want to unsubscribe? Send a note to

More information about the crossgcc mailing list