LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux From Scratch (http://www.linuxquestions.org/questions/linux-from-scratch-13/)
-   -   LFS 6.7 Chapter 6.16 GCC-4.5.1 make fails (http://www.linuxquestions.org/questions/linux-from-scratch-13/lfs-6-7-chapter-6-16-gcc-4-5-1-make-fails-859612/)

ianll 01-30-2011 03:47 PM

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

xeleema 01-30-2011 04:20 PM

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.

ianll 01-30-2011 06:02 PM

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

druuna 01-30-2011 06:10 PM

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.

ianll 01-30-2011 06:57 PM

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

crts 01-31-2011 01:05 AM

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.

ianll 01-31-2011 02:52 AM

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

crts 01-31-2011 04:07 AM

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


druuna 01-31-2011 05:10 AM

Hi ianll,

Sorry about post #4, I clearly wasn't at the top of my game.

ianll 02-05-2011 07:11 AM

[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.

crts 02-05-2011 12:59 PM

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" ;)

spiky0011 10-28-2011 04:02 PM

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

hrmn 08-11-2012 12:02 PM

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

stoat 08-11-2012 01:29 PM

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.

hrmn 08-12-2012 12:27 AM

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


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