5.7 gcc --print-file specs segmentation fault

Dan Nicholson dbn.lists at gmail.com
Tue Nov 8 14:28:24 PST 2005

On 11/8/05, Micheal E Cooper <mcooper at miyazaki-mic.ac.jp> wrote:
> 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:

About the copy and paste.  I've never used the LiveCD, but I'm
assuming that they built the kernel with console support for the
mouse.  Actually, I remember that you were using the mouse, so you
should have the support (i.e. you see a cursor when you move the
mouse).  The typical way to do copy and paste with the mouse when you
are at a console is to click the left mouse button and highlight. 
Then, if you have a 2-button mouse, click both buttons to paste. 
Wheel mouse: paste is a click on the whell.  3-button mouse, paste is
the middle button.

If this doesn't work, try highlighting with the mouse.  Then you can
paste with Shift+Insert (I think).  It will paste wherever the cursor
left off.  Hopefully this solves the copy-paste dilemma because this
command is critical.

> 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 &&
> unset SPECFILE


> 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.

Now, I'm assuming you've rebooted.  Are you the user lfs?  What's does
echo $PATH give?  You should have /tools/bin:/bin:/usr/bin.

which gcc
Does this return /usr/bin/gcc or /tools/bin/gcc?  It should be
/tools/bin/gcc.  If not, you have not set PATH correctly in
/home/lfs/.bashrc.  Or, your gcc-pass1 build failed.

Next, what's the output of
gcc --print-file specs
Just entering this at the command line should give you a path.  If it
segfaults, you've got issues.  If you get a path, it should be
/tools/lib/gcc/something off the top of my head.  If it's
/usr/lib/something again you have issues with either your environment
or your build of gcc.

> 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.

If you entered a mangled version of the sed command and then did the
mv -vf back to the original location, you may have borked the specs
file.  Go through the steps above again, but it may not be a good
situation.  You can manually look at the file if you want.  The only
thing that should be changed is /lib/ld-linux.so.2 to

> 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.

Right, that's why you don't do the build as root.  However, the host
system is a CD, so it's read-only if I understand the LiveCD

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

No, but you may have hosed your tools specs file.

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

Not quite.  There may be a way to regenerate an appropriate specs
file, but now that you've installed glibc, it won't be the same as
before.  Someone else may suggest a more clever fix, but if it was me,
I would restart from Ch. 5.4 with gcc.  And if you don't know which
files go to what package, you might just want to restart at the

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

Hey if this is your first time, you're bound to blow it once.  I had
to restart from the beginning of Ch. 5 twice the first time.  The good
thing is that you learn a lot of subleties each time you go through
the build, so it's by no means a waste of time to restart.

More information about the lfs-support mailing list