Linux From ScratchThis 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
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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:
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
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:
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.
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.
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
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.
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:
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.