Linux From ScratchThis 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
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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.
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
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:
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.
Distribution: Void, Linux From Scratch, Slackware64
Posts: 3,155
Rep:
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!
$ 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?
Distribution: Void, Linux From Scratch, Slackware64
Posts: 3,155
Rep:
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!
Distribution: Void, Linux From Scratch, Slackware64
Posts: 3,155
Rep:
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
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.
'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:
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.
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.
'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*".
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
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.