Eu estou compilando um programa no meu PC (12.04) para meu beaglebone (12.04 armhf preciso). Mas quando eu tento executar o programa no beaglebone:
root@omap:/home/ubuntu/helloworld# ./helloworldtest
bash: ./helloworldtest: No such file or directory
Aqui estão algumas propriedades:
root@omap:/home/ubuntu/helloworld# file helloworldtest
helloworldtest: ELF 32-bit LSB executable, ARM, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.31, BuildID[sha1]=0xca0159e70b99493764b601a0195ee18be5e29b31, not stripped
root@omap:/home/ubuntu/helloworld# ls -la
total 80
drwxrwxr-x 2 ubuntu ubuntu 4096 Jul 20 07:51 .
drwxr-xr-x 5 ubuntu ubuntu 4096 Jul 20 07:50 ..
-rwxrwxrwx 1 ubuntu ubuntu 72739 Jul 20 07:42 helloworldtest
Eu procurei na net e descobri que a maioria das pessoas que tinha esse problema, tinha porque usava uma máquina de 64 bits para compilar o código, mas o processador do meu PC é de 32 bits e meu beaglebone também tem 32bits.
O mais estranho é que, eu posso rodar este programa no beaglebone se eu usar o Angstrom Linux, ao invés do Ubuntu 12.04 Precise Armhf. Portanto, tenho certeza de que não há nada de errado com o processo de compilação cruzada e com o programa de compilação cruzada.
Qual pode ser o problema?
Atenciosamente
edit: Provavelmente você vai instalar o ia32-libs mas não consigo instalar o ia32-libs:
root @ omap: ~ / helloworldtest # apt-get instalar ia32-libs
Lendo listas de pacotes ... Concluído
Construindo árvore de dependências
Lendo informações de estado ... Concluído
O pacote ia32-libs não está disponível, mas é referido por outro pacote.
Isso pode significar que o pacote está faltando, foi obsoleto ou
só está disponível em outra fonte
E: O pacote 'ia32-libs' não tem candidato de instalação
edit2: Aqui está a saída do ldd:
root@omap:/home/ubuntu/helloworld# ldd helloworldtest
not a dynamic executable
Eu compilei o mesmo programa na máquina de destino (beaglebone) e verifiquei a saída do ldd:
root@omap:~# ldd compiled_on_beaglebone
libgcc_s.so.1 => /lib/arm-linux-gnueabihf/libgcc_s.so.1 (0x400de000)
libc.so.6 => /lib/arm-linux-gnueabihf/libc.so.6 (0x400ef000)
/lib/ld-linux-armhf.so.3 (0x40086000)
Provavelmente, meu problema está relacionado a isso. Alguma idéia?
edit: 3 de acordo com o pedido do @JeremyKerr:
ubuntu@omap:~/helloworld$ readelf -hl helloworldtest
ELF Header:
Magic: 7f 45 4c 46 01 01 01 00 00 00 00 00 00 00 00 00
Class: ELF32
Data: 2's complement, little endian
Version: 1 (current)
OS/ABI: UNIX - System V
ABI Version: 0
Type: EXEC (Executable file)
Machine: ARM
Version: 0x1
Entry point address: 0x85ad
Start of program headers: 52 (bytes into file)
Start of section headers: 68360 (bytes into file)
Flags: 0x5000002, has entry point, Version5 EABI
Size of this header: 52 (bytes)
Size of program headers: 32 (bytes)
Number of program headers: 9
Size of section headers: 40 (bytes)
Number of section headers: 38
Section header string table index: 35
Program Headers:
Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align
EXIDX 0x00071c 0x0000871c 0x0000871c 0x00018 0x00018 R 0x4
PHDR 0x000034 0x00008034 0x00008034 0x00120 0x00120 R E 0x4
INTERP 0x000154 0x00008154 0x00008154 0x00013 0x00013 R 0x1
[Requesting program interpreter: /lib/ld-linux.so.3]
LOAD 0x000000 0x00008000 0x00008000 0x00738 0x00738 R E 0x8000
LOAD 0x000ef8 0x00010ef8 0x00010ef8 0x00144 0x001dc RW 0x8000
DYNAMIC 0x000f08 0x00010f08 0x00010f08 0x000f8 0x000f8 RW 0x4
NOTE 0x000168 0x00008168 0x00008168 0x00044 0x00044 R 0x4
GNU_STACK 0x000000 0x00000000 0x00000000 0x00000 0x00000 RW 0x4
GNU_RELRO 0x000ef8 0x00010ef8 0x00010ef8 0x00108 0x00108 R 0x1
Section to Segment mapping:
Segment Sections...
00 .ARM.exidx
01
02 .interp
03 .interp .note.ABI-tag .note.gnu.build-id .gnu.hash .dynsym .dynstr .gnu.version .gnu.version_r .rel.dyn .rel.plt .init .plt .text .fini .rodata .ARM.exidx .eh_frame
04 .init_array .fini_array .jcr .dynamic .got .data .bss
05 .dynamic
06 .note.ABI-tag .note.gnu.build-id
07
08 .init_array .fini_array .jcr .dynamic
edit 4: ldd e readelf -hl saídas do executável cross-compilado no Angstrom Linux de acordo com o pedido do @izx:
root@beaglebone:~# ldd hello
libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x401c3000)
libc.so.6 => /lib/libc.so.6 (0x401d4000)
/lib/ld-linux.so.3 (0x40098000)
root@beaglebone:~# readelf -hl hello
ELF Header:
Magic: 7f 45 4c 46 01 01 01 00 00 00 00 00 00 00 00 00
Class: ELF32
Data: 2's complement, little endian
Version: 1 (current)
OS/ABI: UNIX - System V
ABI Version: 0
Type: EXEC (Executable file)
Machine: ARM
Version: 0x1
Entry point address: 0x8380
Start of program headers: 52 (bytes into file)
Start of section headers: 2696 (bytes into file)
Flags: 0x5000002, has entry point, Version5 EABI
Size of this header: 52 (bytes)
Size of program headers: 32 (bytes)
Number of program headers: 8
Size of section headers: 40 (bytes)
Number of section headers: 38
Section header string table index: 35
Program Headers:
Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align
EXIDX 0x0004e0 0x000084e0 0x000084e0 0x00050 0x00050 R 0x4
PHDR 0x000034 0x00008034 0x00008034 0x00100 0x00100 R E 0x4
INTERP 0x000134 0x00008134 0x00008134 0x00013 0x00013 R 0x1
[Requesting program interpreter: /lib/ld-linux.so.3]
LOAD 0x000000 0x00008000 0x00008000 0x00534 0x00534 R E 0x8000
LOAD 0x000534 0x00010534 0x00010534 0x00124 0x00128 RW 0x8000
DYNAMIC 0x000540 0x00010540 0x00010540 0x000f0 0x000f0 RW 0x4
NOTE 0x000148 0x00008148 0x00008148 0x00020 0x00020 R 0x4
GNU_STACK 0x000000 0x00000000 0x00000000 0x00000 0x00000 RW 0x4
Section to Segment mapping:
Segment Sections...
00 .ARM.exidx
01
02 .interp
03 .interp .note.ABI-tag .hash .dynsym .dynstr .gnu.version .gnu.version_r .rel.dyn .rel.plt .init .plt .text .fini .rodata .ARM.extab .ARM.exidx .eh_frame
04 .init_array .fini_array .jcr .dynamic .got .data .bss
05 .dynamic
06 .note.ABI-tag
07