-sh: ./hello: not found

John Manousakis
Hello,

I have MINI2440. After successfully compiled hello example with
arm-linux-gcc 4.4.3, I try to execute the binary on the board, but i get
the following:

[root@FriendlyARM /]# ls -la /home/jmanous/
drwxr-sr-x    1 jmanous  503           512 Jan  1 00:09 .
drwxr-xr-x    1 root     root          512 Jun 26  2007 ..
-rw-r--r--    1 jmanous  503           355 Jan  1  1970 .ash_history
-rwxrwxrwx    1 jmanous  503         47126 Jan  1  1970
bzip2_1.0.5-1+lenny1_arm.deb
-rwxrwxrwx    1 jmanous  503          7860 Jan  1 00:07 hello



[root@FriendlyARM jmanous]# ./hello 
-sh: ./hello: not found

Any Ideas?
Thank You,
John.

Juergen Beisert
Run it in the following way:

[root@FriendlyARM jmanous]# LD_DEBUG=libs ./hello

It should show you what shared libraries it wants to use. Maybe some are
missing in your system.

John Manousakis
Thank you for your reply.

Unfortunately the output was identical.

[root@FriendlyARM jmanous]# LD_DEBUG=libs ./hello
-sh: ./hello: not found

I am wondering what could it be, a binary or a compiler problem?

Thank You,
John

davef
Have you done a readelf on hello?

TungPham
Try to dump your hello file and post the output here:
arm-linux-objdump -x ./hello ( in your host PC)

John Manousakis
Hello,

Thank you all for your suggestions,

I just figured out that file outputs:

/home/jmanous/ARM/examples/hello # file hello
hello: ELF 32-bit LSB executable, ARM, version 1 (SYSV), dynamically linked
(uses shared libs), for GNU/Linux 2.6.14, stripped

I run 2.6.13 :| But is that really the case? And if so, is there any
possibility to configure gcc to output executables for older versions?


Hexdump produces the following:

./hello:     file format elf32-littlearm
./hello
architecture: arm, flags 0x00000112:
EXEC_P, HAS_SYMS, D_PAGED
start address 0x000082c8

Program Header:
0x70000001 off    0x0000043c vaddr 0x0000843c paddr 0x0000843c align 2**2
         filesz 0x00000008 memsz 0x00000008 flags r--
    PHDR off    0x00000034 vaddr 0x00008034 paddr 0x00008034 align 2**2
         filesz 0x00000100 memsz 0x00000100 flags r-x
  INTERP off    0x00000134 vaddr 0x00008134 paddr 0x00008134 align 2**0
         filesz 0x00000013 memsz 0x00000013 flags r--
    LOAD off    0x00000000 vaddr 0x00008000 paddr 0x00008000 align 2**15
         filesz 0x00000448 memsz 0x00000448 flags r-x
    LOAD off    0x00000448 vaddr 0x00010448 paddr 0x00010448 align 2**15
         filesz 0x0000011c memsz 0x00000120 flags rw-
 DYNAMIC off    0x00000454 vaddr 0x00010454 paddr 0x00010454 align 2**2
         filesz 0x000000e8 memsz 0x000000e8 flags rw-
    NOTE off    0x00000148 vaddr 0x00008148 paddr 0x00008148 align 2**2
         filesz 0x00000020 memsz 0x00000020 flags r--
   STACK off    0x00000000 vaddr 0x00000000 paddr 0x00000000 align 2**2
         filesz 0x00000000 memsz 0x00000000 flags rw-

Dynamic Section:
  NEEDED               libc.so.6
  INIT                 0x8274
  FINI                 0x8418
  INIT_ARRAY           0x10448
  INIT_ARRAYSZ         0x4
  FINI_ARRAY           0x1044c
  FINI_ARRAYSZ         0x4
  HASH                 0x8168
  STRTAB               0x81e0
  SYMTAB               0x8190
  STRSZ                0x41
  SYMENT               0x10
  DEBUG                0x0
  PLTGOT               0x1053c
  PLTRELSZ             0x20
  PLTREL               0x11
  JMPREL               0x8254
  REL                  0x824c
  RELSZ                0x8
  RELENT               0x8
  VERNEED              0x822c
  VERNEEDNUM           0x1
  VERSYM               0x8222

Version References:
  required from libc.so.6:
    0x0d696914 0x00 02 GLIBC_2.4
private flags = 5000002: [Version5 EABI] [has entry point]

Sections:
Idx Name          Size      VMA       LMA       File off  Algn
  0 .interp       00000013  00008134  00008134  00000134  2**0
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  1 .note.ABI-tag 00000020  00008148  00008148  00000148  2**2
                  CONTENTS, ALLOC, LOAD, READONLY, DATA, LINK_ONCE_DISCARD
  2 .hash         00000028  00008168  00008168  00000168  2**2
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  3 .dynsym       00000050  00008190  00008190  00000190  2**2
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  4 .dynstr       00000041  000081e0  000081e0  000001e0  2**0
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  5 .gnu.version  0000000a  00008222  00008222  00000222  2**1
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  6 .gnu.version_r 00000020  0000822c  0000822c  0000022c  2**2
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  7 .rel.dyn      00000008  0000824c  0000824c  0000024c  2**2
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  8 .rel.plt      00000020  00008254  00008254  00000254  2**2
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  9 .init         00000010  00008274  00008274  00000274  2**2
                  CONTENTS, ALLOC, LOAD, READONLY, CODE
 10 .plt          00000044  00008284  00008284  00000284  2**2
                  CONTENTS, ALLOC, LOAD, READONLY, CODE
 11 .text         00000150  000082c8  000082c8  000002c8  2**2
                  CONTENTS, ALLOC, LOAD, READONLY, CODE
 12 .fini         0000000c  00008418  00008418  00000418  2**2
                  CONTENTS, ALLOC, LOAD, READONLY, CODE
 13 .rodata       00000018  00008424  00008424  00000424  2**2
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
 14 .ARM.exidx    00000008  0000843c  0000843c  0000043c  2**2
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
 15 .eh_frame     00000004  00008444  00008444  00000444  2**2
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
 16 .init_array   00000004  00010448  00010448  00000448  2**2
                  CONTENTS, ALLOC, LOAD, DATA
 17 .fini_array   00000004  0001044c  0001044c  0000044c  2**2
                  CONTENTS, ALLOC, LOAD, DATA
 18 .jcr          00000004  00010450  00010450  00000450  2**2
                  CONTENTS, ALLOC, LOAD, DATA
 19 .dynamic      000000e8  00010454  00010454  00000454  2**2
                  CONTENTS, ALLOC, LOAD, DATA
 20 .got          00000020  0001053c  0001053c  0000053c  2**2
                  CONTENTS, ALLOC, LOAD, DATA
 21 .data         00000008  0001055c  0001055c  0000055c  2**2
                  CONTENTS, ALLOC, LOAD, DATA
 22 .bss          00000004  00010564  00010564  00000564  2**0
                  ALLOC
 23 .comment      0000002a  00000000  00000000  00000564  2**0
                  CONTENTS, READONLY
 24 .ARM.attributes 00000028  00000000  00000000  0000058e  2**0
                  CONTENTS, READONLY
SYMBOL TABLE:
no symbols

Thank you again,
John

John Manousakis
Hello again,

I have found the solution. Since I am using an ancient kernel version, I
tried the also ancient gcc-3.3.2 and everything was fine. This version can
produce executables for kernel 2.0.0 and up.
Thank you for pointing to the right direction.

Sincerely,
John

Juergen Beisert
Ahh, yes. OABI versus EABI problem. BTW: why do you use such an old kernel?

John Manousakis
Because the setup was fast (this kernel was the newest supplied with the
dvd back in 2009). Newest kernels for mini2440 from here/downloads do not
just boot when I download them with the bootloader in NOR flash (they need
to be configured properly I guess).

Sincerely,
John

sateesh pilla
compile hello program with --static option
Ex: #arm-linux-gcc-4.4.3 hello.c --static -o hello

Happy knowledge sharing :-)

Juergen
Hi sateesh pilla,

but that doesn't help when you face an OABI/EABI issue.