LinuxQuestions.org
Review your favorite Linux distribution.
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 06-06-2012, 05:13 PM   #16
spiky0011
Senior Member
 
Registered: Jan 2011
Location: PLANET-SPIKE
Distribution: /LFS/Centos6.3/Debain
Posts: 1,762
Blog Entries: 1

Rep: Reputation: 245Reputation: 245Reputation: 245

The only 2 things as you know are the gcc version and glibc, These could well be the problem. So if you do decide to rebuild try using the svn version of lfs.
 
Old 06-06-2012, 05:16 PM   #17
anakletor
LQ Newbie
 
Registered: Jun 2012
Posts: 10

Original Poster
Rep: Reputation: Disabled
Ok, I might consider rebuilding with svn version next time. Thanks for your help!
 
Old 08-13-2012, 12:30 PM   #18
crow43
LQ Newbie
 
Registered: Aug 2012
Posts: 8

Rep: Reputation: Disabled
Same problem for me

Hi

I'm having the same problem. Please post a solution, or whatever you found to work, if you find it.

Best regards,
Crow
 
Old 08-13-2012, 12:41 PM   #19
spiky0011
Senior Member
 
Registered: Jan 2011
Location: PLANET-SPIKE
Distribution: /LFS/Centos6.3/Debain
Posts: 1,762
Blog Entries: 1

Rep: Reputation: 245Reputation: 245Reputation: 245
Hi Crow

Can you post what problems you are having.

Also what host are you using, which book you are following, and the output of version-check
 
Old 08-14-2012, 06:29 AM   #20
crow43
LQ Newbie
 
Registered: Aug 2012
Posts: 8

Rep: Reputation: Disabled
Certainly,

My problem is the same as anakletor described at the beginning of the thread; gcc is not working after I've chroot'ed to the LFS partition:
----------------------------------------------------------------
root:/# gcc
bash: /tools/bin/gcc: No such file or directory
----------------------------------------------------------------

As anakletor has described '$LFS/tools/bin/gcc' works fine when rooted in the host file system's root directory (before chroot'ing to $LFS that is).

I am building LFS 7.0 on an AMD Phenom II (quad core x86_64) machine and this is my second attempt. First attempt halted at the same problem and then I found the thread

http://www.linuxfromscratch.org/pipe...er/021058.html

This thread hinted me that I might have forgotten to clean up after installing the first pass of binutils. So I erased '$LFS/tools' and started over att chapter 4 taking great care to remove all extracted files and build output after having installed each package. But, as you can see, the problem remains so the cause must be something else.

I have now noticed that ldd reports some dependencies of '$LFS/tools/bin/gcc' that look suspicious to me:

----------------------------------------------------------------
$ ldd /mnt/lfs/tools/bin/gcc
linux-vdso.so.1 => (0x00007fff655ff000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f9959dc6000)
/lib64/ld-linux-x86-64.so.2 (0x00007f995a187000)
----------------------------------------------------------------

gcc should be linked to /tools/lib(64) and not /lib if I'm not mistaken and the shared object linux-vdso.so.1 does not exist in my LFS partition. This leads me to beleive that something went wrong when replacing /lib(64) with /tools/lib(64) in gcc's header files and/or when configuring gcc (5.10. GCC-4.6.1 - Pass 2). I think I verified the /tools/lib substitution when I performed it but it is quite possible that I've overlooked or misunderstood something.

So, I guess it's back to chapter 5 for me.

If you have any thoughts or comments please let me know, and any input on how to verify that gcc's configuration and the /tools/lib references are correct before building gcc is most welcome.

Also, can anyone with a working installation run 'ldd $LFS/tools/bin/gcc' and present the output?

Thank you for reading. Best regards,
Crow

PS. I'll upgrade to the latest version before continuing DS.

Last edited by crow43; 08-14-2012 at 06:43 AM.
 
Old 08-14-2012, 11:23 AM   #21
Keith Hedger
Senior Member
 
Registered: Jun 2010
Location: Devon,UK
Distribution: Linux From Scratch, Slackware64,
Posts: 1,005

Rep: Reputation: 218Reputation: 218Reputation: 218
Looks like you may have 32/64 bit problem lfs uses /lib /usr/lib for installed library's regardless of whether you are building 64 or 32 bit clfs sorts this problem ( sort of, it puts 64bit libs in /lib64 /usr/lib64 ), try
Code:
file /tools/bin/gcc
and see if you have a 32 or 64 bit gcc.

This "No such file or directory" error is the same for a non-existent file and the wrong elf type (32bit instead of 64bit), which isn't helpful!
 
Old 08-14-2012, 05:05 PM   #22
crow43
LQ Newbie
 
Registered: Aug 2012
Posts: 8

Rep: Reputation: Disabled
Hi Keith, thank you for you reply

gcc appears to be a 64-bit executable:
Code:
$ file /mnt/lfs/tools/bin/gcc
/mnt/lfs/tools/bin/gcc: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.15, not stripped
I don't think that the instruction set is the problem. Isn't it obvious that '/mnt/lfs/tools/bin/gcc' should have been linked to /tools/lib and not /lib?

BR
Crow
 
Old 08-15-2012, 05:30 AM   #23
Keith Hedger
Senior Member
 
Registered: Jun 2010
Location: Devon,UK
Distribution: Linux From Scratch, Slackware64,
Posts: 1,005

Rep: Reputation: 218Reputation: 218Reputation: 218
Stupid question I know but are you running a 64bit kernel on the host system ( you didn't say ) as processor type is not really relevant, you can run 32bit code on a 64bit kernel ( if you have a 64bit machine and 32bit infrastructure ) but not the other way around.

It definitely seems like the file is there and executable ( from your posted ls ) but can't be run for some reason, have you mounted the drive with the noexec flag set? It's very odd!
 
Old 08-15-2012, 05:44 AM   #24
Keith Hedger
Senior Member
 
Registered: Jun 2010
Location: Devon,UK
Distribution: Linux From Scratch, Slackware64,
Posts: 1,005

Rep: Reputation: 218Reputation: 218Reputation: 218
Just unpacked my tar'd up copy of tools and tried running gcc and got the exact same error "No such file or directory" so I put back the symlinks to the host system like so
Code:
sudo ln -sv /media/SkyNet/lfs/tools /tools
sudo ln -sv /media/SkyNet/lfs/cross-tools/ /cross-tools
and hey presto it works! so try this out ( you may not have the cross-tools folder I am using clfs not lfs )
Obviously change the path from /media/SkyNet/lfs/ to where ever your lfs system is mounted.
 
Old 08-16-2012, 10:45 AM   #25
crow43
LQ Newbie
 
Registered: Aug 2012
Posts: 8

Rep: Reputation: Disabled
'noexec' flag is not set, if it had been I don't believe that gcc or anything else in my LFS partition would have executed.

The symlinks you suggested are for the host filesystem, making '/tools' link to '/media/SkyNet/lfs/tools', and I have the corresponding symlink on my system:

Code:
$ ls -l / | grep tools
lrwxrwxrwx   1 root root    14 2012-02-15 14:37 tools -> /mnt/lfs/tools
Besides, once i chroot into /mnt/lfs then that link is no longer relevant, right?

What output do you get when you run
Code:
$ ldd /media/SkyNet/lfs/tools/bin/gcc
on your machine?

BR
Crow
 
Old 08-16-2012, 11:21 AM   #26
Keith Hedger
Senior Member
 
Registered: Jun 2010
Location: Devon,UK
Distribution: Linux From Scratch, Slackware64,
Posts: 1,005

Rep: Reputation: 218Reputation: 218Reputation: 218
From the host:
Code:
ldd /media/SkyNet/lfs/tools/bin/gcc
	linux-vdso.so.1 =>  (0x00007fffa4fff000)
	libc.so.6 => /tools/lib/libc.so.6 (0x00007ffa65d16000)
	/tools/lib/ld-linux-x86-64.so.2 (0x00007ffa6609d000)
you are right about the link - I must be brain dead at the moment.
Hmmm it seems your tools/bin/gcc is not linked to the same place as mine, mine is linked to /tools/lib* yours is /lib*, thats gotta be the problem.
 
1 members found this post helpful.
Old 08-17-2012, 08:15 AM   #27
crow43
LQ Newbie
 
Registered: Aug 2012
Posts: 8

Rep: Reputation: Disabled
Indeed! Thanks for the input. Now I have to figure out why mine got linked to /lib.

I'll try the LFS support mail list next. I think that I will also try rebuilding gcc pass 2. I imagine that a good sanity check afterwards would be to run

Code:
$ ldd /tools/bin/gcc
from the host filesystem and verify that LFS' gcc is linked to /tools/lib and not /lib.

I'll come back when/if I find something interesting.

BR
Crow
 
Old 01-26-2013, 01:41 PM   #28
crow43
LQ Newbie
 
Registered: Aug 2012
Posts: 8

Rep: Reputation: Disabled
Lightbulb Solved it

'SOLVED'
I have it figured out now: My mistake was to set the 'CC', 'AR' and 'RANLIB' variables separately before running 'configure', as opposed to setting them on the same line as calling 'configure'. I had no idea that the implications are different. As a result gcc was misconfigured for me. I guess that it might work to set them separately if you use 'export', but that's just a guess at the moment. Be safe and do what book says (obviously).

There are two sanity checks that one can run in order to ensure that gcc is correctly linked after pass 2: When logged on as user "lfs" issue

Code:
$ readelf -l /tools/bin/gcc | grep interpreter
or

Code:
$ ldd /tools/bin/gcc
and ensure that the output says something like "/tools/lib*" and not just "/lib*".

/ Crow
 
Old 10-30-2014, 01:45 AM   #29
aashil16
LQ Newbie
 
Registered: Oct 2014
Posts: 22

Rep: Reputation: Disabled
I did the same mistake as crow43 which he mentioned in the last post. Do I have to start over again ? Instead I tried compiling gcc again and make things work. I succeeded in GCC Pass-1 but in Pass-2 I get an error "gcc: command not found" Is there a solution to this ? I don't wan't to start over again. @spiky0011
 
Old 10-30-2014, 01:51 AM   #30
astrogeek
Senior Member
 
Registered: Oct 2008
Distribution: Slackware [64]X{.0|.1|.2|-current} ::X>=12<=14, FreeBSD_10{.0|.1}
Posts: 2,184

Rep: Reputation: 860Reputation: 860Reputation: 860Reputation: 860Reputation: 860Reputation: 860Reputation: 860
Quote:
Originally Posted by aashil16 View Post
I did the same mistake as crow43 which he mentioned in the last post. Do I have to start over again ? Instead I tried compiling gcc again and make things work. I succeeded in GCC Pass-1 but in Pass-2 I get an error "gcc: command not found" Is there a solution to this ? I don't wan't to start over again. @spiky0011
You have re-opened a thread begun in June 2012. It would be much easier to get help if you start your own thread.

Also, it is not very helpful to say "I did the same mistake as he did in the last post...", that does not provide any useful information for someone to be able to understand your problem.

Please start a new thread, provide as much useful information as you can, including what software you are compiling, what version and on what verison of Linux, as well as the error messages that you are getting.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
make: CC: Command not found make: *** [main.o] Error 127 on opensuse 11.3 Leo89 Linux - Newbie 6 11-30-2012 06:13 PM
gcc-4.5.2 - Pass 1 error -gcc command not found ?? adi_30stm Linux From Scratch 20 11-17-2011 01:23 PM
make fail with: gcc-3.4 command not found andy101 Ubuntu 3 11-27-2005 02:45 AM
VSFTPD make: gcc: Command not found Exutable Linux - Software 4 04-06-2005 03:15 PM


All times are GMT -5. The time now is 09: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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration