[lfs-support] SOLVED: lfs 7.4 section 5.9.1. Installation of Binutils error: Cannot run C compiled programs

Pierre Labastie pierre.labastie at neuf.fr
Wed Nov 13 09:19:10 PST 2013

Le 13/11/2013 04:27, Ron Hartikka a écrit :
> This looks like virgo's problem at...
> http://www.mail-archive.com/lfs-support@linuxfromscratch.org/msg20545.html
> I was pasting from the 7.4 online book into a terminal window.
> I got to this point (5.9.1):
> *CC=$LFS_TGT-gcc                \
> AR=$LFS_TGT-ar                 \
> RANLIB=$LFS_TGT-ranlib         \
> ../binutils-2.23.2/configure   \
>      --prefix=/tools            \
>      --disable-nls              \
>      --with-lib-path=/tools/lib \
>      --with-sysroot*
> I selected all of that at once, middle-mouse-pasted it into my terminal, and hit return.
> I had entered many multilined commands this way and all seemed to work.
> But this time, like Virgo, I got this error:
> *Cannot run C compiled programs*
> I repeated all of chapter 5 up to there with the same result.
> I studied the situation and found that echo $CC produced a blank line.
> So CC was not set. Nor, as I recall, were AR and RANLIB.

Neither CC, nor AR or RANLIB should be set. So echo $CC *should* produce 
a blank line.The way the command above is done allows to set those 
variables temporarily during the executionof configure. A more relevant 
test could be "echo $LFS_TGT-gcc", or "$LFS_TGT-gcc --version".

Typing one line at a time without the backslashes does not work the way 
it is intended to, because the variables CC, etc are not passed to 
configure! Unless you exported those variables to the environment, you 
have built binutils pass 2 with the host compiler, not the one you built 
during gcc pass1.

Normally, if you have carefully followed the steps in chapter 4, you may 
log in and out and back to the lfs user, and always get the same 

If you get garbbled pasting from the html book (I doubt it, because in 
this case, it would have shown up during the preceding steps), you may 
try akh suggestions. But I suspect some environment problem (LFS_TGT or 
othervariablesnot set or not exported). So please check it.


More information about the lfs-support mailing list