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 |
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.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
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.
|
|
|
06-07-2011, 12:23 PM
|
#1
|
LQ 5k Club
Registered: Sep 2009
Posts: 6,443
|
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?
|
|
|
06-07-2011, 03:13 PM
|
#2
|
LQ Veteran
Registered: Sep 2003
Posts: 10,532
|
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.
|
|
|
06-07-2011, 03:49 PM
|
#3
|
LQ 5k Club
Registered: Sep 2009
Posts: 6,443
Original Poster
|
Quote:
Originally Posted by druuna
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
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.
Last edited by MTK358; 06-07-2011 at 03:53 PM.
|
|
|
06-08-2011, 06:35 AM
|
#4
|
LQ Veteran
Registered: Sep 2003
Posts: 10,532
|
Hi,
Quote:
Originally Posted by MTK358
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.
|
|
|
06-08-2011, 07:40 AM
|
#5
|
LQ 5k Club
Registered: Sep 2009
Posts: 6,443
Original Poster
|
Quote:
Originally Posted by druuna
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
Did you check to see if lgcc_eh is actually present and reachable?
|
I don't even understand what "libgcc_eh" is.
Quote:
Originally Posted by druuna
|
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
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
I'm assuming you are building LFS 6.8 Stable.
|
That's right.
|
|
|
06-08-2011, 08:19 AM
|
#6
|
LQ Veteran
Registered: Sep 2003
Posts: 10,532
|
Hi,
Quote:
Originally Posted by MTK358
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.
|
|
|
06-08-2011, 08:36 AM
|
#7
|
LQ 5k Club
Registered: Sep 2009
Posts: 6,443
Original Poster
|
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!
|
|
|
06-08-2011, 09:02 AM
|
#8
|
LQ 5k Club
Registered: Sep 2009
Posts: 6,443
Original Poster
|
I completed Pass 1 successfully! I'll post here is something goes wrong that I can't figure out.
|
|
|
06-08-2011, 10:35 AM
|
#9
|
LQ 5k Club
Registered: Sep 2009
Posts: 6,443
Original Poster
|
Now I get this error when configuring pass 2 of binutins:
|
|
|
06-08-2011, 11:47 AM
|
#10
|
LQ Veteran
Registered: Sep 2003
Posts: 10,532
|
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.
|
|
|
06-08-2011, 12:11 PM
|
#11
|
LQ 5k Club
Registered: Sep 2009
Posts: 6,443
Original Poster
|
Quote:
Originally Posted by druuna
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!
Last edited by MTK358; 06-08-2011 at 12:13 PM.
|
|
|
06-08-2011, 12:16 PM
|
#12
|
Senior Member
Registered: Jan 2010
Posts: 2,020
|
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
[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 12:19 PM.
|
|
|
06-08-2011, 12:26 PM
|
#13
|
LQ Veteran
Registered: Sep 2003
Posts: 10,532
|
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 12:27 PM.
|
|
|
06-08-2011, 01:18 PM
|
#14
|
LQ 5k Club
Registered: Sep 2009
Posts: 6,443
Original Poster
|
Quote:
Originally Posted by crts
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
This usually means that it cannot find its linker. What is the output of
|
Code:
$ ldd test
not a dynamic executable
Quote:
Originally Posted by crts
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
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
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
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 01:21 PM.
Reason: Typo
|
|
|
06-08-2011, 01:25 PM
|
#15
|
LQ Veteran
Registered: Sep 2003
Posts: 10,532
|
Hi,
Quote:
Originally Posted by MTK358
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.
|
|
|
All times are GMT -5. The time now is 05:36 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|