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 01-30-2011, 03:47 PM   #1
ianll
LQ Newbie
 
Registered: Jan 2011
Posts: 18

Rep: Reputation: 2
Question LFS 6.7 Chapter 6.16 GCC-4.5.1 make fails


Hello all,
First off, here's what I'm using to build:
Host: Fedora 14
Arch: i686
LFS Book: 6.7

I have run into a problem while building my first LFS. Everything was running smoothly up to 6.16. GCC-4.5.1 where make failed for me. Here's the output from where I believe the error occurs:

Code:
Making all in po
make[4]: Entering directory `/sources/gcc-build/i686-pc-linux-gnu/libstdc++-v3/po'
msgfmt -o de.mo ../../../../gcc-4.5.1/libstdc++-v3/po/de.po
/tools/bin/msgfmt: line 61: /bin/sed: No such file or directory
/tools/bin/msgfmt: line 65: /bin/sed: No such file or directory
/tools/bin/msgfmt: line 118: cd: /mnt/lfs/sources/gettext-0.18.1.1/gettext-tools/src: No such file or directory
gcc: msgfmt-msgfmt.o: No such file or directory
gcc: msgfmt-write-mo.o: No such file or directory
gcc: msgfmt-write-java.o: No such file or directory
gcc: msgfmt-write-csharp.o: No such file or directory
gcc: msgfmt-write-resources.o: No such file or directory
gcc: msgfmt-write-tcl.o: No such file or directory
gcc: msgfmt-write-qt.o: No such file or directory
gcc: msgfmt-hash-string.o: No such file or directory
gcc: ./.libs/libgettextsrc.so: No such file or directory
gcc: /mnt/lfs/sources/gettext-0.18.1.1/gettext-tools/gnulib-lib/.libs/libgettextlib.so: No such file or directory
make[4]: *** [de.mo] Error 1
make[4]: Leaving directory `/sources/gcc-build/i686-pc-linux-gnu/libstdc++-v3/po'
make[3]: *** [all-recursive] Error 1
make[3]: Leaving directory `/sources/gcc-build/i686-pc-linux-gnu/libstdc++-v3'
make[2]: *** [all] Error 2
make[2]: Leaving directory `/sources/gcc-build/i686-pc-linux-gnu/libstdc++-v3'
make[1]: *** [all-target-libstdc++-v3] Error 2
make[1]: Leaving directory `/sources/gcc-build'
make: *** [all] Error 2

Here's what I have done to try and solve the problem:
- remove the gcc-{4.5.1,build} directories,
untar again and follow the instructions in the book.

- search the net for others with this problem.
Most people with GCC problems seem to fall down at pass 1.

- /tools/bin/msgfmt has a /bin/sed hardcoded in.
So I created a symlink to /tools/bin/sed
This eleviated the first two errors, but make still failed.

- /tools/bin/msgfmt has lots of references to "/mnt/lfs/sources/gettext-0.18.1.1/gettext-tools/" in the relink_command variable.
This makes me think that something went wrong with the "../gcc-4.5.1/configure --prefi..." command issued before make.
Not only should /mnt/lfs not be there since I'm in the chroot jail at the moment, but gettext-0.18.1.1 is not a directory in /sources since I removed it post install in Chapter 5.

Any help on where I may have gone wrong would be great - I understand that I may have missed something in the book even though I tried very hard to follow it exactly. I'd hate to have to start again!!! I do want to learn though.

Thanks,
Ian
 
Old 01-30-2011, 04:20 PM   #2
xeleema
Member
 
Registered: Aug 2005
Location: D.i.t.h.o, Texas
Distribution: Slackware 13.x, rhel3/5, Solaris 8-10(sparc), HP-UX 11.x (pa-risc)
Posts: 987
Blog Entries: 4

Rep: Reputation: 248Reputation: 248Reputation: 248
Greetingz!
Perhaps your $PATH is off? When you type "which sed", what do you get back?

Code:
Making all in po
make[4]: Entering directory `/sources/gcc-build/i686-pc-linux-gnu/libstdc++-v3/po'
msgfmt -o de.mo ../../../../gcc-4.5.1/libstdc++-v3/po/de.po
/tools/bin/msgfmt: line 61: /bin/sed: No such file or directory
/tools/bin/msgfmt: line 65: /bin/sed: No such file or directory
Maybe there's something amiss in /sources/gcc-build/i686-pc-linux-gnu/libstdc++-v3/po near Line 61 & 65.
 
Old 01-30-2011, 06:02 PM   #3
ianll
LQ Newbie
 
Registered: Jan 2011
Posts: 18

Original Poster
Rep: Reputation: 2
I think the PATH is ok.
Code:
$ echo $PATH
/bin:/usr/bin:/sbin:/usr/sbin:/tools/bin
Whcih is not installed in the chroot jail yet.
Code:
$ which sed
bash: which: command not found
Yep, sources/gcc-build/i686-pc-linux-gnu/libstdc++-v3/po is a directory, but the errors appear to be generated from within msgfmt. When I looked in /tools/bin/msgfmt, I saw that /bin/sed is hardcoded in there! That's when I decided to make a symlink in /bin. But alas, there are bigger problems, because /mnt/lfs/... is referenced lots of times in the relink_command within the msgfmt file.
:-(

Thanks all the same,
Ian
 
Old 01-30-2011, 06:10 PM   #4
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374
Hi,
Quote:
That's when I decided to make a symlink in /bin
??


If sed was not present in /bin in the first place, then you forgot to install it in chapter 5 (or something went wrong during the install). Chapter 6 makes use of what was installed in chapter 5.


EDIT: Oops...... I clearly wasn't thinking strait. Sorry.

Last edited by druuna; 01-31-2011 at 05:10 AM.
 
Old 01-30-2011, 06:57 PM   #5
ianll
LQ Newbie
 
Registered: Jan 2011
Posts: 18

Original Poster
Rep: Reputation: 2
If you're right then I don't understand a lot of what's in the LFS Book!

In Chapter 5.29. Sed-4.2.1, configure is called like this:
Code:
./configure --prefix=/tools
Doesn't that mean that sed will install itself into /tools/bin instead of /bin (which in chapter 5 would be on the hosts partition). In fact /bin in the chroot jail isn't even created until Chapter 6.5 when I have entered the chroot environment.

To be honest, I think it's ok that sed fails. The real killer of make appears to be the fact that msgfmt is referencing /mnt/lfs/... That's when make really dies.

Cheers for the help,
Ian
 
Old 01-31-2011, 01:05 AM   #6
crts
Senior Member
 
Registered: Jan 2010
Posts: 1,604

Rep: Reputation: 446Reputation: 446Reputation: 446Reputation: 446Reputation: 446
Hi,

my /tools/bin/msgfmt is a binary. At least it is in LFS 6.6 (uses gettext version 0.17). So I am not quite sure what you mean when you say that it has hardcoded /bin/sed etc. How did you determine that it has /bin/sed hardcoded in it? Can you post /tools/bin/msgfmt? The way you describe it appears to be a script. Maybe something went wrong during installation of gettext?
Quote:
Whcih is not installed in the chroot jail yet.
Try
type sed
instead. Should work since 'type' is a bash built-in. But I don't think that sed is the problem here since it is installed after gettext in chapter 5.
 
Old 01-31-2011, 02:52 AM   #7
ianll
LQ Newbie
 
Registered: Jan 2011
Posts: 18

Original Poster
Rep: Reputation: 2
Uh oh!

Right you are crts. msgfmt should be a binary file by the looks of things. It appears something went wrong when making it - I spotted one thing in lfs user's .bash_history

Code:
cd gettext-tools/
./configure --prefix=/tools --disable-shhared
make -C gnulib-lib
make -C src msgfmt
cp -v src/msgfmt /tools/bin
The configure line has "--disable-shhared" - I was obviously a bit tired when doing that. :-( I didn't notice if an error came up after configure either.

So I should probably try compiling that again, yeah?

From the host system, as user lfs and not in the chroot, I expanded the gettext tar again. Once changed into the gettext-tools directory, I ran configure, with this output now:

Code:
$ ./configure --prefix=/tools --disable-shared
checking for a BSD-compatible install... /tools/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /tools/bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking for gcc... gcc
checking whether the C compiler works... no
configure: error: in `/mnt/lfs/sources/gettext-0.18.1.1/gettext-tools':
configure: error: C compiler cannot create executables
See `config.log' for more details.
I looked up config.log to see what it had to say - I think this is the extract that matters most:

Code:
configure:4643: checking whether the C compiler works
configure:4665: gcc    conftest.c  >&5
/mnt/lfs/tools/bin/../lib/gcc/i686-pc-linux-gnu/4.5.1/../../../../i686-pc-linux-gnu/bin/ld: canno
t find -lgcc_s
collect2: ld returned 1 exit status
configure:4669: $? = 1
configure:4707: result: no
configure: failed program was:
| /* confdefs.h */
| #define PACKAGE_NAME ""
| #define PACKAGE_TARNAME ""
| #define PACKAGE_VERSION ""
| #define PACKAGE_STRING ""
| #define PACKAGE_BUGREPORT ""
| #define PACKAGE_URL ""
| #define PACKAGE "gettext-tools"
| #define VERSION "0.18.1"
| /* end confdefs.h.  */
| 
| int
| main ()
| {
| 
|   ;
|   return 0;
| }
configure:4712: error: in `/mnt/lfs/sources/gettext-0.18.1.1/gettext-tools':
configure:4716: error: C compiler cannot create executables
See `config.log' for more details.
After seeing that, I decided to try a dummy.c so did:
Code:
$ echo "main(){}" > dummy.c
$ cc dummy.c
/mnt/lfs/tools/bin/../lib/gcc/i686-pc-linux-gnu/4.5.1/../../../../i686-pc-linux-gnu/bin/ld: cannot find -lgcc_s
collect2: ld returned 1 exit status
So gcc is broken now by the looks of it.. heLP!!

Since I haven't managed to recompile GCC yet, why doesn't it still work? My guess is it's something to do with readjusting the toolchain in Chapter 6.10, but I'm just about grasping that stuff as it is.

I wonder would I be able to compile gettext from within the chroot environment... - Think I'll wait for more advice.

Thanks for the help,
Ian
 
1 members found this post helpful.
Old 01-31-2011, 04:07 AM   #8
crts
Senior Member
 
Registered: Jan 2010
Posts: 1,604

Rep: Reputation: 446Reputation: 446Reputation: 446Reputation: 446Reputation: 446
It is not that easy. As you already noticed, you have tweaked your toolchain in chapter 6.10. So before you can fix it you will have to do some adjustments to it. The last time I had to debug my toolchain was with LFS 6.3. And things were a bit different back then. So I am not sure if I can walk you 100%. Debugging the toolchain is tricky. Remote debugging via LQ is even trickier
The first thing you need to do before you try ANYTHING with your toolchain is to make a backup first! Even if your toolchain is not in a good state it is in a somewhat known state. So it is good to fall back to a known point if the fix is not successful. So always work with a copy.

The next thing you need to do is to change back ownership to user 'lfs' in your copy. Then switch to user 'lfs'. Since you have an installed OS as host and not a liveCD I assume that you won't have to recreate user 'lfs' and that you can work with user 'lfs'.
Issue the following commands (as user lfs)
Code:
mv -v /tools/bin/{ld,ld-new}
mv -v /tools/bin/{ld-old,ld}
mv -v /tools/$(gcc -dumpmachine)/bin/{ld-old,ld}
Now try compiling a test program and post the results
Code:
echo 'main(){}' > dummy.c
cc dummy.c
readelf -l a.out | grep ': /tools'
Also post the results of
Code:
gcc --print-libgcc-file-name
gcc -dumpspecs
 
Old 01-31-2011, 05:10 AM   #9
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374
Hi ianll,

Sorry about post #4, I clearly wasn't at the top of my game.
 
Old 02-05-2011, 07:11 AM   #10
ianll
LQ Newbie
 
Registered: Jan 2011
Posts: 18

Original Poster
Rep: Reputation: 2
[SOLVED] LFS 6.7 Chapter 6.16 GCC-4.5.1 make fails

@druuna - No worries - thanks for the help anyway.

@crts - As you said, adjusting the toolchain wouldn't be the easiest thing to do.

I took your advice to make a BACKUP and while doing that, remembered that I had already made two backups: before and after stripping in Chapter 5.32.

So, I decided to avoid learning too much and simply revert to that backup - I knew I wouldn't mind repeating the first 16 parts of Chapter 6 and that I would rather have my first LFS go smoothly.

I exited the chroot environment once I had completed the recommended backup from the host OS.

Unmounted the special devices:
Code:
umount $LFS/sys
umount $LFS/proc
umount $LFS/dev/shm
umount $LFS/dev/pts
umount $LFS/dev
Remove the LFS directory structure:
Code:
rm -fr $LFS/{var,usr,tools,tmp,sys,srv,sbin,root,proc,opt,mnt,media,lib,home,etc,bin,boot,dev}
Restored the backed up tools directory, morph in lfs again and change to the sources directory:
Code:
tar xvf /tmp/lfs-6.7-pre-5.32.tar.bz2
su - lfs
cd $LFS/sources
Redo the erroneous Chapter 5.22. Gettext-0.18.1.1 and finally follow the book again from Chapter 5.32. Stripping.

I'm about to start Chapter 6.23. Iana-Etc-2.30 now, so everything is going smoothly enough.

Thanks everyone for their contribution - I do appreciate it.
 
Old 02-05-2011, 12:59 PM   #11
crts
Senior Member
 
Registered: Jan 2010
Posts: 1,604

Rep: Reputation: 446Reputation: 446Reputation: 446Reputation: 446Reputation: 446
Glad you got it working.
Quote:
remembered that I had already made two backups
Well, I guess under these circumstances this qualifies as "best case scenario"
 
Old 10-28-2011, 04:02 PM   #12
spiky0011
Senior Member
 
Registered: Jan 2011
Location: PLANET-SPIKE
Distribution: Ubuntu 12.04/12.10/13.04/LFS/Centos6.3/Debain/PCBSD/Mageia 3
Posts: 1,642
Blog Entries: 1

Rep: Reputation: 229Reputation: 229Reputation: 229
I would like to to thk you ianll I had the exact same problem, Your post pointed me in the right direction, now how to fix
 
Old 08-11-2012, 12:02 PM   #13
hrmn
LQ Newbie
 
Registered: Aug 2012
Posts: 17

Rep: Reputation: Disabled
have proble to compile gcc

i have problem to compile 6.14 gcc-4.7.1 which is same as that u, how to remove this
 
Old 08-11-2012, 01:29 PM   #14
stoat
Member
 
Registered: May 2007
Distribution: LFS
Posts: 465

Rep: Reputation: 133Reputation: 133
Quote:
Originally Posted by hrmn

i have problem to compile 6.14 gcc-4.7.1 which is same as that u, how to remove this
To me, it's not the same.

The posts above are about gcc-4.5.1 from an old version of the book. You're talking about gcc-4.7.1 which is in the current development versions of the book. The posts above are about errors made by the original poster. There is no way to tell what your problem is from what you posted.

I recommend leaving here and starting a new thread about your problem. Mention the book version you are using and exactly where you are in the book. Describe what you are observing that is not right. Copy and paste from your terminal any configure or make error messages plus a bunch of lines preceding the error lines.

But of course do what you think is best.

Last edited by stoat; 08-11-2012 at 01:30 PM.
 
1 members found this post helpful.
Old 08-12-2012, 12:27 AM   #15
hrmn
LQ Newbie
 
Registered: Aug 2012
Posts: 17

Rep: Reputation: Disabled
thanks for reply,
do u solved this problem for this error, if u solved then pls write a particular answer may be it is help-full for me....
i am using ubuntu 10.10,
and working on LFS-Book-7.1,
and i have problem in topic { 6.17. GCC-4.6.2 }..
i think same as that of your problem....
thanku

Last edited by hrmn; 08-12-2012 at 12:33 AM.
 
  


Reply


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
LFS 6.6 - Chapter 5.5 - make[2]: *** [buildgetconstants.o] Error 1 - GCC Pass 1 malikcpp Linux From Scratch 3 06-29-2010 08:09 AM
LFS 6.4 Chapter 6.14 GCC-4.3.2 Could anyone confirm this for me. gazza1z Linux From Scratch 2 01-26-2009 03:44 AM
LFS 6.3, messed up somewhere prior to chapter 6.12 (gcc), how to restart chapter 6? Funkster Linux From Scratch 2 12-24-2008 06:30 AM
LFS chapter 5.14 install fails glentrob Linux From Scratch 2 10-14-2008 03:15 PM
LFS 6.3 - ncurses fails compiling - chapter 5.13.1 Doomed Linux From Scratch 2 05-27-2008 06:39 AM


All times are GMT -5. The time now is 09:20 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration