LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
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 04-14-2014, 10:59 PM   #1
sfzombie13
Member
 
Registered: Dec 2003
Location: wv
Distribution: slackware, lfs, kali, pentoo, centos
Posts: 168

Rep: Reputation: 18
chapter 5.5 building gcc cannot find gcc directory


well, here i am back again. this is the second time asking for help on this build. i hate asking for help, especially for stuff i've done before like compiling and installing packages. well, anyway, i am on chapter 5.5, and when i get to the script to the part about changing the default location of the dynamic linker i get an error message saying no such file or directory. here is what i did and got:
Code:
lfs:/mnt/lfs/sources/gcc-build$ for file in \
> $(find gcc/config -name linux64.h -o -name linux.h -o -name sysv4.h)
> do
> cp -uv $file{,.orig}
> sed -e 's@/lib\(64\)\?\(32\)\?/ld@/tools&@g' \
> -e 's@/usr@/tools@g' $file.orig > $file
> echo '
> #undef STANDARD_STARTFILE_PREFIX_1
> #undef STANDARD_STARTFILE_PREFIX_2
> #define STANDARD_STARTFILE_PREFIX_1 "/tools/lib/"
> #define STANDARD_STARTFILE_PREFIX_2 ""' >> $file
> touch $file.orig
> done
find: `gcc': No such file or directory
and when i tested it, i got another error:
Code:
readelf -l {binary} | grep interpreter
readelf: Error: '{binary}': No such file
i have searched for all of the directories and file listed in the first part of the command, thinking that maybe it had a different file path, but cannot find them. maybe it is ok to go on?
well, i went on and almost figured it out. i was following directions explicitly (something i usually don't do) trying to get this right. well, when i thought about it more, it wasn't right how the book put it. of course there is no file there, i didn't put it there yet. so when i moved the gcc-4.8.whatever tar file and untarred it, i ran the command again and it said i was missing the gmp, mpfr, and mpc files, so i moved them and untarred them also an ran it again. then i got the same error:
Code:
$LFS/sources/gcc-build/gcc-4.8.2/configure --target=$LFS_TGT --prefix=/tools --with-sysroot=$LFS --with-newlib --without-headers --with-local-prefix=/tools --with-native-system-header-dir=/tools/include --disable-nls --disable-shared --disable-multilib --disable-decimal-float --disable-threads --disable-libatomic --disable-libgomp --disable-libitm --disable-libmudflap --disable-libquaadmath --disable-libsanitizer --disable-libssp --disable-libstdc++-v3 --enable-languages=c,c++ --with-mpfr-includes=$(pwd)/$LFS/sources/gcc-build/gcc-build/gcc-4.8.2/mpfr/src --with-mpfr-lib=$(pwd)/mpfr/src/.libs
...
checking for objdir... .libs
checking for the correct version of gmp.h... no
configure: error: Building GCC requires GMP 4.2+, MPFR 2.4.0+ and MPC 0.8.0+.
Try the --with-gmp, --with-mpfr and/or --with-mpc options to specify
their locations.  Source code for these libraries can be found at
their respective hosting sites as well as at
ftp://gcc.gnu.org/pub/gcc/infrastructure/.  See also
http://gcc.gnu.org/install/prerequisites.html for additional info.  If
you obtained GMP, MPFR and/or MPC from a vendor distribution package,
make sure that you have installed both the libraries and the header
files.  They may be located in separate packages.
now i truly am stumped. ideas?

Last edited by sfzombie13; 04-14-2014 at 11:28 PM. Reason: got a little further
 
Old 04-14-2014, 11:05 PM   #2
Luridis
Member
 
Registered: Mar 2014
Location: Texas
Distribution: LFS 9.0 Custom, Merged Usr, Linux 4.19.x
Posts: 616

Rep: Reputation: 167Reputation: 167
What distro are you using to install? How did version-check.sh go in part vii "Host System Requirements"?

NO... it's not okay to go on.

Oops... I see it now. You're in the wrong directory. You need to be in gcc-4.8.2 UNTIL you see the line:
Code:
mkdir ../gcc-build
cd ../gcc-build
You have to always be very careful of the command orders when things have separate build directories.

Some will say:
Quote:
In source directory, do x & y, then CD to build directory and do z.
Others will say:
Quote:
Unpack and go directly to build directory.
Just be mindful of where you see mkdir and cd in succession. Oh, and huge blocks of cut->paste should be broken up where possible. Sometimes something will not go right and the error will fly right on by and completely out of the buffer. I wouldn't go as far as breaking up blocks with continuance "\", but otherwise: yes.

Last edited by Luridis; 04-14-2014 at 11:19 PM. Reason: Afterthoughts...
 
Old 04-14-2014, 11:31 PM   #3
sfzombie13
Member
 
Registered: Dec 2003
Location: wv
Distribution: slackware, lfs, kali, pentoo, centos
Posts: 168

Original Poster
Rep: Reputation: 18
thanx for the answer, i was trying it out when you answered it. i didn't cut and paste, i typed all of the commands. didn't think of cutting and pasting actually. i will have to try it. and thanx for the advise, i will change directories and try again.

i changed to the gcc-4.8.2 and ran it again and got the same error as the last one i posted above. i gotta go get some sleep now, will try again tomorrow after work.

Last edited by sfzombie13; 04-14-2014 at 11:34 PM. Reason: tried again, got an error
 
Old 04-14-2014, 11:50 PM   #4
stoat
Member
 
Registered: May 2007
Distribution: LFS
Posts: 628

Rep: Reputation: 185Reputation: 185
I think this is the problem.
Quote:
Originally Posted by sfzombie13
Code:
configure: error: Building GCC requires GMP 4.2+, MPFR 2.4.0+ and MPC 0.8.0+.
It happens all the time.

I recommend that you...

1. Return to the source directory level.
2. Delete the gcc-4.8.2 and gcc-build directories.
3. Untar the gcc-4.8.2 tarball again.
4. Descend into the gcc-4.8.2 directory again.

In other words, the "General Compilation Instructions" for any package. Then...

5. Do those tar and mv steps for mpfr, gmp, and mpc at the top of the page (they will untarred in the gcc-4.8.2 directory and then renamed).
6. Then continue on down the page.

It will work.

Last edited by stoat; 04-14-2014 at 11:58 PM.
 
Old 04-15-2014, 12:09 AM   #5
Luridis
Member
 
Registered: Mar 2014
Location: Texas
Distribution: LFS 9.0 Custom, Merged Usr, Linux 4.19.x
Posts: 616

Rep: Reputation: 167Reputation: 167
Quote:
Originally Posted by stoat View Post
I think this is the problem.
It happens all the time.

I recommend that you...

1. Return to the source directory level.
2. Delete the gcc-4.8.2 and gcc-build directories.
3. Untar the gcc-4.8.2 tarball again.
4. Descend into the gcc-4.8.2 directory again.

In other words, the "General Compilation Instructions" for any package. Then...

5. Do those tar and mv steps for mpfr, gmp, and mpc at the top of the page (they will untarred in the gcc-4.8.2 directory and then renamed).
6. Then continue on down the page.

It will work.
I was looking at this:

Code:
lfs:/mnt/lfs/sources/gcc-build$ for file in \
> $(find gcc/config -name linux64.h -o -name linux.h -o -name sysv4.h)
> do
> cp -uv $file{,.orig}
Which would be after:

Code:
tar -Jxf ../mpfr-3.1.2.tar.xz
mv -v mpfr-3.1.2 mpfr
tar -Jxf ../gmp-5.1.3.tar.xz
mv -v gmp-5.1.3 gmp
tar -zxf ../mpc-1.0.2.tar.gz
mv -v mpc-1.0.2 mpc
In:

Code:
/mnt/lfs/sources/gcc-4.8.2
 
Old 04-15-2014, 12:19 AM   #6
Luridis
Member
 
Registered: Mar 2014
Location: Texas
Distribution: LFS 9.0 Custom, Merged Usr, Linux 4.19.x
Posts: 616

Rep: Reputation: 167Reputation: 167
Quote:
Originally Posted by sfzombie13 View Post
thanx for the answer, i was trying it out when you answered it. i didn't cut and paste, i typed all of the commands. didn't think of cutting and pasting actually. i will have to try it. and thanx for the advise, i will change directories and try again.

i changed to the gcc-4.8.2 and ran it again and got the same error as the last one i posted above. i gotta go get some sleep now, will try again tomorrow after work.
Copy and paste is a lot less prone to error. Eyes get weary and the mind wanders and things like ` become '. Especially if you've done this dozens of times.

Can't tell you how many builds I've screwed up by mixing up --prefix=/usr and --prefix=/tools. Or, where I've configured bash without guile or make without bash malloc.

Last edited by Luridis; 04-15-2014 at 12:23 AM.
 
Old 04-15-2014, 09:18 AM   #7
stoat
Member
 
Registered: May 2007
Distribution: LFS
Posts: 628

Rep: Reputation: 185Reputation: 185
Quote:
Originally Posted by sfzombie13

so when i moved the gcc-4.8.whatever tar file and untarred it, i ran the command again and it said i was missing the gmp, mpfr, and mpc files, so i moved them and untarred them also an ran it again.
All of that is wrong, and explains how you ended up with a gcc-4.8.2 directory down in the gcc-build directory. You are over-thinking this particular page. And it happens all the time, as I said before. Nothing should be moved anywhere. Untar the gcc tarball, decend down into gcc-4.8.2, start following the directions on the page. Same as for any other package. But of course, do what you think is best.

P.S.: I recommend not editing earlier posts (such as the first one) to report new developments or information. New readers may benefit from that, but others following along likely will never see that stuff.
 
Old 04-16-2014, 11:18 AM   #8
sfzombie13
Member
 
Registered: Dec 2003
Location: wv
Distribution: slackware, lfs, kali, pentoo, centos
Posts: 168

Original Poster
Rep: Reputation: 18
man, i was all ready to mark this thread solved, because technically it was, but i got one step further and got another error. this time, it was the compiler when i tried to prepare it. i copied that huge command (not sure if i like not typing it in) and got the error just like the one in the original post. i checked the versions well, they are all above the ones specified in the error message, they were downloaded from the list with wget. i opened up the log and found the line which was complaining, here it is:
Code:
gcc -c -g -O2 -I/mnt/lfs/sources/gcc-build/gcc-4.8.2/gmp -I/mnt/lfs/sources/gcc-build/gcc-4.8.2/mpfr/src -ILFS/sources/gcc-build/gcc-4.8.2/mpc   conftest.c >&5
conftest.c:10:17: fatal error: gmp.h: No such file or directory
compilation terminated.
i looked and can't find this file anywhere. i found an igmp.h in the /usr/include/linux folder, and was going to put that there, but i don't know how to make the compiler look for that instead of the other, way beyond my level. i have compiled source and installed packages before, it's been a while, but i've done it and am used to trying to figure things out. doing the whole os is new, although i have recompiled kernals. the place i am at now should be simple, maybe because i am using suse 11.4? i didn't want to install a whole new os and try to learn that a the same time as this, it should work. i have some other things to do now, school is falling behind because of this project. thanx for the assistance guys. have a good day/night.
 
Old 04-16-2014, 02:43 PM   #9
stefan1959
Member
 
Registered: Feb 2006
Posts: 34

Rep: Reputation: 1
Quote:
Originally Posted by sfzombie13 View Post
man, i was all ready to mark this thread solved, because technically it was, but i got one step further and got another error. this time, it was the compiler when i tried to prepare it. i copied that huge command (not sure if i like not typing it in) and got the error just like the one in the original post. i checked the versions well, they are all above the ones specified in the error message, they were downloaded from the list with wget. i opened up the log and found the line which was complaining, here it is:
Code:
gcc -c -g -O2 -I/mnt/lfs/sources/gcc-build/gcc-4.8.2/gmp -I/mnt/lfs/sources/gcc-build/gcc-4.8.2/mpfr/src -ILFS/sources/gcc-build/gcc-4.8.2/mpc   conftest.c >&5
conftest.c:10:17: fatal error: gmp.h: No such file or directory
compilation terminated.
i looked and can't find this file anywhere. i found an igmp.h in the /usr/include/linux folder, and was going to put that there, but i don't know how to make the compiler look for that instead of the other, way beyond my level. i have compiled source and installed packages before, it's been a while, but i've done it and am used to trying to figure things out. doing the whole os is new, although i have recompiled kernals. the place i am at now should be simple, maybe because i am using suse 11.4? i didn't want to install a whole new os and try to learn that a the same time as this, it should work. i have some other things to do now, school is falling behind because of this project. thanx for the assistance guys. have a good day/night.
did you run
tar -Jxf ../mpfr-3.1.2.tar.xz
mv -v mpfr-3.1.2 mpfr
tar -Jxf ../gmp-5.1.3.tar.xz
mv -v gmp-5.1.3 gmp
tar -zxf ../mpc-1.0.2.tar.gz
mv -v mpc-1.0.2 mpc
?
Steve
 
Old 04-16-2014, 04:00 PM   #10
sfzombie13
Member
 
Registered: Dec 2003
Location: wv
Distribution: slackware, lfs, kali, pentoo, centos
Posts: 168

Original Poster
Rep: Reputation: 18
yes i did. after i took the advice to start over, i untarred (?) the gcc file, then went into the gcc-4.8.2 directory and ran those three commands, and then went on to the for file in \ part. everything went well until i got to the prepare for compile part. i then got the same error listed in the bottom section of code for my first post. that's when i went into the log and went through it until i found the line you posted. i checked the hashes on the downloads, they all matched, but it looks like it isn't creating that file for whatever reason. is there somewhere i can get a copy and insert into the directory, or does it have to be specific for the system i'm on? this is where i have enough knowledge to really screw things up. i can't even find this file on my system. turns out i couldn't concentrate on my school work so here i am back at it. makes me feel like an idiot.

in my searches, i found a GMP.h in the ../gcc-4.8.2/libjava/gnu/java/math directory, i'm going to try to rename that and see what happens. also, just had a thought, do you suppose that it might have something to do with always having to type out the full path to a directory? i mean, i can't type ../gcc-4.8.2 to go there, i have to use $LFS/sources/gcc-build/gcc-4.8.2/gcc-4.8.2. and i also wonder why there are two directories named the same thing there. i suspect this may have something to do with the problem as well. if i can't get it tonight, i am going to scrap it and start again (for the third time). at least i'm learning more than if it had all gone smoothly.

i'm onto it. when i went into the next gcc-4.8.2 directory, it got the .gmp and the .mpfr part, just needs the .mpc.h now. maybe i'll get it after all. or not.

got it. didn't have mpsf-dev installed.

Last edited by sfzombie13; 04-16-2014 at 04:32 PM. Reason: had another thought, typo, partial success, got it
 
Old 04-16-2014, 05:19 PM   #11
stoat
Member
 
Registered: May 2007
Distribution: LFS
Posts: 628

Rep: Reputation: 185Reputation: 185
This right here is still your same old problem...
Quote:
Originally Posted by sfzombie13

i have to use $LFS/sources/gcc-build/gcc-4.8.2/gcc-4.8.2.
You now have two gcc-4.8.2 directories down inside your gcc-build directory. The gcc-4.8.2 and gcc-build directories should both be in the $LFS/sources directory.

There's not really much else to say except try again...

Get back into your $LFS/sources directory.
Delete all gcc related directories visible in $LFS/sources (gcc-4.8.2, gcc-build, whatever).
Untar the gcc-4.8.2.tar.bz2 tarball.
Change directories to the newly created gcc-4.8.2 directory.
Stop thinking.
Don't move anything.
Don't rename anything.
Simply and only follow the steps on the GCC page starting in section 5.5.1.

P.S.: This is very common as I already said. In fact, there is a yellow warning box on the GCC-4.8.2 - Pass 1 page about this very thing.

Last edited by stoat; 04-16-2014 at 05:30 PM.
 
Old 04-16-2014, 05:40 PM   #12
sfzombie13
Member
 
Registered: Dec 2003
Location: wv
Distribution: slackware, lfs, kali, pentoo, centos
Posts: 168

Original Poster
Rep: Reputation: 18
actually, i know how the extra directory got there, i put it there. i tried the directions exactly, things weren't working, so i made adjustments. when i tried to untar the gcc, it said no such directory, so i created one. when it said i didn't have permission to make install, i sudo made it install. and just now, when i got an error here:
Code:
Makefile:162: ../.././gcc/libgcc.mvars: No such file or directory
make[2]: *** No rule to make target `../.././gcc/libgcc.mvars'.  Stop.
i searched it and found it is bug 32212 and there is a workaround. it involves building gcc in the wrong directory, so i will try it and see what happens. if it fails, i will re build it again. not too big of a deal there.

i did see the warning and it is a little unclear on the 5.5 chapter, when i followed all the steps in order, it was wrong. the part about making the directories is after the part about untarring into them. now i am not usually above trying a workaround, but i will try to go back again first. most of my mistakes have been me with a typo. i should be able to fly now that i am cutting and pasting. thanx for the help, i really appreciate it.
 
Old 04-16-2014, 06:13 PM   #13
stoat
Member
 
Registered: May 2007
Distribution: LFS
Posts: 628

Rep: Reputation: 185Reputation: 185
Quote:
Originally Posted by sfzombie13

i searched it and found it is bug 32212 and there is a workaround. it involves building gcc in the wrong directory
I would like to see that bug report. Can you link to it? I built GCC from this same page with no issues.
Quote:
Originally Posted by sfzombie13

when i followed all the steps in order, it was wrong. the part about making the directories is after the part about untarring into them.
Actually, you are still doing this wrong. You should be in the gcc-4.8.2 directory created by untarring gcc-4.8.2.tar.bz2 when you start doing the steps on the page (like all LFS packages). The first commands make MPFR, GMP, MPC get untarred in the gcc-4.8.2 directory. And their untarred directories get renamed. Then subsequent steps create the gcc-build directory one level up (../) in $LFS/sources and cd to that. So when you get to the step to execute configure (located in $LFS/sources/gcc-4.8.2), you are in $LFS/sources/gcc-build. See? Then make. Then make install. If you follow the steps in the book exactly, what I just said will happen without you having to do any other thing.

Last edited by stoat; 04-16-2014 at 08:49 PM.
 
Old 04-16-2014, 06:51 PM   #14
sfzombie13
Member
 
Registered: Dec 2003
Location: wv
Distribution: slackware, lfs, kali, pentoo, centos
Posts: 168

Original Poster
Rep: Reputation: 18
here is the link to the bug report. it's not the same thing, but when i posted the error message, it came up. it was close enough, and had the file fr30-elf/libgcc/Makefile been there, i would have done it. nothing to edit, nothing to fix. so...i just deleted the directory again and am starting over. man, ya gotta love this shit. pardon my language. thanx for the help. at least you're telling me that these are common mistakes and i feel a little better, but still.
 
Old 04-16-2014, 07:31 PM   #15
stoat
Member
 
Registered: May 2007
Distribution: LFS
Posts: 628

Rep: Reputation: 185Reputation: 185
Thanks for the link to that bug report. Some comments about that... First, it was seven years ago. In software terms, that time was like the Jurassic period. And it was about GCC-4.3.0 which would be like a parallel universe to GCC-4.8.2. Next, they're talking about issues that occur when GCC is built in the source directory. That's the directory created when the tarball is unpacked. In our case today, that would be gcc-4.8.2. In that bug report, the suggestion is made to build in another directory to avoid those issues. That right there is why the LFS book creates the gcc-build directory and changes to it to do configure, make, and make install. The gcc-build directory being discussed here today is the "different directory" they were talking about in the bug report seven years ago. So it's still done that way today, and the LFS steps make it happen (if you follow them).

Last edited by stoat; 04-16-2014 at 07:35 PM.
 
  


Reply



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
gcc: No such file or directory [Chapter 6] dscener Linux From Scratch 4 02-05-2015 06:14 AM
[SOLVED] Gcc error building tools on 7.4.rc1 chapter 5.10. GCC-4.8.1 - Pass 2 Keith Hedger Linux From Scratch 3 08-29-2013 11:30 AM
LFS 7.1 errors in chapter 6 when building gcc in 6.17 kevstev Linux From Scratch 3 01-02-2013 12:31 PM
Building Gcc-core-3.3.1 Chapter 5 mullog Linux From Scratch 8 05-27-2004 12:49 PM
ctype_tolower ctype_tupper not find when building GCC 3.2 on mandrake 9.1 with LFS4.1 toon Linux From Scratch 2 10-07-2003 12:39 PM

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

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