Hello,
I chrooted into my LFS partition and noticed something peculiar, i
cant execute dynamically linked executables.
Note: My PWD is /, inside the chroot
./configure gives
Output
configure: error: cannot run C compiled programs
/Output
So I compiled a toy program
snip
int main () {return 0;}
/snip
and i compiled it using the command:
Compile
cc /tmp/test.c
/Compile
Output
/a.out
/bin/sh: /a.out: not found
/Output
So i statically compile strace, put it in my LFS chroot and i get
Strace
strace /a.out
execve(/a.out, [/a.out], [/* 13 vars */]) = -1 ENOENT (No such
file or directory)
dup(2) = 3
fcntl64(3, F_GETFL) = 0x2 (flags O_RDWR)
fstat64(3, {st_mode=S_IFCHR|0620, st_rdev=makedev(136, 0), ...}) = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1,
0) = 0xb7776000
_llseek(3, 0, 0xbf8d30ac, SEEK_CUR) = -1 ESPIPE (Illegal seek)
write(3, strace: exec: No such file or di..., 40strace: exec: No
such file or directory
) = 40
close(3)= 0
munmap(0xb7776000, 4096)= 0
exit_group(1) = ?
/Strace
Now I recompile the test program as a static binary
Compile
cc /tmp/test.c -static
/Compile
Output
/a.out
Segmentation fault
/Output
And i get the strace output:
Strace
strace /a.out
execve(/a.out, [/a.out], [/* 13 vars */]) = 0
--- {si_signo=SIGSEGV, si_code=SEGV_MAPERR, si_addr=0} (Segmentation fault) ---
+++ killed by SIGSEGV +++
Segmentation fault
/Strace
So i install ucibc on my normal machine and try to run the executable,
[NORMAL-MACHINE]$ file /tmp/a.out
/tmp/a.out: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV),
dynamically linked (uses shared libs), not stripped
[NORMAL-MACHINE]$ gdb /tmp/a.out
snip
and show warranty for details.
This GDB was configured as i486-linux-gnu.
For bug reporting instructions, please see:
http://www.gnu.org/software/gdb/bugs/...
/tmp/a.out: not in executable format: File format not recognized
/snip
What could be wrong ??
Regards,
Harish
--
http://linuxfromscratch.org/mailman/listinfo/lfs-support
FAQ: http://www.linuxfromscratch.org/lfs/faq.html
Unsubscribe: See the above information page