LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Linux From Scratch
User Name
Password
Linux From Scratch This Forum is for the discussion of LFS.
LFS is a project that provides you with the steps necessary to build your own custom Linux system.

Notices


Reply
  Search this Thread
Old 01-30-2010, 04:21 PM   #1
steviebob
Member
 
Registered: Jan 2010
Location: Arkansas
Distribution: Slackware-Current, LFS
Posts: 136

Rep: Reputation: 16
Linux From Scratch 6.5 section 5.8 problem


Hi, I'm having a small problem that is (to my annoyance) hindering my progress.
Well, here is the problem. The books tells you to adjust the toolchain by running a series of commands:
Code:
SPECS='dirname $(LFS_TGT-gcc -print-libgcc-file-name)'/specs
$LFS_TGT-gcc -dumpspecs | sed \
-e 's@/lib\(64\)\?/ld@/tools&@g' \
-e "/^\*cpp:$/{n;s,$, -isystem /tools/include,}" > $SPECS
echo "New specs file is: $SPECS"
unset SPECS
I run that and get this output:
Code:
bash: $SPECS: ambiguous redirect
bash: i686-lfs-linux-gnu-gcc: command not found
I figured this wasn't a bad thing, but whenever it tells you to check the sanity of the system by running:
Code:
echo 'main(){}' > dummy.c
$LFS_TGT-gcc -B/tools/lib dummy.c
readelf -l a.out | grep ': /tools'
I get the output of:
Code:
bash: i686-lfs-linux-gnu-gcc: command not found
After the first command, "$LFS_TGT-gcc -B/tools/lib dummy.c", and:
Code:
readelf: Error: 'a.out': No such file
After the last command "readelf -l a.out | grep ': /tools'"

I honestly don't know what to do about all of this, and I have already searched the forums, but can't find anything. Any help will be greatly appreciated

Last edited by steviebob; 01-30-2010 at 04:22 PM.
 
Old 01-30-2010, 05:32 PM   #2
crts
Senior Member
 
Registered: Jan 2010
Posts: 2,020

Rep: Reputation: 757Reputation: 757Reputation: 757Reputation: 757Reputation: 757Reputation: 757Reputation: 757
Hi,

I am not sure what exactly the problem is but:

Code:
SPECS='dirname $(LFS_TGT-gcc -print-libgcc-file-name)'/specs
This are NOT supposed to be single quotes but `backticks`. So this line will not accomplish what it is intended to do. Alternatively you can also type:

Code:
SPECS=$(dirname $(LFS_TGT-gcc -print-libgcc-file-name))/specs
This should also accomplish the same as the `backticks`-version.
 
Old 01-30-2010, 05:42 PM   #3
steviebob
Member
 
Registered: Jan 2010
Location: Arkansas
Distribution: Slackware-Current, LFS
Posts: 136

Original Poster
Rep: Reputation: 16
Alright, I followed what you said and used backticks instead of quotes, but the same thing came up, I got the message "bash: i686-lfs-linux-gnu-gcc: command not found" again, but then also got one more, "dirname: missing operand"
Here is exactly what I got from it:
Code:
lfs:~/tools/>> SPECS=`dirname $($LFS_TGT-gcc -print-libgcc-file-name)`/specs
bash: i686-lfs-linux-gnu-gcc: command not found
dirname: missing operand
Try `dirname --help' for more information.
 
Old 01-30-2010, 05:52 PM   #4
crts
Senior Member
 
Registered: Jan 2010
Posts: 2,020

Rep: Reputation: 757Reputation: 757Reputation: 757Reputation: 757Reputation: 757Reputation: 757Reputation: 757
What is the result of

Code:
echo $LFS_TGT
and
Code:
$LFS_TGT-gcc -print-libgcc-file-name
 
Old 01-30-2010, 05:55 PM   #5
steviebob
Member
 
Registered: Jan 2010
Location: Arkansas
Distribution: Slackware-Current, LFS
Posts: 136

Original Poster
Rep: Reputation: 16
Code:
lfs:~/tools/>> echo $LFS_TGT
i686-lfs-linux-gnu
lfs:~/tools/>> $LFS_TGT-gcc -print-libgcc-file-name
bash: i686-lfs-linux-gnu-gcc: command not found
Here it is
 
Old 01-30-2010, 06:08 PM   #6
crts
Senior Member
 
Registered: Jan 2010
Posts: 2,020

Rep: Reputation: 757Reputation: 757Reputation: 757Reputation: 757Reputation: 757Reputation: 757Reputation: 757
Quote:
Originally Posted by steviebob View Post
Code:
lfs:~/tools/>> echo $LFS_TGT
i686-lfs-linux-gnu
lfs:~/tools/>> $LFS_TGT-gcc -print-libgcc-file-name
bash: i686-lfs-linux-gnu-gcc: command not found
Here it is
This is weird. I build my LFS according to a subversion of the 6.3 book. And also in the 'original' book at this point you only have to use just gcc, i.e.

Code:
SPECS=`dirname $(gcc -print-libgcc-file-name)`/specs
Can you try this?
 
Old 01-30-2010, 06:13 PM   #7
crts
Senior Member
 
Registered: Jan 2010
Posts: 2,020

Rep: Reputation: 757Reputation: 757Reputation: 757Reputation: 757Reputation: 757Reputation: 757Reputation: 757
... and before you continue what is the result of

Code:
gcc -print-libgcc-file-name
 
Old 01-30-2010, 06:19 PM   #8
crts
Senior Member
 
Registered: Jan 2010
Posts: 2,020

Rep: Reputation: 757Reputation: 757Reputation: 757Reputation: 757Reputation: 757Reputation: 757Reputation: 757
Ok, I read a little bit in the 6.5 book. In chapter 5.5.2 you have the following command

Code:
ln -vs libgcc.a `$LFS_TGT-gcc -print-libgcc-file-name | \
    sed 's/libgcc/&_eh/'`
Is it possible that you might have confused the `backticks` with 'single quotes' already at this early stage?

Last edited by crts; 01-30-2010 at 06:21 PM.
 
Old 01-30-2010, 06:20 PM   #9
steviebob
Member
 
Registered: Jan 2010
Location: Arkansas
Distribution: Slackware-Current, LFS
Posts: 136

Original Poster
Rep: Reputation: 16
well, that DID work, but when I go and check the "system sanity", the output for the test is nothing at all. Blank. Zippo. Nada. I'll try and reinstall everything, and see if that fixes it. Wish me luck
 
Old 01-30-2010, 06:21 PM   #10
steviebob
Member
 
Registered: Jan 2010
Location: Arkansas
Distribution: Slackware-Current, LFS
Posts: 136

Original Poster
Rep: Reputation: 16
Quote:
Originally Posted by crts View Post
... and before you continue what is the result of

Code:
gcc -print-libgcc-file-name
The results of this is
Code:
/usr/lib/gcc/i486-slackware-linux/4.3.3/libgcc.a
 
Old 01-30-2010, 06:24 PM   #11
steviebob
Member
 
Registered: Jan 2010
Location: Arkansas
Distribution: Slackware-Current, LFS
Posts: 136

Original Poster
Rep: Reputation: 16
and if it helps, the result of
Code:
echo $LFS_TGT
is
Code:
i686-lfs-linux-gnu
 
Old 01-30-2010, 06:30 PM   #12
steviebob
Member
 
Registered: Jan 2010
Location: Arkansas
Distribution: Slackware-Current, LFS
Posts: 136

Original Poster
Rep: Reputation: 16
Quote:
Originally Posted by crts View Post
Ok, I read a little bit in the 6.5 book. In chapter 5.5.2 you have the following command

Code:
ln -vs libgcc.a `$LFS_TGT-gcc -print-libgcc-file-name | \
    sed 's/libgcc/&_eh/'`
Is it possible that you might have confused the `backticks` with 'single quotes' already at this early stage?
woops, didn't see this post at first. I just tried that, and again I get the same "bash:i686..." reply. I'll backtrack and hope it helps
 
Old 01-30-2010, 07:46 PM   #13
crts
Senior Member
 
Registered: Jan 2010
Posts: 2,020

Rep: Reputation: 757Reputation: 757Reputation: 757Reputation: 757Reputation: 757Reputation: 757Reputation: 757
Hi again,

I did some further reading. So appearently in 6.5 a key step is to build a cross compiler. This is done in 5.5.1 via

Code:
../gcc-4.4.1/configure \
    --target=$LFS_TGT --prefix=/tools \
    --disable-nls --disable-shared --disable-multilib \
    --disable-decimal-float --disable-threads \
    --disable-libmudflap --disable-libssp \
    --disable-libgomp --enable-languages=c
The '--target' option is crucial at this point. It tells the compiler to configure for a cross-compiler. After compilation your cross-compiler will have the name "$LFS_TGT-gcc". So when you get a 'command not found' at this point you probably forgot the --target option or maybe LFS_TGT wasn't defined at this point - which it should have been. Or maybe it got installed somewhere outside your PATH.
Whatever, you need to pay close attention to this option. It is used in every package configuration while building the toolchain - also in binutils build one step before gcc. Hope this helps and good luck with your new build.

Last edited by crts; 01-30-2010 at 07:47 PM.
 
Old 01-30-2010, 08:49 PM   #14
steviebob
Member
 
Registered: Jan 2010
Location: Arkansas
Distribution: Slackware-Current, LFS
Posts: 136

Original Poster
Rep: Reputation: 16
Quote:
Originally Posted by crts View Post
Hi again,

I did some further reading. So appearently in 6.5 a key step is to build a cross compiler. This is done in 5.5.1 via

Code:
../gcc-4.4.1/configure \
    --target=$LFS_TGT --prefix=/tools \
    --disable-nls --disable-shared --disable-multilib \
    --disable-decimal-float --disable-threads \
    --disable-libmudflap --disable-libssp \
    --disable-libgomp --enable-languages=c
The '--target' option is crucial at this point. It tells the compiler to configure for a cross-compiler. After compilation your cross-compiler will have the name "$LFS_TGT-gcc". So when you get a 'command not found' at this point you probably forgot the --target option or maybe LFS_TGT wasn't defined at this point - which it should have been. Or maybe it got installed somewhere outside your PATH.
Whatever, you need to pay close attention to this option. It is used in every package configuration while building the toolchain - also in binutils build one step before gcc. Hope this helps and good luck with your new build.
Sigh. Alright. I tried what you just said, and recompiled (well, tried to, actually) gcc-4.4.1, but there is only one slight problem. I create a new directory for configuration, go the the source directory, do "make distclean", go back and actually configure gcc, and all goes well up to this point. I'm not a very good debugging person, so I'll need some help with this one. Whenever I run "make", everything goes fine for a while, but I get three errors, as far as I can tell, then it quits. Here is what actually comes up in the terminal:
Code:
build/genmodes -h > tmp-modes.h
/bin/sh: build/genmodes: No such file or directory
make[2]: *** [s-modes-h] Error 127
make[2]: Leaving directory `/mnt/lfs/gcc-build/gcc'
make[1]: *** [all-gcc] Error 2
make[1]: Leaving directory `/mnt/lfs/gcc-build'
make: *** [all] Error 2
I wish I could fend for myself more, but that's why I'm here, to learn, right?

Last edited by steviebob; 01-30-2010 at 08:51 PM.
 
Old 01-30-2010, 09:47 PM   #15
crts
Senior Member
 
Registered: Jan 2010
Posts: 2,020

Rep: Reputation: 757Reputation: 757Reputation: 757Reputation: 757Reputation: 757Reputation: 757Reputation: 757
Did you just recompile GCC or did you also recompile binutils?
This might sound frustrating now, but maybe you should start with a fresh formatted partition. This is far better than ending up with a corrupted toolchain. You wouldn't be able to build the 'real' LFS-system in chapter 6 and probably wouldn't think that it might be your toolchains fault.
So it might be best to start over.

- Make sure your system fulfills the minimum requirements as stated at the beginning of the book

- User lfs is set up correctly, i.e. /tools/bin is the first directory in his PATH variable etc.

- All variables are defined, especially LFS and LFS_TGT.

- Pay close attention to the `backticks` issue and do not forget the --target option.

Follow the book step by step and do not deviate from it.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
chroot problem in linux from scratch (version 6.4) chapter 6.4, the transition... jason87x Linux - Software 1 07-05-2009 10:22 PM
suse linux boot cd problem -> tried the newb section but no solution suse-benno Linux - General 3 08-24-2005 03:11 PM
linux from scratch build with linux-2.6.11 and my pktsetup problem! behmjoe Linux - Software 8 04-02-2005 03:32 AM
ali aladdin v agp stinks :scratch: :scratch: :scratch: Mr Marmmalade Linux - Hardware 1 07-08-2003 05:11 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Linux From Scratch

All times are GMT -5. The time now is 01:31 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration