LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux From Scratch (https://www.linuxquestions.org/questions/linux-from-scratch-13/)
-   -   problem with env while entering chroot'ed environment (https://www.linuxquestions.org/questions/linux-from-scratch-13/problem-with-env-while-entering-chrooted-environment-649410/)

trurl23 06-15-2008 07:57 AM

problem with env while entering chroot'ed environment
 
Hi Folks,

when I have completed compiling the toolchain (chapter 5) and I want to enter the chroot environment, chroot complains about /tools/bin/env not being found. I had the same problem with /tools/bin/bash before which was caused by bash being linked dynamically and those libs were not found.

I tried an ldd /tools/bin/env and found out that /tools/bin/env was also linked dynamically. If I understood it right, all programs in the first chain (from chapter 5) should be linked statically.

However I didn't find a way to make coreutils (6.10) link statically and there also wasn't any hint about this in the LFS book.

I read that linux-gate.so.1 is something like a "virtual" lib exposed by the kernel and libc.so.6 and ld-linux.so.2 are also present in /tools/lib.

The distribution used for creating the toolchain is Slackware 12.1.

Any suggestions what is wrong exactly and how to fix it?

Thanks,
Trurl

Failed command is
Quote:

chroot "$LFS" /tools/bin/env -i HOME=/root TERM="$TERM" PS1='\u:\w\$ ' PATH=/bin:/usr/bin:/sbin:/usr/sbin:/tools/bin /tools/bin/bash --login +h
chroot: cannot run command `/tools/bin/env': No such file or directory
Output from ldd /tools/bin/env:
Quote:

linux-gate.so.1 => (0xffffe000)
libc.so.6 => /lib/libc.so.6 (0xb7e61000)
/lib/ld-linux.so.2 (0xb7fdb000)

trurl23 06-15-2008 03:12 PM

fbbg
 
Ok, I figured out what was wrong. Making mistakes means learning...
Something went terribly wrong during creation of the linker. I also learned that linkinig dynamically at this stage is okay, but the library prefix should be /tools/lib rather than /lib when checked with ldd.
Just wanted to let you know, if you run into the same troubles, check your gcc compilation.


All times are GMT -5. The time now is 10:02 AM.