LinuxQuestions.org
Visit Jeremy's Blog.
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 11-28-2019, 08:39 AM   #1
dopaseraoxy
LQ Newbie
 
Registered: Nov 2019
Location: Canada
Distribution: Ubuntu
Posts: 9

Rep: Reputation: Disabled
Unhappy Chapter 5.10 Error on Sanity Check


So this is my first time making LFS. Everything's gone smoothly up until now. I did the install of GCC-9.2.0 pass 2 and everything seemed fine. All commands copy and pasted from the site itself. However when I ran the sanity check, I got this:

Code:
lfs@ksawer-Aspire-A315-21:/mnt/lfs/sources/gcc-9.2.0/build$ echo 'int main(){}' > dummy.c
lfs@ksawer-Aspire-A315-21:/mnt/lfs/sources/gcc-9.2.0/build$ cc dummy.c
/usr/bin/ld: /mnt/lfs/tools/bin/../lib/gcc/x86_64-pc-linux-gnu/9.2.0/../../../../lib/crti.o: unable to initialize decompress status for section .debug_aranges
/usr/bin/ld: /mnt/lfs/tools/bin/../lib/gcc/x86_64-pc-linux-gnu/9.2.0/../../../../lib/crti.o: unable to initialize decompress status for section .debug_aranges
/usr/bin/ld: /mnt/lfs/tools/bin/../lib/gcc/x86_64-pc-linux-gnu/9.2.0/../../../../lib/crti.o: unable to initialize decompress status for section .debug_aranges
/usr/bin/ld: /mnt/lfs/tools/bin/../lib/gcc/x86_64-pc-linux-gnu/9.2.0/../../../../lib/crti.o: unable to initialize decompress status for section .debug_aranges
/mnt/lfs/tools/bin/../lib/gcc/x86_64-pc-linux-gnu/9.2.0/../../../../lib/crti.o: file not recognized: File format not recognized
collect2: error: ld returned 1 exit status
lfs@ksawer-Aspire-A315-21:/mnt/lfs/sources/gcc-9.2.0/build$ readelf -l a.out | grep ': /tools'
readelf: Error: 'a.out': No such file
I'm not quite sure what went wrong or how to fix this. Any help and an explanation would be nice! (Link to where I am in the booklet)

EDIT: Was missing ld in tools/bin. Ran cp /tools/bin/ld-new /tools/bin/ld and it worked. Solved by someone on Facebook.

Last edited by dopaseraoxy; 11-28-2019 at 01:57 PM. Reason: SOLVED
 
Old 11-28-2019, 01:09 PM   #2
hazel
LQ Guru
 
Registered: Mar 2016
Location: Harrow, UK
Distribution: LFS, AntiX, Slackware
Posts: 7,659
Blog Entries: 19

Rep: Reputation: 4480Reputation: 4480Reputation: 4480Reputation: 4480Reputation: 4480Reputation: 4480Reputation: 4480Reputation: 4480Reputation: 4480Reputation: 4480Reputation: 4480
It's trying to link your dummy file with the ld from /usr/bin. That's the host system's ld and it's definitely wrong; it should be using /tools/bin/ld.

My guess is that you didn't carry out the edit specified in this chapter to "Once again, change the location of GCC's default dynamic linker to use the one installed in /tools".
 
Old 11-28-2019, 01:25 PM   #3
dopaseraoxy
LQ Newbie
 
Registered: Nov 2019
Location: Canada
Distribution: Ubuntu
Posts: 9

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by hazel View Post
It's trying to link your dummy file with the ld from /usr/bin. That's the host system's ld and it's definitely wrong; it should be using /tools/bin/ld.

My guess is that you didn't carry out the edit specified in this chapter to "Once again, change the location of GCC's default dynamic linker to use the one installed in /tools".
Do you mean the symlink? I did that, and then re-did it because I thought it messed up.
Code:
lfs@ksawer-Aspire-A315-21:/mnt/lfs/sources/gcc-9.2.0/build$ ln -sv gcc /tools/bin/cc
'/tools/bin/cc' -> 'gcc'
Or was there an edit to the chapter that I'm unaware of?
 
Old 11-28-2019, 02:57 PM   #4
hazel
LQ Guru
 
Registered: Mar 2016
Location: Harrow, UK
Distribution: LFS, AntiX, Slackware
Posts: 7,659
Blog Entries: 19

Rep: Reputation: 4480Reputation: 4480Reputation: 4480Reputation: 4480Reputation: 4480Reputation: 4480Reputation: 4480Reputation: 4480Reputation: 4480Reputation: 4480Reputation: 4480
Here is the section from chapter 5.10.1 of the book that I was referring to. Read it carefully. Did you do all this after untarring the source?
Quote:
Once again, change the location of GCC's default dynamic linker to use the one installed in /tools.

for file in gcc/config/{linux,i386/linux{,64}}.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
Putting in the cc link is the final stage, after building and installing. Your gcc build probably went wrong right at the beginning.

Last edited by hazel; 11-28-2019 at 02:58 PM.
 
  


Reply

Tags
gcc-9.2.0, lfs error, newbie, sanity check



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
Sanity check error in Glibc-2.26 chapter 5.7 parotta36 Linux From Scratch 4 01-28-2018 11:02 AM
No output for sanity check in Glibc-2.26 chapter 5.7 - Error in tools directory location parotta36 Linux From Scratch 10 01-23-2018 07:12 AM
[SOLVED] LFS 7.3 / Chapter 6.10 / Page 96 / Error from the sanity check Drumachine Linux From Scratch 4 08-15-2013 09:01 AM
No output from sanity check, chapter 5.7.*Adjusting the Toolchain Murdock_nl Linux From Scratch 2 09-13-2008 12:59 AM
ld reports "no input file" at first sanity check (chapter 5.7) garba Linux From Scratch 1 07-23-2005 06:54 PM

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

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