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 04-06-2015, 04:03 PM   #1
Baihua
LQ Newbie
 
Registered: Mar 2015
Posts: 5

Rep: Reputation: Disabled
Question about LFS 7.7 Chapter 6.17


According to the instruction, I made cc a symlink to /usr/bin/gcc using the command
Code:
ln -sv gcc /usr/bin/cc
and when I went to /usr/bin to do
Code:
ls -la
, I do see that the symlink is created. However, the sanity check

Code:
echo 'main(){}' > dummy.c
cc dummy.c -v -Wl,--verbose &> dummy.log
readelf -l a.out | grep ': /lib'
gives no output.

However, when I tried the above with "gcc" instead of "cc", everything, including the subsequent outputs expected from the sanity checks, came about correctly.

Any idea why this is happening?
 
Old 04-07-2015, 01:09 AM   #2
veerain
Senior Member
 
Registered: Mar 2005
Location: Earth bound to Helios
Distribution: Custom
Posts: 2,524

Rep: Reputation: 319Reputation: 319Reputation: 319Reputation: 319
Post the output of:

Code:
ls -l /usr/bin/cc
ls -l /usr/bin/gcc
which gcc
 
Old 04-07-2015, 11:02 AM   #3
Baihua
LQ Newbie
 
Registered: Mar 2015
Posts: 5

Original Poster
Rep: Reputation: Disabled
Re:

Code:
ls -l /usr/bin/cc
lrwxrwxrwx 1 root root 12 Apr  6 20:56 /usr/bin/cc -> /usr/bin/gcc
Code:
ls -l /usr/bin/gcc
-rwxr-xr-x 3 root root 2537709 Apr  6 17:18 /usr/bin/gcc
"which" command is not supported yet since I am in the chroot environment.

Last edited by Baihua; 04-07-2015 at 11:55 AM.
 
Old 04-07-2015, 12:51 PM   #4
veerain
Senior Member
 
Registered: Mar 2005
Location: Earth bound to Helios
Distribution: Custom
Posts: 2,524

Rep: Reputation: 319Reputation: 319Reputation: 319Reputation: 319
What's your PATH environment variable value?

Code:
echo $PATH
 
Old 04-07-2015, 02:02 PM   #5
Baihua
LQ Newbie
 
Registered: Mar 2015
Posts: 5

Original Poster
Rep: Reputation: Disabled
RE:

I think I know what the problem is:

when I compile with gcc, the readelf will give this output:

Code:
[Requesting program interpreter: /lib/ld-linux.so.2]
when compiling with cc, the readelf has this line as:

Code:
[Requesting program interpreter: /tools/lib/ld-linux.so.2]
and that's why the
Code:
grep ': /lib'
did not get anything when compiling with "cc"

And I believe that the subsequent outputs that did not appear have similar problems

Now the question is:

why would cc try to find the interpreter from /tools/lib? And would this be a problem in the future?

Last edited by Baihua; 04-07-2015 at 02:50 PM.
 
Old 04-07-2015, 09:28 PM   #6
veerain
Senior Member
 
Registered: Mar 2005
Location: Earth bound to Helios
Distribution: Custom
Posts: 2,524

Rep: Reputation: 319Reputation: 319Reputation: 319Reputation: 319
So answer is why you run cc from /tools/bin? Why have you not set /tools/bin path at the end PATH Environment Variable while doing chroot? Check your executable search path. And do follow the book correctly.
 
  


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
LFS 7.4 Chapter 9.3 retux Linux From Scratch 7 09-28-2013 09:22 AM
LFS chapter-by-chapter complete commands with notes DrinkinHomeBrew Linux From Scratch 6 03-16-2012 01:57 AM
[SOLVED] Question about moving to Chapter 6 in the LFS book. BrandonJ Linux From Scratch 2 04-05-2010 11:48 AM
LFS 6.3, messed up somewhere prior to chapter 6.12 (gcc), how to restart chapter 6? Funkster Linux From Scratch 2 12-24-2008 06:30 AM
LFS Book Chapter 6 - 1st step (chroot to /mnt/lfs) doens't work bauld Linux From Scratch 11 03-15-2006 12:31 AM

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

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