5.7 gcc --print-file specs segmentation fault

Micheal E Cooper mcooper at miyazaki-mic.ac.jp
Tue Nov 8 13:16:33 PST 2005

I am using LFS LiveCD, latest version with no customizations or variations.

I submitted the previous copy-paste problem post after manually typing in
the long sed-and-replace command in 5.7:

SPECFILE=`gcc --print-file specs` &&
sed 's@ /lib/ld-linux.so.2@ /tools/lib/ld-linux.so.2 at g' \
    $SPECFILE > tempspecfile &&
mv -f tempspecfile $SPECFILE &&

And I am pretty sure that I typed it in correctly. I understand that the @
mark becomes the replacement for what usually is a / (so that s/one/two/g
becomes s at one@two at g to replace one with two), and I understand how the &&
connects the statements. I know that this command is getting the abs file
path of the gcc spec file, running sed to replace the ld-linux.so path,
and then writing it to a temporary file and replacing the original with
the temporary file, so I am pretty sure that I typed it in correctly.

I also tested by reading the gcc man page on the --print-file command and
then trying it out by doing 'gcc --print-file specs', which gave me
something in, I think, /usr/bin or /usr/lib. I wanted to copy and paste
the command and the error message that I got, but again, I cannot copy
from the terminal, and I absent-mindedly did a ls and everything scrolled

The first time I did the long command, an error told me that I don't have
the rights to overwrite the original file, so I thought that maybe I was
trying to overwrite the wrong file, maybe the host environment's file, and
that user lfs did not have the access privilege to the host environment's
gcc spec file.

I tried to output the error message to a temporary text file so that I
could send it to this mailing list, so I put a redirect > on the end and
ran it again, but no file was created.

When I tried to do 'gcc --print-file specs' again and open the file in vi
(to do the replacement manually), I got a different message this time. The
first time I did it, it gave me a path to the gcc specs file. This time, I
got a segmentation fault.

I looked up segmentation fault on the LFS FAQ, and it says that the
program tried to access something that isn't there.

So does this mean that my botched compound command wiped out the original
gcc specs file that I need?
If the first 'gcc --print-file specs' gave me my host environ gcc specs
file, to which I don't have access, then how could I delete it, if I don't
have access? Also, I don't think that LFS would have us modifying the host
environ's gcc.

If I _did_ wipe out the host environ gcc specs file, then would rebooting
fix it, since I am using the LiveCD?

If I wiped out the gcc that I compiled earlier, can I just go back to 5.6.
Glibc-2.3.4 and redo?

Or does this mean that I am borked and hopeless miered, that I lewinskied
myself, that I have a faceful of scooter?

More information about the lfs-support mailing list