EDIT: i asked a wrong question, don't reed, see clarification below.
I have cross compiled two archive files a.a and b.a and statically linked them to an executable exe.elf . I have verified (following these instructions)weather my executable is indeed statically using readelf -dhl exe.elf:
user@host:~/program/bin$ readelf -dhl exe.elf
ELF Header:
Magic: 7f 45 4c 46 01 01 01 03 00 00 00 00 00 00 00 00
Class: ELF32
Data: 2's complement, little endian
Version: 1 (current)
OS/ABI: UNIX - GNU
ABI Version: 0
Type: EXEC (Executable file)
Machine: ARM
Version: 0x1
Entry point address: 0x12a45
Start of program headers: 52 (bytes into file)
Start of section headers: 13513704 (bytes into file)
Flags: 0x5000400, Version5 EABI, hard-float ABI
Size of this header: 52 (bytes)
Size of program headers: 32 (bytes)
Number of program headers: 7
Size of section headers: 40 (bytes)
Number of section headers: 40
Section header string table index: 39
Program Headers:
Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align
EXIDX 0x11c558 0x0012c558 0x0012c558 0x047a0 0x047a0 R 0x4
LOAD 0x000000 0x00010000 0x00010000 0x120cfc 0x120cfc R E 0x10000
LOAD 0x120f48 0x00140f48 0x00140f48 0x05ab8 0x0aa9c RW 0x10000
NOTE 0x000114 0x00010114 0x00010114 0x00044 0x00044 R 0x4
TLS 0x120f48 0x00140f48 0x00140f48 0x00038 0x000a0 R 0x4
GNU_STACK 0x000000 0x00000000 0x00000000 0x00000 0x00000 RW 0x10
GNU_RELRO 0x120f48 0x00140f48 0x00140f48 0x040b8 0x040b8 R 0x1
Section to Segment mapping:
Segment Sections...
00 .ARM.exidx
01 .note.ABI-tag .note.gnu.build-id .rel.dyn .init .iplt .text __libc_freeres_fn __libc_thread_freeres_fn .fini .rodata __libc_subfreeres __libc_IO_vtables __libc_atexit __libc_thread_subfreeres .ARM.extab .ARM.exidx .eh_frame
02 .tdata .init_array .fini_array .data.rel.ro .got .data .bss __libc_freeres_ptrs
03 .note.ABI-tag .note.gnu.build-id
04 .tdata .tbss
05
06 .tdata .init_array .fini_array .data.rel.ro
There is no dynamic section in this file.
As this tells me, there is no dynamic section in this file.
nm | grep " U "
spits out nothing checking for dynamic dependencies:
ldd exe.elf
not a dynamic executable
also tells me this is a static executable.
When i transfer my program to my target computer (armv7) and try to execute it, it dares to tell me that i am missing shared objects.
user@target:/program/bin$ ./exe.elf
./exe.elf: error while loading shared libraries: libfirstlibrary.so: cannot
open shared object file: No such file or directory.
i dont have binutils on my target computer as this is a very minimal linux setup, which is part of the reason why i need to compile statically. My $LD_LIBRARY_PATH is empty, but i should not be needing it ... right?
I have compiled my apparently static executable exe.elf using the linaro toolchain with g++ -static -l:libfirstlib.a -l:libsecondlib.a as suggested in this post. Can anybody help me clarify why my static library needs these shared objects? I will post further details if needed, i can't think of any more. Thanks.
EDIT: Apparently i have accidentally copied the dynamically linked version of the program to the target without noticing it, ...twice... . Now that i transfered the actual static executable it works. I am very sorry.