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.
These past few days I've been working on my first LFS build, using book version 7.10. I have come across an interesting error when trying to build the Linux API headers in step 6.7.1.
When executing the step:
Code:
make INSTALL_HDR_PATH=dest headers_install
I receive the following output:
Quote:
CHK include/generated/uapi/linux/version.h
HOSTCC scripts/basic/fixdep
gcc: error trying to exec '/tools/lib/gcc/i686-pc-linux-gnu/6.2.0/../../../../i686-pc-linux-gnu/bin/as': execv: No such file or directory
make[1]: *** [scripts/Makefile.host:91: scripts/basic/fixdep] Error 1
make: *** [Makefile:446: scripts_basic] Error 2
As it appears I have a missing binary, I figured I made an error in one of the previous steps. I checked whether the file even exists, and the interesting part is: apparently it does. I can cd into the directory /tools/lib/gcc/i686-pc-linux-gnu/6.2.0/../../../../i686-pc-linux-gnu/bin, and the binary 'as' is there:
Quote:
root:/tools/i686-pc-linux-gnu/bin# ls -il
total 50256
309411 -rwxr-xr-x 2 root root 4658696 Dec 19 17:02 ar
309390 -rwxr-xr-x 2 root root 7003248 Dec 21 10:15 as
309392 -rwxr-xr-x 4 root root 6106088 Dec 19 17:02 ld
309392 -rwxr-xr-x 4 root root 6106088 Dec 19 17:02 ld.bfd
309418 -rwxr-xr-x 2 root root 4487116 Dec 19 17:02 nm
309414 -rwxr-xr-x 2 root root 5299236 Dec 19 17:02 objcopy
309410 -rwxr-xr-x 2 root root 6414160 Dec 19 17:02 objdump
309413 -rwxr-xr-x 2 root root 4658692 Dec 19 17:02 ranlib
309416 -rwxr-xr-x 2 root root 1414504 Dec 19 17:02 readelf
309419 -rwxr-xr-x 2 root root 5299236 Dec 19 17:02 strip
The time stamp is there because I tried touching it; as in real life, I just start poking stuff to see if it will wake up When trying to execute it, this happens:
Code:
root:/tools/i686-pc-linux-gnu/bin# ./as
Quote:
bash: ./as: No such file or directory
Even odder: I can execute the file from the host system (Ubuntu 16.10).
I have tried rebooting the host, re-mounting the LFS partition, re-setting the $LFS variable, re-mounting/populating /dev (step 6.2.2), re-mounting the Virtual Kernel File Systems (6.2.3) and re-chrooting (6.4), but to no avail. What bugs me particularly is the fact that I have an executable that 'does not exist' in my new environment, while I can clearly see it sitting there.
Would anyone have any idea what might have caused this, and how I can either solve it or prevent from making the same mistake in the future?
Excuse me if I'm over-simplifying things (I'm new at this, too), but because you see the file there and can execute it from the host, it seems like you somehow don't have a proper path env. Either $PATH isn't what it should be, or when compiling ar's package you missed a step. Have you tried reinstalling the package ar came from, then redoing step 6.7.1?
Thanks for your reply! Could the $PATH be the issue if I invoke the binary directly? I.e., if I'm in the directory and I try a ./as, I will still get the "No such file or directory" message. There might have been a faulty setting during the build of the specific binaries though.
My current reasoning is that either I messed up a step in the book (forgetting to set an environment variable for the build, or skipping some instruction), or my host OS is causing a bit of an issue. To eliminate both, I'm considering restarting the build over the weekend with a different host OS (Slackware 14.2).
One question remains though: how is it possible that I can see the file, but when I try to run it, I get a "No such file or directory"? Especially when the exact same file in the exact same location is executable from the host?
Yeah, an unfortunate possibility is that the binary runs from the host install because of cross-contamination, and it's using dependencies from the host. That might explain why it doesn't execute from the LFS build. (But I'm guessing here.)
Before starting over, maybe double check a couple things. (Apologies if you already have.) Like, when you 'echo $PATH', is 'tools/bin' in there at the end, and is everything else present that should be in your path? And did you following 6.2.2, 6.2.3 and 6.4 before trying to execute 'as', in case you've logged out and back in since doing so?
Thanks again for thinking along. I verified the PATH and I re-did steps 6.2.2, 6.2.3 and 6.4 just to make sure -- same error. I installed Slackware 14.2 last night, and gave LFS another go, and now the specific binary is executable. Will be arriving at 6.7.1 anytime soon now, but I'm confident that I will be able to move on.
I think I have figured out the error, too. You know how in the book they tell you:
Quote:
3. For each package:
a. Using the tar program, extract the package to be built. In Chapter 5, ensure you are the lfs user
when extracting the package.
b. Change to the directory created when the package was extracted.
c. Follow the book's instructions for building the package.
d. Change back to the sources directory. e. Delete the extracted source directory unless instructed otherwise.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.