Error compiling gcc 4.6.2 under ubuntu 11.10
Asked Answered
C

4

14

I have one problem compiling gcc 4.6.2 under ubuntu 11.10. The error is quite popular i.e. /usr/bin/ld: cannot find crti.o: No such file or directory I tried to LIBRARY_PATH=/usr/lib/x86_64-linux-gnu where crti.o could be found by the linker but then the configuration complains that LIBRARY_PATH should not contain the path of the current directory when building gcc

checking LIBRARY_PATH variable... contains current directory
configure: error: 
*** LIBRARY_PATH shouldn't contain the current directory when
*** building gcc. Please change the environment variable
*** and run configure again.
make[2]: *** [configure-stage2-gcc] Error 1
make[2]: Leaving directory `/home/abdul/cc02/gcc-4.6.2/src-infra/obj-gcc'
make[1]: *** [stage2-bubble] Error 2
make[1]: Leaving directory `/home/abdul/cc02/gcc-4.6.2/src-infra/obj-gcc'

I have also tried to set LD_LIBRARY_PATH but no avail.

Thanks in advance.

Clarineclarinet answered 19/12, 2011 at 18:28 Comment(2)
What does env | grep '^LIBRARY_PATH=' report?Kalinin
IBRARY_PATH=/usr/lib/x86_64-linux-gnu/:Clarineclarinet
K
33

Apparently, your LIBRARY_PATH ends in a colon:

/usr/lib/x86_64-linux-gnu/:
#  -----------------------^

Get rid of that:

export LIBRARY_PATH=/usr/lib/x86_64-linux-gnu/
Kalinin answered 20/12, 2011 at 15:4 Comment(4)
Hint: If that stupid colon occured, don't forget to check C_INCLUDE_PATH while you're at it...Trevatrevah
On my system the colon was in the beginning, so check that tooFarkas
It seems a double colon in the middle of the path can also upset it (and is hard to spot!)Fled
please use @hmb's answer: You are building a new gcc compiler, do NOT mess up with any exiting LIBRARY_PATH (to some old version library). Please do: unset LIBRARY_PATH; ./configure -vCalamine
C
3

Combining the answers of @hmb, @FredFoo, and avoiding assumptions about users' systems:

It seems your LD_LIBRARY_PATH ends with a colon, which GCC doesn't approve of. You should also ensure C_INCLUDE_PATH doesn't end with a colon to avoid related issues. Here's how to do it:

export LIBRARY_PATH=$(echo $LIBRARY_PATH | sed 's/:$//; s/^://;')
export C_INCLUDE_PATH=$(echo $C_INCLUDE_PATH | sed 's/:$//; s/^://;')

then re-configure the build (with configure -v).

Confederation answered 14/6, 2018 at 9:30 Comment(0)
A
1

Following command solved problem

unset LIBRARY_PATH; ./configure -v

Attitudinize answered 3/5, 2013 at 3:30 Comment(1)
You are building a new gcc compiler, do NOT mess up with any exiting LIBRARY_PATH (to some old version library). I think this is the right answer!Calamine
P
0

I had the same problem and found a solution at askubuntu.

Especially in the following comment:

And, if you don't like patching your sources, and setting flags aren't working for you, just soft-link crt*.o into the /usr/lib dirctory (you'll find them in either /usr/lib/i386-linux-gnu or /usr/lib/x86_64-linux-gnu). – ams Nov 15 '11 at 14:55

Photomechanical answered 23/2, 2012 at 13:24 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.