LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
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 06-07-2011, 11:23 AM   #1
MTK358
LQ 5k Club
 
Registered: Sep 2009
Posts: 6,443
Blog Entries: 3

Rep: Reputation: 723Reputation: 723Reputation: 723Reputation: 723Reputation: 723Reputation: 723Reputation: 723
Failed to build glibc, VirtualBox 32-bit question


I started to try building LFS again, and I created a 32-bit VM in VirtualBox. I have gone all the way to glibc pass 1 before I realized that the LFS live CD image I had is 64-bit! I went back and redid the 64-bit specific steps that I skipped (I hope the order wasn't important).

The strange part is that everything seems to work fine (The host CPU and OS are 64-bit, and the CPU supports hardware virtualization). I would really want to aviod having to redo this since I already spent so much time on it.

Also, I'm stuck because I get an error when running make on glibc (screenshot in attachment). How do I fix it, and could it have anything to do with what I mensioned above?
Attached Thumbnails
Click image for larger version

Name:	vbox-lfs.jpeg
Views:	32
Size:	148.5 KB
ID:	7244  
 
Old 06-07-2011, 02:13 PM   #2
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405
Hi,

Quote:
.../ld: cannot find -lgcc_eh
This is most often due to a missing symlink. Did you forget to run the ln command (last command gcc pass 1), or is/was $LFS_TGT set correctly?

Hope this helps.

BTW: If you created a 32 bit VM, shouldn't your LFS build reflect that? Strange indeed! What does $(uname -m)-lfs-linux-gnu show?

Hope this helps.
 
Old 06-07-2011, 02:49 PM   #3
MTK358
LQ 5k Club
 
Registered: Sep 2009
Posts: 6,443

Original Poster
Blog Entries: 3

Rep: Reputation: 723Reputation: 723Reputation: 723Reputation: 723Reputation: 723Reputation: 723Reputation: 723
Quote:
Originally Posted by druuna View Post
This is most often due to a missing symlink. Did you forget to run the ln command (last command gcc pass 1), or is/was $LFS_TGT set correctly?
If you mean this one (on page 35):

Code:
ln -vs libgcc.a `$LFS_TGT-gcc -print-libgcc-file-name | \
sed 's/libgcc/&_eh/'`
, then yes. I ran it inside the gcc build directory. I most likely ran it like this but it shouldn't make any difference:

Code:
ln -vs libgcc.a $($LFS_TGT-gcc -print-libgcc-file-name | sed 's/libgcc/&_eh/')
Note that everywhere else they use $(), but here they used backticks. Is that an error?

Quote:
Originally Posted by druuna View Post
BTW: If you created a 32 bit VM, shouldn't your LFS build reflect that? Strange indeed! What does $(uname -m)-lfs-linux-gnu show?
Code:
$ echo $(uname -m)-lfs-linux-gnu
x86_64-lfs-linux-gnu
The attached screenshot shows the relevant VirtualBox settings.
Attached Thumbnails
Click image for larger version

Name:	vbox-settings.jpeg
Views:	23
Size:	25.1 KB
ID:	7245  

Last edited by MTK358; 06-07-2011 at 02:53 PM.
 
Old 06-08-2011, 05:35 AM   #4
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405
Hi,
Quote:
Originally Posted by MTK358 View Post
If you mean this one (on page 35):

Code:
ln -vs libgcc.a `$LFS_TGT-gcc -print-libgcc-file-name | \
sed 's/libgcc/&_eh/'`
, then yes. I ran it inside the gcc build directory. I most likely ran it like this but it shouldn't make any difference:

Code:
ln -vs libgcc.a $($LFS_TGT-gcc -print-libgcc-file-name | sed 's/libgcc/&_eh/')
Note that everywhere else they use $(), but here they used backticks. Is that an error?
This should not be a problem, I do believe that the using $(...) is even preferred nowadays.

Did you check to see if lgcc_eh is actually present and reachable?

If you are sure nothing went wrong during the previous 3 packages that where build: Have you seen this post: Getting past 'cannot find -lgcc_eh' and 'inlining failed in call to 'syslog'' errors. Bit old and it might not work with the current LFS version, but you might want to give it a try.

Quote:
Code:
$ echo $(uname -m)-lfs-linux-gnu
x86_64-lfs-linux-gnu
The attached screenshot shows the relevant VirtualBox settings.
I assume you used a gui to set up this virtual client, maybe it did not force a 32 bit environment. Looking at the output of the above command I'm pretty sure it shouldn't cause problems.

BTW: I'm assuming you are building LFS 6.8 Stable.
 
Old 06-08-2011, 06:40 AM   #5
MTK358
LQ 5k Club
 
Registered: Sep 2009
Posts: 6,443

Original Poster
Blog Entries: 3

Rep: Reputation: 723Reputation: 723Reputation: 723Reputation: 723Reputation: 723Reputation: 723Reputation: 723
Quote:
Originally Posted by druuna View Post
This should not be a problem, I do believe that the using $(...) is even preferred nowadays.
Should it be reported as an error to the authors of the LFS book? Everywhere else they use $(), but here they used backticks.

Quote:
Originally Posted by druuna View Post
Did you check to see if lgcc_eh is actually present and reachable?
I don't even understand what "libgcc_eh" is.

No, I didn't see that post, but before trying the command I wanted to ask something. That post says this:

Code:
gcc -print-libgcc-file-name
, while the LFS book says this:

Code:
$LFS_TGT-gcc -print-libgcc-file-name
. Which one is correct?

Quote:
Originally Posted by druuna View Post
I assume you used a gui to set up this virtual client, maybe it did not force a 32 bit environment. Looking at the output of the above command I'm pretty sure it shouldn't cause problems.
Yes, I did use the VirtualBox GUI.

Quote:
Originally Posted by druuna View Post
I'm assuming you are building LFS 6.8 Stable.
That's right.
 
Old 06-08-2011, 07:19 AM   #6
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405
Hi,
Quote:
Originally Posted by MTK358 View Post
Should it be reported as an error to the authors of the LFS book? Everywhere else they use $(), but here they used backticks.
This isn't the only place that backtics are used, although $( ) is used much more often. Not an error in my opinion, just team members using "their" default.

The link with the possible solution I posted is based on an older LFS version (I'm not even sure if LFS_TGT was already being used in that version). If you read the complete thread and the link to the lfs mailing list you probably get the same feeling I have: This was during the transition period from 32 bit only to the mixed 32/64 bit that is used nowaday (at least LFS versions 6.7 and 6.8).

The following is probably a bold assumptions: This being your first (second?) attempt to build an LFS system I'm pretty sure that you made a mistake in one of the previous chapters. Your not that far into the build yet, and I would suggest starting over, just to make sure all was done the way it should and just in case: Don't change commands given in the book, even if it looks like the edited command does the same.

Starting to hack the build this early just doesn't feel good (no hacking should be needed at all.....) and if new errors start to appear at a later stage you'll always wonder if the cause was chapter 5 glibc.

Probably not what you expected to read, but hope it helps.
 
Old 06-08-2011, 07:36 AM   #7
MTK358
LQ 5k Club
 
Registered: Sep 2009
Posts: 6,443

Original Poster
Blog Entries: 3

Rep: Reputation: 723Reputation: 723Reputation: 723Reputation: 723Reputation: 723Reputation: 723Reputation: 723
This is actaully my third or fourth LFS attempt.

I decided to restart from compiling binutils, since I had made some likely errors and mistakes since then.

I also wrote a script that takes a file with a sequence of commands and runs them in order. If one fails, it stops and tells me what command line options to use to resume from that point. I decided that I'll use it this time, and it's really making the whole process easy. I'm already more than half way done with pass 1!
 
Old 06-08-2011, 08:02 AM   #8
MTK358
LQ 5k Club
 
Registered: Sep 2009
Posts: 6,443

Original Poster
Blog Entries: 3

Rep: Reputation: 723Reputation: 723Reputation: 723Reputation: 723Reputation: 723Reputation: 723Reputation: 723
I completed Pass 1 successfully! I'll post here is something goes wrong that I can't figure out.
 
Old 06-08-2011, 09:35 AM   #9
MTK358
LQ 5k Club
 
Registered: Sep 2009
Posts: 6,443

Original Poster
Blog Entries: 3

Rep: Reputation: 723Reputation: 723Reputation: 723Reputation: 723Reputation: 723Reputation: 723Reputation: 723
Now I get this error when configuring pass 2 of binutins:
Attached Thumbnails
Click image for larger version

Name:	lfs-binutils-configure-failed.jpeg
Views:	28
Size:	118.9 KB
ID:	7248  
 
Old 06-08-2011, 10:47 AM   #10
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405
Hi,

Did you encounter any errors while doing the Adjusting the Toolchain chapter (especially the checks in the caution box)?

At this point (Binutils-2.21 - Pass 2) you are partially using what you have build before, which is set by the adjusting the toolchain chapter. If binutils pass 2 fails one of the previous three packages (or a combination or all) did not install correctly (the three packages being: binutils, gcc, or glibc).

This is a show-stopper and it does need to be resolved before you continue.

Hope this helps.
 
Old 06-08-2011, 11:11 AM   #11
MTK358
LQ 5k Club
 
Registered: Sep 2009
Posts: 6,443

Original Poster
Blog Entries: 3

Rep: Reputation: 723Reputation: 723Reputation: 723Reputation: 723Reputation: 723Reputation: 723Reputation: 723
Quote:
Originally Posted by druuna View Post
Did you encounter any errors while doing the Adjusting the Toolchain chapter (especially the checks in the caution box)?
No. But there's another error that I noticed that wouldn't be caught if I followed the instructions exactly. For some reason, the compiled executable doesn't execute! Bash says that the file isn't there (even though tab completion does see it) (see the attached screenshot)!

It works fine if I use the GCC that came with the LFS live CD, though:

Code:
$ /usr/bin/gcc test.c -o test
$ ./test
Hello, World!
Attached Thumbnails
Click image for larger version

Name:	screenshot.jpeg
Views:	28
Size:	83.4 KB
ID:	7249  

Last edited by MTK358; 06-08-2011 at 11:13 AM.
 
Old 06-08-2011, 11:16 AM   #12
crts
Senior Member
 
Registered: Jan 2010
Posts: 2,020

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

in your initial post you say that your VM is a 32-bit architecture but you are using the 64-bit liveCD. I wonder if this might be a possible source of trouble.
I remember that I also build my first LFS with a 64-bit liveCD. However, it had its own modified LFS-book "onboard". IIRC, there were some differences to the original LFS.

So, if I understood correctly so far, then you are using an unofficial liveCD with the official LFS book. I am not saying that this is wrong. Just trying to point out some other possible sources of trouble.

So I guess my advise at this point is to keep it as simple as possible and use the official 32-bit liveCD with a 32-bit VM and with the official LFS book. Maybe even build an older version of LFS that definitely works with the liveCD, since the liveCD is pretty old. My last LFS with the liveCD was 6.6.

Quote:
For some reason, the compiled executable doesn't execute! Bash says that the file isn't there (even though tab completion does see it)!
This usually means that it cannot find its linker. What is the output of
Code:
ldd a.out
[EDIT]
Just saw your EDIT. Do you have a /tools/lib64 directory? If not then try creating a symlink
/tools/lib64 -> /tools/lib

And of course run 'ldd' on test and not a.out.

Last edited by crts; 06-08-2011 at 11:19 AM.
 
Old 06-08-2011, 11:26 AM   #13
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405
Hi,

Quote:
readelf -l a.out | grep ': /tools'
[Requesting program interpreter: /tools/lib64/ld-linux-x86-64.so.2]
The green part is not what the book example shows, but is correct as explained in the book. The red part isn't correct, that does need to say ld-linux.so.2.

You've been trying to build LFS by automating it. I would advise not automating and doing it by hand. I've automated the LFS build and found out that some of the commands/actions shown in the book need special care when you automate them. I too tried (half) automating when I did my first build and failed miserably...... Only after knowing what was done in the book by doing it all by hand (twice, during my second build I started adjusting things to my likings and got an even better understanding) I was able to script LFS.

It also made sure that I knew which errors where LFS related and which script related.

BTW: Do make a backup once you finish chapter 5! It would be too bad if something went wrong during chapter 6 and you had to start all over again. With a backup you can delete all, restore the backup and start from the top of chapter 6 again.

Hope this helps.

EDIT: Just noted your edit.

It did NOT work! You are not supposed to use the gcc that came with liveCD at this point!!

Last edited by druuna; 06-08-2011 at 11:27 AM.
 
Old 06-08-2011, 12:18 PM   #14
MTK358
LQ 5k Club
 
Registered: Sep 2009
Posts: 6,443

Original Poster
Blog Entries: 3

Rep: Reputation: 723Reputation: 723Reputation: 723Reputation: 723Reputation: 723Reputation: 723Reputation: 723
Quote:
Originally Posted by crts View Post
I remember that I also build my first LFS with a 64-bit liveCD. However, it had its own modified LFS-book "onboard". IIRC, there were some differences to the original LFS.

So, if I understood correctly so far, then you are using an unofficial liveCD with the official LFS book. I am not saying that this is wrong. Just trying to point out some other possible sources of trouble.
I'm using the PDF version of the LFS book 6.8. I downloaded it the day before yesterday. The Live CD did come with the LFS book, but I hate having to use command-line browsers. Having the PDF version on Okular is so much nicer, and the table of contents in the sidebar is very handy.

The Live CD is the official 64-bit LFS Live CD. It might not be the newest, though, since I downloaded it a few months ago. If I had to start over, I would definitely get the newest 32-bit official LFS Live CD.

Quote:
Originally Posted by crts View Post
This usually means that it cannot find its linker. What is the output of
Code:
ldd a.out
Code:
$ ldd test
        not a dynamic executable
Quote:
Originally Posted by crts View Post
Just saw your EDIT. Do you have a /tools/lib64 directory? If not then try creating a symlink
/tools/lib64 -> /tools/lib
I checked, and both /tools/lib and /tools/lib64 exist, and they have different contents! Maybe I really need to just start over, this time with the 32-bit CD.

Quote:
Originally Posted by druuna View Post
You've been trying to build LFS by automating it. I would advise not automating and doing it by hand. I've automated the LFS build and found out that some of the commands/actions shown in the book need special care when you automate them. I too tried (half) automating when I did my first build and failed miserably...... Only after knowing what was done in the book by doing it all by hand (twice, during my second build I started adjusting things to my likings and got an even better understanding) I was able to script LFS.
The reason I wanted to automate it is because my last attempts failed because I had to do so much waiting between commands, and I kept screwing it up, until I got so bored and frustrated that I just decided to give up.

So before staring, I decided to write a big shell script that takes an input file of commands, and runs them automatically, and (unlike a normal shell script) lets me step in, fix the problem, and resume if something fails. It also meant that it's not such a big deal to do a huge part all over again, since the script takes care of it.

I tried doing pass 1 manually, and found out that I messed it up after spending a few hours on it. So decided to use my automation script, and I completed pass 1 in a matter of minutes with minimal intervention.

Then I spent a long time writing an input file for my automation script that would complete pages 61-91 of the LFS book all on its own. And the point where it failed is when that script got to configuring binutils.

I'm still tempted to use my automation scripts even I have to start over, since I spent a lot of time and effort writing them and they really made the process easier. Maybe I should use them slightly less (especially for the more fragile parts), or thoroughly review them to make sure they don't have any mistakes/typos?

Quote:
Originally Posted by druuna View Post
BTW: Do make a backup once you finish chapter 5! It would be too bad if something went wrong during chapter 6 and you had to start all over again. With a backup you can delete all, restore the backup and start from the top of chapter 6 again.
I use VirtualBox's "snapshot" feature after every significan milestone and before I shut it down for te night (it's a Live CD, and if I reboot I will lose everything from the "setting up the environment" part)

Quote:
Originally Posted by druuna View Post
It did NOT work! You are not supposed to use the gcc that came with liveCD at this point!!
?????????

Last edited by MTK358; 06-08-2011 at 12:21 PM. Reason: Typo
 
Old 06-08-2011, 12:25 PM   #15
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405
Hi,
Quote:
Originally Posted by MTK358 View Post
Quote:
Originally Posted by druuna
It did NOT work! You are not supposed to use the gcc that came with liveCD at this point!!
?????????
Forget about that comment. Re-reading it it seems I misunderstood. I thought your solution was using the gcc from the liveCD and thought al was well.
 
  


Reply

Tags
flags, glibc, lfs, make


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Upcoming pain with glibc-2.14 and Linux-PAM: RPC build supt. is removed from glibc! JoelPB Linux From Scratch 6 12-13-2011 06:31 AM
ERROR:During Making of glibc-build(GLIBC-2.12.1) gau190188 Linux From Scratch 1 01-04-2011 05:19 AM
64-bit VirtualBox host running a single 32-bit guest, good idea? FireRaven Linux - Virtualization and Cloud 10 04-03-2010 03:21 PM
Puzzling glibc-build question... sundialsvcs Linux From Scratch 2 09-18-2005 09:30 AM

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

All times are GMT -5. The time now is 01:59 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