cannot find crti.o: No such file or directory

This is a BUG reported in launchpad, byt there is a workaround :

compiling 64 bits program in 32 bits platform :

LIBRARY_PATH=/usr/lib/x86_64-linux-gnu:$LIBRARY_PATH 
export LIBRARY_PATH

for 32 bits native :

LIBRARY_PATH=/usr/lib32:$LIBRARY_PATH
export LIBRARY_PATH

That in your .bashrc file (or ran from a console) is enough for GCC to find the new location of library.

thx. to Iain Buclaw (ibuclaw) to point out in the right direction.

12.10 32 bits

hhlp@hhlp:~$ sudo find /usr/ -name crti*
/usr/lib/i386-linux-gnu/crti.o
hhlp@hhlp:~$ 

LIBRARY_PATH=/usr/lib/i386-linux-gnu:$LIBRARY_PATH 
export LIBRARY_PATH

12.10 64 bits

hhlp@hhlp:~$ sudo find /usr/ -name crti*
/usr/lib/x86_64-linux-gnu/crti.o
hhlp@hhlp:~$ 

LIBRARY_PATH=/usr/lib/x86_64-linux-gnu:$LIBRARY_PATH 
export LIBRARY_PATH

In my case Ubuntu 16.04 the I have no crti.o at all:

$ find /usr/ -name crti*

So I install developer package:

sudo apt-get install libc6-dev

Tags:

Gcc

12.04