LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux From Scratch (https://www.linuxquestions.org/questions/linux-from-scratch-13/)
-   -   LFS- Adjusting the Toolchain problem (https://www.linuxquestions.org/questions/linux-from-scratch-13/lfs-adjusting-the-toolchain-problem-727738/)

LinuxNewman 05-22-2009 03:51 AM

LFS- Adjusting the Toolchain problem
 
Hi All,
I am following LFS-version 6.4 and the host system is SuSE 11.0.
Everything was successful till installing Glibc(section 5.7).Then I entered the section 5.8 Adjusting the Toolchain.
When I did :
gcc -dumpspecs | sed 's@/lib/ld-linux.so.2@/tools&@g' \
> `dirname $(gcc -print-libgcc-file-name)`/specs

I got the following error :

sed: can't read /mnt/point1/tools/bin/../lib/gcc/i686-pc-linux-gnu/4.3.2/specs : No such file or directory.

(NOTE: my LFS partition is /dev/sda4 mounted on /mnt/point1 )

Then I decided to ignore it and went ahead with next instructions.After a while,as soon as I typed:
echo 'main(){}' > dummy.c
cc dummy.c

it showed the error:

cc: unrecognized option '-mtune=generic'

Please tell me what to do.

druuna 05-22-2009 04:00 AM

Hi,

Did you copy/paste the gcc -dumpspecs | sed 's@..... or type it yourself?
The > in this one-liner is for redirection and _not_ your PS2 prompt.

I personally think it is a bad breakpoint for a one-liner, maybe you should try this instead:

gcc -dumpspecs | sed 's@/lib/ld-linux.so.2@/tools&@g' > `dirname $(gcc -print-libgcc-file-name)`/specs

If that doesn't help, what happens when you execute this: dirname $(gcc -print-libgcc-file-name) (part of the one-liner).

LinuxNewman 05-22-2009 04:59 AM

Thanks Druuna,
I had typed it and thought that it is a line change.So, it was wrong.Then I copied and pasted it and got error.At last I wrote what you told me to write and it worked ! A specs file was generated.

Then I proceeded to next instruction :
GCC_FIXED=`dirname $(gcc -print-libgcc-file-name)`/include-fixed &&
find ${GCC_FIXED}/* -maxdepth 0 -xtype d -exec rm -rvf '{}' \; &&
rm -vf `grep -l "DO NOT EDIT THIS FILE" ${GCC_FIXED}/*` &&
unset GCC_FIXED

And got the following error :

grep: /mnt/point1/tools/bin/../lib/gcc/i686-pc-linux-gnu/4.3.2/include-fixed/ssl
:No such file or directory

I went to that directory and saw that there is broken file called ssl.

Now can you please tell me what went wrong?I tried to type it and copy-paste it.Both cases had same error.
Thanks.

druuna 05-22-2009 07:32 AM

Hi,

In your first post you mention executing the echo 'main(){}' > dummy.c and cc dummy.c parts. Did you execute the GCC_FIXED=`dirname $(gcc ...... unset GCC_FIXED part as well? If so, you already removed (that's what the GCC_FIXED part does, it removes certain dirs and files) certain parts.

I'm not sure what dirs and files should be removed, but if I take a look at /x/y/tools/bin/../lib/gcc/i686-pc-linux-gnu/4.3.2/include-fixed/ there are only 3 files present: README limits.h and syslimits.h. But that is on a box that has a fully functional LFS 6.4.

Maybe you should start over with chapter 5, just to make sure.

BTW: You did check to see if Suse 11.0 is suitable as host?? (http://www.linuxfromscratch.org/lfs/.../hostreqs.html)

LinuxNewman 05-25-2009 12:15 AM

Yes, I had executed the "GCC_FIXED=`dirname $(gcc ...... unset GCC_FIXED" part as well. You are right.It might have removed something. Now I am going to start again from chapter 5.

LinuxNewman 05-26-2009 02:03 AM

Hi All,
I started again and this time I took all the care and went ahead for a loner distance than before.Till section 5.13, there was no problem and everything went without showing errors.Even sanity checks worked this time.
The problem started when I reached section 5.14 Ncurses-5.6 . When I copied and pasted the following command :

./configure --prefix=/tools --with-shared \
--without-debug --without-ada --enable-overwrite

I got the following error :

(these are last few lines, I can provide more if you want)

checking if you want to build a separate terminfo library... no
checking if you want to link with the GPM mouse library... maybe
checking for gpm.h... yes
checking for Gpm_Open in _lgpm... no
configure: error: cannot link with GPM library

What went wrong here? How to solve it?
NOTE: I had deleted all the older build directories.

druuna 05-26-2009 02:17 AM

Hi,

These errors (both toolchain and ncurses) shouldn't happen. I've installed LFS 6.4 more then once and neven encountered these before.

One thing that I can come up with that could cause all of these problems (and a question you haven't answered yet): Is Suse 11.0 suitable as a base for LFS?

I always use the LFS liveCD as base, maybe you should too. This liveCD was created to be a suitable host.

LinuxNewman 05-27-2009 10:18 PM

I checked that SuSE 11.0 is good for being a host by running the instructions given in "Host system requirements".

Do you have any other clue about what went wrong?

druuna 05-28-2009 02:32 AM

Hi,

I do see something in post #6 that shouldn't be there: gpm entries (to be more precise: the linking of gpm).

At this stage gpm should not be available at all and it should skip it with no instead of maybe (checking if you want to link with the GPM mouse library... maybe).

What does the following show you (as lfs user):

echo | gcc -v -x c - 2>&1 | sed -n '/^#include/,/End of search list/p'

The output should be something like:
/home/build/tools/bin/../lib/gcc/i686-pc-linux-gnu/4.1.2/include
/tools/include


and

gcc -dumpspecs | grep "ld-linux.so.2"

The output should be:
/tools/lib/ld-linux.so.2

If either of them come up with different/more output, then probably something went wring with gcc pass 2 and/or adjusting the toolchain.

LinuxNewman 06-02-2009 01:44 AM

I had run the instructions mentioned by you and got totally different outputs. So, I decided to start the second pass of gcc again. This time I got no problems.I did chapter 5 successfully and I am doing now the sixth one.
If I find any problem,I will post it here again.Thank you for the help :-)

druuna 06-02-2009 02:17 AM

Hi,

Glad to read that things are ok now!

LinuxNewman 06-04-2009 03:55 AM

Hi !
Now I am in chapter 8.3.1. Installation of the kernel
Here it is told to run the following command :
make LANG=<host_LANG_value> LC_ALL= menuconfig

It also tells to : "Be sure to replace <host_ LANG_ value> by the value of the $LANG variable from your host. If not set, you
could use instead the host's value of $LC_ ALL or $LC_ CTYPE."

I tried to do echo for $LANG,$LC_ALL and $LC_CTYPE.But,nothing was displayed.So, what should I replace "<host_ LANG_ value>" with? I am stuck with this instruction :-(

druuna 06-04-2009 04:06 AM

Hi,

I do not use the LANG settings at all during the kernel setup step. It is there to enable proper line drawings for the ncurses program (the menu itself).

The steps I take/took are these:

1) unpack kernel source and enter directory
2) make mrproper
3) make menuconfig
4) make
5) make modules_install
6) 'rest' of LFS chapter 8.3

If you have an 'old' working .config stored somewhere that you want to use, do the following between steps 2 and 3
a) copy the old .config file to the linux source directory
b) make oldconfig (just use the defaults given if you are not clear about certain options)
continue with step 3 from this point on.

Hope this clears things up a bit.

LinuxNewman 06-04-2009 04:24 AM

If we do "make modules_install", will there be need of initrd image? In LFS chapters, nothing is mentioned about initrd. How will it boot if it has modules but no initrd ?

druuna 06-04-2009 04:37 AM

Hi,

No initrd is needed.

There is an old lfs-hint file (initrd for LFS) you can look at if you do want/need initrd. Never tried it myself, I never needed initrd.

LinuxNewman 06-04-2009 04:48 AM

Thanks for the info :-)

Now I am on the verge of making menu.lst file. If I do anything wrong, I will be doomed to start it again. Can I just copy all the entries of the menu.lst file of my host system and add the LFS entry to it at last? This way, I can use both my host system and LFS.
Or else, do you have any suggestions?

druuna 06-04-2009 04:55 AM

Hi,

If grub is already present for your host system, you can add a lfs entry to it. That should work, I do hope you did think about that _before_ you did chapter 8.4. You do not need/want to do this chapter if you use the bootloader (probably grub) from your host. If you did do chapter 8.4, your current (host) bootloader is probably overwritten.......

BTW: You can always go back to LFS using the chroot method described in chapter 6.61 (you do need to be able to start your computer, be it your host or a liveCD).

LinuxNewman 06-04-2009 05:04 AM

Oh...god ! Now my host bootloader is overwritten. What should I do now? Is there no way out?

LinuxNewman 06-04-2009 05:07 AM

Hey..WAIT !! I did not do anything in chapter 8.4 . I was waiting for your reply. So, nothing is overwritten.

druuna 06-04-2009 05:10 AM

......... LOL ...... don't scare yourself like that ;)

LinuxNewman 06-04-2009 05:26 AM

LOL I get scared when something happens to grub and fstab. I have previous experience of doing wrong things in those two files and crashing my system.

Now I am in 9.3. Rebooting the System
Is it necessary to do all the umount like:
umount -v $LFS/dev/pts
umount -v $LFS/dev/shm
umount -v $LFS/dev
umount -v $LFS/proc
umount -v $LFS/sys

and other umounts mentioned? I suspect that it may do something wrong to my host system.Is it safe?

By the way, I have copied the grub and fstab files in the LFS partition.

druuna 06-04-2009 05:33 AM

Hi,

Quote:

and other umounts mentioned? I suspect that it may do something wrong to my host system.Is it safe?
You should unmount them, there is a small chance that you system will hang during the reboot if you don't. A hard reset will solve a hang.

Quote:

By the way, I have copied the grub and fstab files in the LFS partition.
All the grub related stuff in LFS is not needed if you use grub from your host. Depending on how fast you get confused, you could decide to remove the LFS related grub files, but that is up to you. No harm is done when the files stay installed.

LinuxNewman 06-04-2009 06:05 AM

lol...after doing this much in LFS, the result I get on rebooting is : a fully blank screen with last two LEDs of my keyboard flashing continuously !
Every test went correct.The LFS was installed correctly.Sigh...what happened now? Do you have any idea?

druuna 06-04-2009 06:20 AM

Hi again,

- Are you still able to boot into your host system?
- Does grub work (ie: no messages from grub about the new lfs entry)?
- No (error) messages, whatsoever?
- Are you sure you set up the (lfs) kernel correctly?

I personally think it is a kernel setting, but that is an assumption. Let's first try to find out if it is....

LinuxNewman 06-08-2009 01:35 AM

Hi !
I had wrong settings in the menu.lst file.When I corrected it, it started working. Still there are some things which I do not understand. So, I am telling you from the beginning what happens when I start the system.

When I power on, it gives 3 choices (2 are SuSe and the third is LFS).When I choose LFS, The system boots up and what I see is a series of checks which have [OK]. The it tells me to login. I use the name "root" and my password.Then it displays like this :
-bash-3.2#
I was exploring a bit and when I simply gave the command "su", the display became this:
bash-3.2#
This time, the "-" vanished !! What is its significance?

Now I am facing another problem. When I do "cd" into some directory, it goes inside the directory but, it does not show in the command prompt that is is there.For example :
-bash-3.2# cd newfolder
-bash-3.2# ls (note: although it is not showing, it is inside the folder this will become clear when I give the command "ls")

cprograms display.c display

Please tell me why is it not showing that it is inside that directory.

druuna 06-08-2009 04:04 AM

Hi again,

Glad to read you resolved the grub problem :)

Quote:

I was exploring a bit and when I simply gave the command "su", the display became this:
bash-3.2#
This time, the "-" vanished !! What is its significance?
Bot commands (su and su - are valid commands. You decide which one you need/want at the time (su - gives you a complete environment, su on the other hand keeps the environment of the user that has giving the command. Do take a look at su's manpage man su).

Quote:

When I do "cd" into some directory, it goes inside the directory but, it does not show in the command prompt that is is there.
How the prompt looks is a personal preference. Some like the 'default' prompt the distro gives you, other want something else completely.
Take a look at the Bash Prompt HOWTO page, this will give you an idea what is possible.

In general: After you finished LFS you have a very basic (but working) linux box. The next step would be BLFS, which holds all the goodies and also some pointers concerning (user) environment settings (chapter 3).

BLFS does not follow the same 'rules' as LFS: BLFS is a collection of software, you decide what you want and install those (including the dependencies, of course...). You don't need to start at chapter 4 and work your way al the way thru to the end. Do take a look at chapters 2 and 3.

LinuxNewman 06-08-2009 11:23 PM

I thank you for the help you have provided. I hope this thread will help somebody who is doing LFS and is new to Linux just like me. Doing LFS and getting your help in forums taught me many basic things. As you have suggested, I am planning to venture into BLFS. But before that, I have to complete the work I began.I am planning to develop a very small(about 16 to 20 MB) Linux system for embedded systems. Do you have any suggested readings?

druuna 06-09-2009 02:04 AM

Hi,

I don't have any experience with embedded (linux) systems, so I cannot help you there. I have seen thread on LQ that dealt with embedded systems so we (the LQ crowd) should be able to help with specific problems/questions.

There are some (very) small distro's around (take a look at distrowatch or feed your searchengine with: small linux distro), maybe you should take a look at those to get an idea how they are set up.

Hope you have fun with (B)LFS and the embedded system!


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