LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux From Scratch (https://www.linuxquestions.org/questions/linux-from-scratch-13/)
-   -   " collect2: fatal error: cannot find 'ld' " after leave chroot environment (https://www.linuxquestions.org/questions/linux-from-scratch-13/collect2-fatal-error-cannot-find-ld-after-leave-chroot-environment-4175568051/)

GsXs 01-27-2016 11:52 AM

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

huffdad 01-27-2016 03:22 PM

Quote:

Originally Posted by GsXs (Post 5488052)
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.

GsXs 01-28-2016 09:34 AM

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.

kcirick 01-28-2016 11:34 AM

Quote:

Originally Posted by GsXs (Post 5488650)
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!

Keith Hedger 01-28-2016 02:44 PM

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.

GsXs 02-03-2016 01:55 PM

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 :cry:).


All times are GMT -5. The time now is 01:15 PM.