LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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 01-27-2016, 11:52 AM   #1
GsXs
LQ Newbie
 
Registered: Jan 2009
Location: Brazil
Distribution: Slackware
Posts: 10

Rep: Reputation: 0
Question " collect2: fatal error: cannot find 'ld' " after leave chroot environment


Hi everyone,

I've been trying for a few days now to build LFS 7.8 with Slackware 14.1 as host system. Yesterday I reached chapter 6.11, even configured Glibc and installed Zlib, all working fine. However, today after restarting my system I'm getting the following error (below I was trying to make linux headers again, since yesterday i did it without errors) :

Code:
root:/sources/linux-4.2# make INSTALL_HDR_PATH=dest headers_install
  CHK     include/generated/uapi/linux/version.h
  UPD     include/generated/uapi/linux/version.h
  HOSTCC  scripts/basic/fixdep
collect2: fatal error: cannot find 'ld'
compilation terminated.
scripts/Makefile.host:91: recipe for target 'scripts/basic/fixdep' failed
make[1]: *** [scripts/basic/fixdep] Error 1
Makefile:439: recipe for target 'scripts_basic' failed
make: *** [scripts_basic] Error 2
When I make the test suggested by the book (yesterday it was ok):
Code:
root:/sources/linux-4.2# echo 'int main(){}' > dummy.c                                                                                                                                 
root:/sources/linux-4.2# cc dummy.c -v -Wl,--verbose &> dummy.log
root:/sources/linux-4.2# readelf -l a.out | grep ': /lib'
readelf: Error: 'a.out': No such file

The book says
Quote:
It is important that all the commands throughout the remainder of this chapter and the following chapters
are run from within the chroot environment. If you leave this environment for any reason (rebooting for
example), ensure that the virtual kernel filesystems are mounted as explained in
Section 6.2.2, “Mounting and Populating /dev” and Section 6.2.3, “Mounting Virtual Kernel File Systems” and enter chroot again before continuing with the installation.
My /etc/ld.so.conf is as described in the book.


Why I did not have this problem yesterday? Is there any further step i need to take to resume installation?


Any help would be great.

Thanks.
 
Old 01-27-2016, 03:22 PM   #2
huffdad
Member
 
Registered: Jan 2006
Location: Missouri
Distribution: Slackware & LFS
Posts: 31

Rep: Reputation: 6
Quote:
Originally Posted by GsXs View Post
When I make the test suggested by the book (yesterday it was ok):
Code:
root:/sources/linux-4.2# echo 'int main(){}' > dummy.c                                                                                                                                 
root:/sources/linux-4.2# cc dummy.c -v -Wl,--verbose &> dummy.log
root:/sources/linux-4.2# readelf -l a.out | grep ': /lib'
readelf: Error: 'a.out': No such file
My guess is that you did not enter the chroot environment correctly. This is only a guess.
Your error says there is no 'a.out' file. The cc command should have dumped its output into the file dummy.log. Inspect that file for clues of what went wrong.

Maybe exit from the chroot environment, ensure that all devices are mounted properly as per the book 6.2.2 and 6.2.3, then re-enter the chroot environment, being careful to type (or copy) the chroot command correctly.
 
Old 01-28-2016, 09:34 AM   #3
GsXs
LQ Newbie
 
Registered: Jan 2009
Location: Brazil
Distribution: Slackware
Posts: 10

Original Poster
Rep: Reputation: 0
huffdad,

I inspected dummy.log and the only error message was "collect2: fatal error: cannot find 'ld'". All my attempts to configure return the same message.

I left chroot and entered it again copying the commands in the book, so I think this is not the problem. I suspect the problem is something that has to do with links (since I have successfully installed the software, my system is just not finding it), but don't know what.

Supposing i would like to start again the build, do i need to recompile all the chapter 5 packages?

Thanks.
 
Old 01-28-2016, 11:34 AM   #4
kcirick
Member
 
Registered: Dec 2006
Distribution: Slackware 14.1; LFS 7.9-Systemd; Debian Jessie
Posts: 169

Rep: Reputation: 55
Quote:
Originally Posted by GsXs View Post
Supposing i would like to start again the build, do i need to recompile all the chapter 5 packages?
No. You should be able to start from top of Chapter 6. I've done this several times when the build didn't go as planned. Good luck!
 
Old 01-28-2016, 02:44 PM   #5
Keith Hedger
Senior Member
 
Registered: Jun 2010
Location: Wiltshire, UK
Distribution: Void, Linux From Scratch, Slackware64
Posts: 3,153

Rep: Reputation: 856Reputation: 856Reputation: 856Reputation: 856Reputation: 856Reputation: 856Reputation: 856
What has links got to do with the kernel headers?
Basically once you have reached chap 6 after a successful build of the tool chain what you do in the mhost system is irelevent, once you are in the chroot environment your LFS build knows nothing about your host system, you HAVE made a mistake in chrooting or in the tool chain.
 
Old 02-03-2016, 01:55 PM   #6
GsXs
LQ Newbie
 
Registered: Jan 2009
Location: Brazil
Distribution: Slackware
Posts: 10

Original Poster
Rep: Reputation: 0
Thumbs down

kcirick,
I wasn't. I followed strictly the book and the procedure didn't go well.


Keith Hedger,
I will try to build the packages again, because i really think the problem isn't "chrooting" (i've done it several times following the book).


Thank you for your help guys. As soon as I fix this problem I'll post here (I will try to build everything again ).
 
  


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
[SOLVED] X: "loading extension glx" "no screens found" "fatal server error" (w/ nvidia driver) Geremia Slackware 7 12-29-2014 11:00 AM
cmake error "Could not find compiler set in environment variable CC:" sewen67 Linux - Newbie 6 05-10-2014 12:58 AM
cant find the "make" command after chroot to the LFS system fengfeng Linux From Scratch 2 02-10-2008 11:34 PM
FATAL error: "Thermal" and "Fan" ibex Linux - Hardware 1 06-22-2006 06:31 AM
Postgresql error FATAL: user "root" does not exist" cgetty Ubuntu 4 06-21-2005 02:11 PM

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

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