LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
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 12-10-2012, 08:15 PM   #1
engineer
Member
 
Registered: Oct 2007
Distribution: LFS
Posts: 69

Rep: Reputation: 2
LFS 7.1, Chapter 5.4.1 fatal error: cannot find 'ld'


Hello everyone,

I've been cruising through LFS 7.1, when I ran into an issue with installing binutils-2.22. EDIT* The host system is Fedora 17, 32 bit.

First, I did this:

Code:
lfs:/mnt/lfs/sources/binutils-build$ ../binutils-2.22/configure \
> --target=$LFS_TGT --prefix=/tools \
> --disable-nls --disable-werror
Which returned:

Code:
checking build system type... i686-pc-linux-gnu
checking host system type... i686-pc-linux-gnu
checking target system type... i686-lfs-linux-gnu
checking for a BSD-compatible install... /bin/install -c
checking whether ln works... yes
checking whether ln -s works... yes
checking for a sed that does not truncate output... /bin/sed
checking for gawk... gawk
checking for gcc... gcc
checking for C compiler default output file name... 
configure: error: in `/mnt/lfs/sources/binutils-build':
configure: error: C compiler cannot create executables
See `config.log' for more details.
A bit of googling around, and some very similar threads I found here on LQ lead me to believe there was some sort of issue with GCC, so just to make sure I ran the version_check.sh.

The output of the version_check.sh is:

Code:
root:/usr/bin# bash version-check.sh
bash, version 4.2.24(1)-release
/bin/sh -> /usr/bin/bash
Binutils: version 2.22.52.0.1-10.fc17 20120131
bison (GNU Bison) 2.5
/usr/bin/yacc -> /usr/bin/bison
bzip2,  Version 1.0.6, 6-Sept-2010.
Coreutils:  8.15
diff (GNU diffutils) 3.2
find (GNU findutils) 4.5.10
GNU Awk 4.0.0
/usr/bin/awk -> /usr/bin/gawk
gcc (GCC) 4.7.2 20120921 (Red Hat 4.7.2-2)
(GNU libc) 2.15
grep (GNU grep) 2.12
gzip 1.4
Linux version 3.3.4-5.fc17.i686 (mockbuild@x86-18.phx2.fedoraproject.org) (gcc version 4.7.0 20120504 (Red Hat 4.7.0-4) (GCC) ) #1 SMP Mon May 7 17:45:26 UTC 2012
m4 (GNU M4) 1.4.16
GNU Make 3.82
patch 2.6.1
Perl version='5.14.3';
GNU sed version 4.2.1
tar (GNU tar) 1.26
Texinfo: makeinfo (GNU texinfo) 4.13
xz (XZ Utils) 5.1.1alpha
collect2: fatal error: cannot find 'ld'
compilation terminated.
gcc compilation failed
Can you please help with the reason for this error? I installed the packages as instructed (to the best of my ability...) is there something that I've missed?

Thank you

Last edited by engineer; 12-10-2012 at 09:29 PM. Reason: Add info about base system
 
Old 12-11-2012, 01:34 AM   #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
I've never used Fedora to build LFS, but it looks like you also need to install the following to make your host compliant:
- gcc-devel
- compat-libstdc++
- compat-libstdc++-devel

I'm not 100% sure about the last 2.

BTW: There's no point in starting with the LFS build until you solved the host system requirements.
 
Old 12-11-2012, 07:17 AM   #3
engineer
Member
 
Registered: Oct 2007
Distribution: LFS
Posts: 69

Original Poster
Rep: Reputation: 2
Thank you for the reply. I do agree that there is no point trying to proceed with the install before resolving this issue. This is my second time to attempt the installation, the first I had installed several more packages, and when running the version_check.sh, I did not have this error. I have since nuked the first install (it was the 64-bit version), and, on the recommendation of the book, installed the 32-bit version of F17. I forgot to check this again until I reached the current point in chapter 5.

By the way, from what I see in the script's output, it only appears as though there is one error; all the other checks seems to pass/indicate a suitable version. Do you agree?

Also, what lead you to the conclusion that I was missing the gcc-devel package? Was there some output in the version check script that would lead me to the same conclusion?

Thanks again.

BTW, I'm at work now, but I'm going to experiment some more when I get home, and try adding the packages you mentioned.

Last edited by engineer; 12-11-2012 at 07:19 AM.
 
Old 12-11-2012, 08:15 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
Quote:
Originally Posted by engineer View Post
By the way, from what I see in the script's output, it only appears as though there is one error; all the other checks seems to pass/indicate a suitable version. Do you agree?
Yes, this part fails:
Code:
echo 'main(){}' > dummy.c && gcc -o dummy dummy.c
Quote:
Originally Posted by engineer
Also, what lead you to the conclusion that I was missing the gcc-devel package? Was there some output in the version check script that would lead me to the same conclusion?
Its a guess based on the error (configure: error: C compiler cannot create executables). I'm not even 100% sure it is gcc-devel, it could be gcc-c++ or some other related package that is missing on your host.
 
Old 12-11-2012, 06:30 PM   #5
engineer
Member
 
Registered: Oct 2007
Distribution: LFS
Posts: 69

Original Poster
Rep: Reputation: 2
Okay, so I've been tooling around with this for an hour or so.

I installed the gcc-plugin-devel package (which had the following dependencies: gmp-devel, libmpc-devel, mpfr-devel) and tried building again, and that did not work. The configure script generated the same result as above. In looking through the config.log file, since we used the '=--prefix=/tools' argument, the configure script is using the tools directory as the prefix to several pathnames in the configure script. However, my tools directory is empty. Is this correct?

Any other thoughts?
 
Old 12-11-2012, 08:36 PM   #6
engineer
Member
 
Registered: Oct 2007
Distribution: LFS
Posts: 69

Original Poster
Rep: Reputation: 2
Also, just for grins, I su'd into my other user and wrote a quick C++ program (similar to the test above) and tried to compile it using gcc, and received the same output. I tried this in a different directory (my other user's home directory).
 
Old 12-12-2012, 01:06 AM   #7
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
I just had a look at a Fedora 17 system and the following needs to be installed, including their dependencies, to be LFS (7.2) compliant:

- bison
- patch
- texinfo
- binutils
- perl
- gcc

The other package I mentioned earlier aren't needed (or are part of the dependencies).
 
Old 12-12-2012, 06:02 AM   #8
engineer
Member
 
Registered: Oct 2007
Distribution: LFS
Posts: 69

Original Poster
Rep: Reputation: 2
Quote:
Originally Posted by druuna View Post
I just had a look at a Fedora 17 system and the following needs to be installed, including their dependencies, to be LFS (7.2) compliant:

- bison
- patch
- texinfo
- binutils
- perl
- gcc

The other package I mentioned earlier aren't needed (or are part of the dependencies).
All of the above-listed packages are already installed (as shown in the version_check.sh above), as well as all of their dependencies. I suppose I should just start over with a fresh install and see if I get any different results.

Will advise after I've done that.
 
Old 12-12-2012, 09:58 AM   #9
Keith Hedger
Senior Member
 
Registered: Jun 2010
Location: Wiltshire, UK
Distribution: Void, Linux From Scratch, Slackware64
Posts: 3,150

Rep: Reputation: 856Reputation: 856Reputation: 856Reputation: 856Reputation: 856Reputation: 856Reputation: 856
I know that these:
gcc-c++
glib2-devel

are needed for Fedora, I'm not sure this is the correct package for gcc "gcc-plugin-devel" fromthe title looks like an extra bit.
 
Old 12-12-2012, 06:11 PM   #10
engineer
Member
 
Registered: Oct 2007
Distribution: LFS
Posts: 69

Original Poster
Rep: Reputation: 2
Well, I installed both of the packages mentioned by Keith Hedger, namely gcc-c++ and glib2-devel, but still receive the same error. When I started my LFS build the first time, the only difference I can think of is that it was the install DVD (64bit), rather than the live CD version of the install (32bit) that I am using now. Note however, that I installed the full OS with the CD, and am not using the Live CD environment to build LFS.

Under the 64bit install, the version_check.sh script did not return this error; there must be some additional packages that the DVD installs that I'm not aware of that were missed in the 32bit install, thus the error.

Can anyone recommend a distro that may work better for a LFS 7.1 base system than Fedora? What distros have you used as a base OS for successfully installing LFS?

On a side note, I noticed that when I change to the lfs user, I get the following error:

Quote:
root:/mnt/lfs/sources/binutils-build# su - lfs
bash: eport: command not found
lfs:~$
It still allows me to work as the lfs user, though. What does this eport command mean?

Last edited by engineer; 12-12-2012 at 06:14 PM.
 
Old 12-13-2012, 01:00 AM   #11
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
Quote:
Originally Posted by engineer View Post
Well, I installed both of the packages mentioned by Keith Hedger, namely gcc-c++ and glib2-devel, but still receive the same error. When I started my LFS build the first time, the only difference I can think of is that it was the install DVD (64bit), rather than the live CD version of the install (32bit) that I am using now. Note however, that I installed the full OS with the CD, and am not using the Live CD environment to build LFS.

Under the 64bit install, the version_check.sh script did not return this error; there must be some additional packages that the DVD installs that I'm not aware of that were missed in the 32bit install, thus the error.
Just wondering: Did you take the output generated by the version-check script for granted (it telling you gcc is found, no further action needed) or did you also manually try to install the packages mentioned by me in post #7? Just a wild guess, I admit, but maybe worth trying.

Quote:
Can anyone recommend a distro that may work better for a LFS 7.1 base system than Fedora? What distros have you used as a base OS for successfully installing LFS?
I've used multiple distro's to successfully build LFS. My favourite 2 (besides LFS): Debian and Slackware. But the Ubuntu family works and "back-then" SuSe also worked.

Strangely I never tried using a RedHat based distro.... Might be a good idea I try one of these days.

Quote:
On a side note, I noticed that when I change to the lfs user, I get the following error:
Code:
root:/mnt/lfs/sources/binutils-build# su - lfs
 bash: eport: command not found
 lfs:~$
It still allows me to work as the lfs user, though. What does this eport command mean?
That is a typo on your side. eport -> export. Which is a rather important command (it exports LFS LC_ALL and LFS_TGT PATH). Check /home/lfs/.bashrc (last line).
 
Old 12-13-2012, 07:17 AM   #12
engineer
Member
 
Registered: Oct 2007
Distribution: LFS
Posts: 69

Original Poster
Rep: Reputation: 2
Facepalm. Thanks for catching that, no telling how long it might have taken me to track that down.

In regards to the question on the version check script, I at first took it for granted, since it said GCC was installed, but was concerned also about the error at the end:

Quote:
collect2: fatal error: cannot find 'ld'
compilation terminated.
gcc compilation failed
Since during this install, I didn't run the script until I had the error during configuration of binutils pass 1, I was unaware of the issue until then. When I posted in here, I took the recommendations I got from you guys, and separately installed those packages, and then ran both the configure command for binutils and the version check script again. So... when I say that "it's still not working" what I mean is that the version check script produces the same error and binutils fails on account of the compiler not being able to create executables.

I haven't had a chance to do much since yesterday, but I'll fix my oversight in the .bashrc file and see if anything else changes.

About 8 years ago, I experimented around with Debian-based distros (Ubuntu, Debian, etc.) and then wanted to try out RHEL-based distros, so I picked up Fedora 12 and CentOS, and haven't looked back since. For whatever reason, I prefer those over Debian distros. I'm at the point now where I'm more or less set in my ways, and would prefer to just stick with one set of commands/interface style.
 
Old 12-13-2012, 07:42 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
Just to clarify something: I have used RedHat based distro's (mostly work related) but I never used them as host to build LFS.

Must be possible, I'll give it a try if I have some time to spare.
 
Old 12-13-2012, 08:47 AM   #14
Keith Hedger
Senior Member
 
Registered: Jun 2010
Location: Wiltshire, UK
Distribution: Void, Linux From Scratch, Slackware64
Posts: 3,150

Rep: Reputation: 856Reputation: 856Reputation: 856Reputation: 856Reputation: 856Reputation: 856Reputation: 856
Quote:
Originally Posted by engineer View Post
...When I started my LFS build the first time, the only difference I can think of is that it was the install DVD (64bit), rather than the live CD version of the install (32bit) that I am using now.

...Can anyone recommend a distro that may work better for a LFS 7.1 base system than Fedora? What distros have you used as a base OS for successfully installing LFS?...
First bit, probably I'm having a slow day but itsounds like you may have a mix of 64bit and 32bit apps, could this be your problem?.

Second bit, I would STRONGLY recommend slackware for the simple reason that it doesn't split dev files form the normal install as it's a source based distro, when you install a library or other app ALL the dev stuff gets installed as well ( include files, .pc files etc ), the distro is also pretty grown up and doesn't hold your hand when it comes to installing, for instance you have to sort out your own dependencies, so you know what has been installed.
 
Old 12-13-2012, 09:20 AM   #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
I had some time to install fedora

Used : Fedora-17-i686-Live-Desktop.iso (in VM)
Install to HD : Defaults / No Changes made

After install finishes:
Code:
$ uname -a
Linux fedora-vm 3.6.9-2.fc17.i686 #1 SMP Tue Dec 4 14:22:00 UTC 2012 i686 i686 i386 GNU/Linux
First version-check.sh run (errors):

- binutils -> ld not found
- bison not found
- yacc not found
- gcc not found
- patch not found
- perl not found
- makeinfo not found
- gcc not found (gcc compilation failed)

Add packages:
Code:
yum install bison gcc patch perl texinfo
5 Packages and 19 dependencies will be installed:
Code:
Installing:
 bison                             i686              2.5-3.fc17                   fedora             713 k
 gcc                               i686              4.7.2-2.fc17                 updates             12 M
 patch                             i686              2.6.1-12.fc17                fedora              96 k
 perl                              i686              4:5.14.3-218.fc17            updates            9.8 M
 texinfo                           i686              4.13a-16.fc17                fedora             656 k
Installing for dependencies:
 cloog-ppl                         i686              0.15.11-3.fc17.1             fedora              94 k
 cpp                               i686              4.7.2-2.fc17                 updates            4.4 M
 glibc-devel                       i686              2.15-58.fc17                 updates            991 k
 glibc-headers                     i686              2.15-58.fc17                 updates            622 k
 kernel-headers                    i686              3.6.9-2.fc17                 updates            862 k
 libmpc                            i686              0.9-2.fc17.2                 fedora              49 k
 perl-Carp                         noarch            1.22-2.fc17                  fedora              17 k
 perl-Module-Pluggable             noarch            1:3.90-218.fc17              updates             48 k
 perl-PathTools                    i686              3.33-218.fc17                updates            106 k
 perl-Pod-Escapes                  noarch            1:1.04-218.fc17              updates             41 k
 perl-Pod-Simple                   noarch            1:3.16-218.fc17              updates            223 k
 perl-Scalar-List-Utils            i686              1.25-1.fc17                  fedora              34 k
 perl-Socket                       i686              2.001-1.fc17                 fedora              44 k
 perl-libs                         i686              4:5.14.3-218.fc17            updates            637 k
 perl-macros                       i686              4:5.14.3-218.fc17            updates             33 k
 perl-threads                      i686              1.86-2.fc17                  fedora              47 k
 perl-threads-shared               i686              1.40-2.fc17                  fedora              36 k
 ppl                               i686              0.11.2-8.fc17                fedora             1.4 M
 ppl-pwl                           i686              0.11.2-8.fc17                fedora              36 k
Create link:
Code:
ln -s /bin/bison /usr/bin/yacc
Initially ld isn't installed, but the above installs ld (/usr/bin/ld)

Second version-check.sh run:

no issues

I'm assuming for now that if echo 'main(){}' > dummy.c && gcc -o dummy dummy.c from the version check script works, then you should also be able to compile during the LFS build. If not then a mistake during the LFS build might be the problem.
 
  


Reply

Tags
fedora, lfs



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
[SOLVED] LFS Chapter 6.37. Automake-1.11.3 error Andrew_Kaunchy Linux From Scratch 4 08-26-2012 12:52 AM
error : make-3.82 Lfs 7.1 chapter 6 nourib Linux From Scratch 1 07-30-2012 04:30 AM
[SOLVED] error chapter 5.23 LFS book 6.6 charlie_lab Linux From Scratch 5 04-18-2010 05:06 AM
LFS 6 Chapter 6.8 mount error gatblast45 Linux From Scratch 20 01-04-2006 05:48 PM
LFS 3.3 - chapter 6 - glibc error fend88 Linux From Scratch 5 04-28-2002 11:06 PM

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

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