Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

When I want to make gcc 4.1.2 (ftp://ftp.mirrorservice.org/sites/sourceware.org/pub/gcc/releases/gcc-4.1.2/gcc-4.1.2.tar.bz2) on my ubuntu 12.04 (x86_64). The current active gcc is 4.6.2. I did:

./configure

then

make

However I get this error

/usr/bin/ld: cannot find crti.o: No such file or directory
collect2: ld returned 1 exit status

Searching the web it seems that there is a problem with the location of crti. These files are available on the system

# find /usr/ -name crti*
/usr/lib32/crti.o
/usr/lib/x86_64-linux-gnu/crti.o
/usr/lib/debug/usr/lib/x86_64-linux-gnu/crti.o

Also the libc6 devel package is installed

# dpkg -l | grep libc6
ii  libc6                                  2.15-0ubuntu10.3                          Embedded GNU C Library: Shared libraries
ii  libc6-dbg                              2.15-0ubuntu10.3                        Embedded GNU C Library: detached debugging symbols
ii  libc6-dev                              2.15-0ubuntu10.3                        Embedded GNU C Library: Development Libraries and Header Files
ii  libc6-dev-i386                         2.15-0ubuntu10.3                        Embedded GNU C Library: 32-bit development libraries for AMD64
ii  libc6-i386                             2.15-0ubuntu10.3                        Embedded GNU C Library: 32-bit shared libraries for AMD64
ii  libc6-pic                              2.15-0ubuntu10.3                        Embedded GNU C Library: PIC archive library

How can I fix that?

UPDATE:

After adding these

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

That problem is solved. However now I get

/usr/bin/ld: skipping incompatible /usr/lib/x86_64-linux-gnu/libc.so when searching for -lc
/usr/bin/ld: skipping incompatible /usr/lib/x86_64-linux-gnu/libc.a when searching for -lc
/usr/bin/ld: i386:x86-64 architecture of input file `/usr/lib/x86_64-linux-gnu/crti.o' is incompatible with i386 output
/usr/bin/ld: i386:x86-64 architecture of input file `/usr/lib/x86_64-linux-   gnu/crtn.o' is incompatible with i386 output
collect2: ld returned 1 exit status
share|improve this question
    
please see the edited post –  mahmood Feb 6 '13 at 18:21
    
I'm getting other errors, about makeinfo not being present, which is on my system. Can't get to your error with these steps. –  gertvdijk Feb 6 '13 at 18:34
add comment

3 Answers

up vote 3 down vote accepted

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
share|improve this answer
    
That problem is solved. However new error I get. Please see the original post –  mahmood Feb 6 '13 at 19:10
    
Thanks but that wasn't the solution to the second problem. I found that I had to do ./configure --disable-multilib and rebuild from scratch according to gcc.gnu.org/ml/gcc-help/2009-05/msg00238.html Thanks for your help –  mahmood Feb 6 '13 at 20:05
add comment

I'm also building an older version of gcc on my Ubuntu machine (3.4.6 on a 4.6.3 machine)
I tried @mahmood's --disable-multilib solution, but then the package I needed to use gcc 3.4.6 also seemed to need the 32 bit library as well.

Thus I added both the 64 bit and 32 bit libraries to the LIBRARY_PATH

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

Oh and I'm on Ubuntu 12.04 64bits

share|improve this answer
    
To work with older gcc/g++, you have to forget Ubuntu because on newer version of Ubuntu, you can not fully fix the problem and an older Ubuntu on the other hand is no longer supported. You have to use rehdat based systems. Centos 6.3 is ok –  mahmood Jan 13 at 10:37
add comment

Building GCC 4.8 on x86-64 from upstream sources you run into the problem of needing to build both 32- and 64-bit libraries (unless multi-lib is disabled). In that case you need to add both paths /usr/lib/x86_64-linux-gnu and /usr/lib32.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.