problems in chapter 6

Gijo kamafeu at rootshell.be
Mon Oct 16 12:10:13 PDT 2006


Gijo wrote:

> Chris Staub wrote:
>
>> Gijo wrote:
>>
>>> Hi,
>>>
>>>
>>> I had some problems in chapter 6 (lfs6.2) and maybe someone can help 
>>> me out, before i chroot, i did:
>>>
>>> echo 'main(){}' > dummy.c
>>> cc dummy.c
>>> readelf -l a.out | grep ': /tools'
>>>
>>> and got:
>>>
>>> [Requesting program interpreter: /tools/lib/ld-linux.so.2]
>>>
>>> but after entering the chrooted environment i could not use gcc or 
>>> readelf, which i fixed by linking /lib/ld-linux.so.2 to 
>>> /tools/lib/ld-linux.so.2
>>> but now when i redo the dummy.c check i get:
>>> [Requesting program interpreter: /lib/ld-linux.so.2]
>>>
>>>
>>> is this ok or am i doing something wrong?I's not normal to end up 
>>> with a broken gcc after chp5 right?
>>> thanks in advance...
>>>
>>> Gijo
>>>
>>
>> Do not create any symlink (unless of course the book tells you to). 
>> If something doesn't work inside chroot without the 
>> /lib/ld-linux.so.2 symlink, then you need to find out where the 
>> problem is before attempting to go any further. What is the output of 
>> "ldd /tools/bin/gcc"?
>
>
> With all my thinkering i've messed it all up, im going to rebuild 
> again, is there something i can do at the end of chp5 to be sure the 
> chrooted env won't be broken?
>
> Thanks and Best regards,
>
> Gijo

Outside the chrooted env:

lfs:~$ gcc -print-libgcc-file-name
/mnt/lfs/tools/bin/../lib/gcc/i686-pc-linux-gnu/4.0.3/libgcc.a
lfs:~$

Inside chrooted env:

root:/# gcc -print-libgcc-file-name
/tools/lib/gcc/i686-pc-linux-gnu/4.0.3/libgcc.a
root:/#

After rebuilding, gcc seems ok but the rest is the way gcc was before i 
rebuild the toolchain again...

lfs:~$ readelf -l /tools/bin/sed

Elf file type is EXEC (Executable file)
Entry point 0x80497e0
There are 7 program headers, starting at offset 52

Program Headers:
  Type           Offset   VirtAddr   PhysAddr   FileSiz MemSiz  Flg Align
  PHDR           0x000034 0x08048034 0x08048034 0x000e0 0x000e0 R E 0x4
  INTERP         0x000114 0x08048114 0x08048114 0x00019 0x00019 R   0x1
      [Requesting program interpreter: /tools/lib/ld-linux.so.2]
  LOAD           0x000000 0x08048000 0x08048000 0x16efc 0x16efc R E 0x1000
  LOAD           0x017000 0x0805f000 0x0805f000 0x003c0 0x053bc RW  0x1000
  DYNAMIC        0x017014 0x0805f014 0x0805f014 0x000c8 0x000c8 RW  0x4
  NOTE           0x000130 0x08048130 0x08048130 0x00020 0x00020 R   0x4
  GNU_STACK      0x000000 0x00000000 0x00000000 0x00000 0x00000 RW  0x4

 Section to Segment mapping:
  Segment Sections...
   00
   01     .interp
   02     .interp .note.ABI-tag .hash .dynsym .dynstr .gnu.version 
.gnu.version_
r .rel.dyn .rel.plt .init .plt .text .fini .rodata .eh_frame
   03     .ctors .dtors .jcr .dynamic .got .got.plt .data .bss
   04     .dynamic
   05     .note.ABI-tag
   06
lfs:~$ readelf -l /tools/bin/ld

Elf file type is EXEC (Executable file)
Entry point 0x80497f0
There are 8 program headers, starting at offset 52

Program Headers:
  Type           Offset   VirtAddr   PhysAddr   FileSiz MemSiz  Flg Align
  PHDR           0x000034 0x08048034 0x08048034 0x00100 0x00100 R E 0x4
  INTERP         0x000134 0x08048134 0x08048134 0x00013 0x00013 R   0x1
     * [Requesting program interpreter: /lib/ld-linux.so.2]*
  LOAD           0x000000 0x08048000 0x08048000 0xaab34 0xaab34 R E 0x1000
  LOAD           0x0aab34 0x080f3b34 0x080f3b34 0x007fc 0x05084 RW  0x1000
  DYNAMIC        0x0aab48 0x080f3b48 0x080f3b48 0x000c8 0x000c8 RW  0x4
  NOTE           0x000148 0x08048148 0x08048148 0x00020 0x00020 R   0x4
  GNU_EH_FRAME   0x0aaabc 0x080f2abc 0x080f2abc 0x0001c 0x0001c R   0x4
  GNU_STACK      0x000000 0x00000000 0x00000000 0x00000 0x00000 RW  0x4

 Section to Segment mapping:
  Segment Sections...
   00
   01     .interp
   02     .interp .note.ABI-tag .hash .dynsym .dynstr .gnu.version 
.gnu.version_r .rel.dyn .rel.plt .init .plt .text .fini .rodata 
.eh_frame_hdr .eh_frame
   03     .ctors .dtors .jcr .dynamic .got .got.plt .data .bss
   04     .dynamic
   05     .note.ABI-tag
   06     .eh_frame_hdr
   07
lfs:~$ readelf -l /tools/bin/gcc

Elf file type is EXEC (Executable file)
Entry point 0x8049300
There are 8 program headers, starting at offset 52

Program Headers:
  Type           Offset   VirtAddr   PhysAddr   FileSiz MemSiz  Flg Align
  PHDR           0x000034 0x08048034 0x08048034 0x00100 0x00100 R E 0x4
  INTERP         0x000134 0x08048134 0x08048134 0x00019 0x00019 R   0x1
      [Requesting program interpreter: /tools/lib/ld-linux.so.2]
  LOAD           0x000000 0x08048000 0x08048000 0x14440 0x14440 R E 0x1000
  LOAD           0x014440 0x0805d440 0x0805d440 0x00674 0x00a30 RW  0x1000
  DYNAMIC        0x014454 0x0805d454 0x0805d454 0x000c8 0x000c8 RW  0x4
  NOTE           0x000150 0x08048150 0x08048150 0x00020 0x00020 R   0x4
  GNU_EH_FRAME   0x0143c8 0x0805c3c8 0x0805c3c8 0x0001c 0x0001c R   0x4
  GNU_STACK      0x000000 0x00000000 0x00000000 0x00000 0x00000 RW  0x4

 Section to Segment mapping:
  Segment Sections...
   00
   01     .interp
   02     .interp .note.ABI-tag .hash .dynsym .dynstr .gnu.version 
.gnu.version_r .rel.dyn .rel.plt .init .plt .text .fini .rodata 
.eh_frame_hdr .eh_frame
   03     .ctors .dtors .jcr .dynamic .got .got.plt .data .bss
   04     .dynamic
   05     .note.ABI-tag
   06     .eh_frame_hdr
   07
lfs:~$ readelf -l /tools/bin/as

Elf file type is EXEC (Executable file)
Entry point 0x80495f0
There are 8 program headers, starting at offset 52

Program Headers:
  Type           Offset   VirtAddr   PhysAddr   FileSiz MemSiz  Flg Align
  PHDR           0x000034 0x08048034 0x08048034 0x00100 0x00100 R E 0x4
  INTERP         0x000134 0x08048134 0x08048134 0x00013 0x00013 R   0x1
*      [Requesting program interpreter: /lib/ld-linux.so.2]*
  LOAD           0x000000 0x08048000 0x08048000 0x99ab4 0x99ab4 R E 0x1000
  LOAD           0x09a000 0x080e2000 0x080e2000 0x00880 0x0db6c RW  0x1000
  DYNAMIC        0x09a014 0x080e2014 0x080e2014 0x000c8 0x000c8 RW  0x4
  NOTE           0x000148 0x08048148 0x08048148 0x00020 0x00020 R   0x4
  GNU_EH_FRAME   0x099a3c 0x080e1a3c 0x080e1a3c 0x0001c 0x0001c R   0x4
  GNU_STACK      0x000000 0x00000000 0x00000000 0x00000 0x00000 RW  0x4

 Section to Segment mapping:
  Segment Sections...
   00
   01     .interp
   02     .interp .note.ABI-tag .hash .dynsym .dynstr .gnu.version 
.gnu.version_r .rel.dyn .rel.plt .init .plt .text .fini .rodata 
.eh_frame_hdr .eh_frame
   03     .ctors .dtors .jcr .dynamic .got .got.plt .data .bss
   04     .dynamic
   05     .note.ABI-tag
   06     .eh_frame_hdr
   07
lfs:~$ readelf -l /tools/bin/make

Elf file type is EXEC (Executable file)
Entry point 0x8049980
There are 7 program headers, starting at offset 52

Program Headers:
  Type           Offset   VirtAddr   PhysAddr   FileSiz MemSiz  Flg Align
  PHDR           0x000034 0x08048034 0x08048034 0x000e0 0x000e0 R E 0x4
  INTERP         0x000114 0x08048114 0x08048114 0x00019 0x00019 R   0x1
      [Requesting program interpreter: /tools/lib/ld-linux.so.2]
  LOAD           0x000000 0x08048000 0x08048000 0x1f874 0x1f874 R E 0x1000
  LOAD           0x01f874 0x08068874 0x08068874 0x00a94 0x0118c RW  0x1000
  DYNAMIC        0x01f888 0x08068888 0x08068888 0x000d0 0x000d0 RW  0x4
  NOTE           0x000130 0x08048130 0x08048130 0x00020 0x00020 R   0x4
  GNU_STACK      0x000000 0x00000000 0x00000000 0x00000 0x00000 RW  0x4

 Section to Segment mapping:
  Segment Sections...
   00
   01     .interp
   02     .interp .note.ABI-tag .hash .dynsym .dynstr .gnu.version 
.gnu.version_r .rel.dyn .rel.plt .init .plt .text .fini .rodata .eh_frame
   03     .ctors .dtors .jcr .dynamic .got .got.plt .data .bss
   04     .dynamic
   05     .note.ABI-tag
   06
lfs:~$

some of the binaries got the wong ld-linux.so.2 path, and that's the 
problem for sure...i just dont know why...
Sorry for the long output, but i didn't know what would be relevant or 
not...

Thanks and Best regards,

Gijo





More information about the lfs-support mailing list