首页 > 代码库 > -/bin/sh: ./led: not found的解决办法
-/bin/sh: ./led: not found的解决办法
环境介绍:
开发板:qq2440
交叉编译器:arm-linux-gcc 3.4.1
内核版本:2.6.13
一.针对该类问题从两个方面入手:
1.从权限出发,权限不够会出现此问题
2.从库文件出发,一般是缺少库文件导致的
二.正好我今天遇到的是第二种情形:
1.查看应用程序led需要的库文件:arm-linux-readelf -a led,该命令输出的内容如下:
ELF Header:
Magic: 7f 45 4c 46 01 01 01 61 00 00 00 00 00 00 00 00
Class: ELF32
Data: 2‘s complement, little endian
Version: 1 (current)
OS/ABI: ARM
ABI Version: 0
Type: EXEC (Executable file)
Machine: ARM
Version: 0x1
Entry point address: 0x836c
Start of program headers: 52 (bytes into file)
Start of section headers: 3020 (bytes into file)
Flags: 0x2, has entry point, GNU EABI
Size of this header: 52 (bytes)
Size of program headers: 32 (bytes)
Number of program headers: 6
Size of section headers: 40 (bytes)
Number of section headers: 31
Section header string table index: 28
Section Headers:
[Nr] Name Type Addr Off Size ES Flg Lk Inf Al
[ 0] NULL 00000000 000000 000000 00 0 0 0
[ 1] .interp PROGBITS 000080f4 0000f4 000013 00 A 0 0 1
[ 2] .note.ABI-tag NOTE 00008108 000108 000020 00 A 0 0 4
[ 3] .hash HASH 00008128 000128 00003c 04 A 4 0 4
[ 4] .dynsym DYNSYM 00008164 000164 0000a0 10 A 5 1 4
[ 5] .dynstr STRTAB 00008204 000204 000077 00 A 0 0 1
[ 6] .gnu.version VERSYM 0000827c 00027c 000014 02 A 4 0 2
[ 7] .gnu.version_r VERNEED 00008290 000290 000020 00 A 5 1 4
[ 8] .rel.dyn REL 000082b0 0002b0 000008 08 A 4 0 4
[ 9] .rel.plt REL 000082b8 0002b8 000038 08 A 4 b 4
[10] .init PROGBITS 000082f0 0002f0 000014 00 AX 0 0 4
[11] .plt PROGBITS 00008304 000304 000068 04 AX 0 0 4
[12] .text PROGBITS 0000836c 00036c 000250 00 AX 0 0 4
[13] .fini PROGBITS 000085bc 0005bc 00000c 00 AX 0 0 4
[14] .rodata PROGBITS 000085c8 0005c8 00002c 00 A 0 0 4
[15] .data PROGBITS 000105f4 0005f4 00000c 00 WA 0 0 4
[16] .eh_frame PROGBITS 00010600 000600 000004 00 A 0 0 4
[17] .dynamic DYNAMIC 00010604 000604 0000c8 08 WA 5 0 4
[18] .ctors PROGBITS 000106cc 0006cc 000008 00 WA 0 0 4
[19] .dtors PROGBITS 000106d4 0006d4 000008 00 WA 0 0 4
[20] .jcr PROGBITS 000106dc 0006dc 000004 00 WA 0 0 4
[21] .got PROGBITS 000106e0 0006e0 00002c 04 WA 0 0 4
[22] .bss NOBITS 0001070c 00070c 000004 00 WA 0 0 1
[23] .comment PROGBITS 00000000 00070c 00007e 00 0 0 1
[24] .debug_aranges PROGBITS 00000000 000790 000058 00 0 0 8
[25] .debug_info PROGBITS 00000000 0007e8 00018e 00 0 0 1
[26] .debug_abbrev PROGBITS 00000000 000976 000020 00 0 0 1
[27] .debug_line PROGBITS 00000000 000996 000131 00 0 0 1
[28] .shstrtab STRTAB 00000000 000ac7 000103 00 0 0 1
[29] .symtab SYMTAB 00000000 0010a4 000910 10 30 72 4
[30] .strtab STRTAB 00000000 0019b4 0004bf 00 0 0 1
Key to Flags:
W (write), A (alloc), X (execute), M (merge), S (strings)
I (info), L (link order), G (group), x (unknown)
O (extra OS processing required) o (OS specific), p (processor specific)
Program Headers:
Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align
PHDR 0x000034 0x00008034 0x00008034 0x000c0 0x000c0 R E 0x4
INTERP 0x0000f4 0x000080f4 0x000080f4 0x00013 0x00013 R 0x1
[Requesting program interpreter: /lib/ld-linux.so.2]
LOAD 0x000000 0x00008000 0x00008000 0x005f4 0x005f4 R E 0x8000
LOAD 0x0005f4 0x000105f4 0x000105f4 0x00118 0x0011c RW 0x8000
DYNAMIC 0x000604 0x00010604 0x00010604 0x000c8 0x000c8 RW 0x4
NOTE 0x000108 0x00008108 0x00008108 0x00020 0x00020 R 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
03 .data .eh_frame .dynamic .ctors .dtors .jcr .got .bss
04 .dynamic
05 .note.ABI-tag
Dynamic segment at offset 0x604 contains 20 entries:
Tag Type Name/Value
0x00000001 (NEEDED) Shared library: [libc.so.6]
0x0000000c (INIT) 0x82f0
0x0000000d (FINI) 0x85bc
0x00000004 (HASH) 0x8128
0x00000005 (STRTAB) 0x8204
0x00000006 (SYMTAB) 0x8164
0x0000000a (STRSZ) 119 (bytes)
0x0000000b (SYMENT) 16 (bytes)
0x00000015 (DEBUG) 0x0
0x00000003 (PLTGOT) 0x106e0
0x00000002 (PLTRELSZ) 56 (bytes)
0x00000014 (PLTREL) REL
0x00000017 (JMPREL) 0x82b8
0x00000011 (REL) 0x82b0
0x00000012 (RELSZ) 8 (bytes)
0x00000013 (RELENT) 8 (bytes)
0x6ffffffe (VERNEED) 0x8290
0x6fffffff (VERNEEDNUM) 1
0x6ffffff0 (VERSYM) 0x827c
0x00000000 (NULL) 0x0
Relocation section ‘.rel.dyn‘ at offset 0x2b0 contains 1 entries:
Offset Info Type Sym.Value Sym. Name
00010708 00000915 R_ARM_GLOB_DAT 00000000 __gmon_start__
Relocation section ‘.rel.plt‘ at offset 0x2b8 contains 7 entries:
Offset Info Type Sym.Value Sym. Name
000106ec 00000116 R_ARM_JUMP_SLOT 00008318 abort
000106f0 00000216 R_ARM_JUMP_SLOT 00008324 sleep
000106f4 00000316 R_ARM_JUMP_SLOT 00008330 __libc_start_main
000106f8 00000416 R_ARM_JUMP_SLOT 0000833c printf
000106fc 00000516 R_ARM_JUMP_SLOT 00008348 open
00010700 00000616 R_ARM_JUMP_SLOT 00008354 ioctl
00010704 00000816 R_ARM_JUMP_SLOT 00000000 _Jv_RegisterClasses
There are no unwind sections in this file.
Symbol table ‘.dynsym‘ contains 10 entries:
Num: Value Size Type Bind Vis Ndx Name
0: 00000000 0 NOTYPE LOCAL DEFAULT UND
1: 00008318 508 FUNC GLOBAL DEFAULT UND abort@GLIBC_2.0 (2)
2: 00008324 380 FUNC GLOBAL DEFAULT UND sleep@GLIBC_2.0 (2)
3: 00008330 292 FUNC GLOBAL DEFAULT UND __libc_start_main@GLIBC_2.0 (2)
4: 0000833c 60 FUNC GLOBAL DEFAULT UND printf@GLIBC_2.0 (2)
5: 00008348 116 FUNC GLOBAL DEFAULT UND open@GLIBC_2.0 (2)
6: 00008354 16 FUNC GLOBAL DEFAULT UND ioctl@GLIBC_2.0 (2)
7: 000085c8 4 OBJECT GLOBAL DEFAULT 14 _IO_stdin_used
8: 00000000 0 NOTYPE WEAK DEFAULT UND _Jv_RegisterClasses
9: 00000000 0 NOTYPE WEAK DEFAULT UND __gmon_start__
Symbol table ‘.symtab‘ contains 145 entries:
Num: Value Size Type Bind Vis Ndx Name
0: 00000000 0 NOTYPE LOCAL DEFAULT UND
1: 000080f4 0 SECTION LOCAL DEFAULT 1
2: 00008108 0 SECTION LOCAL DEFAULT 2
3: 00008128 0 SECTION LOCAL DEFAULT 3
4: 00008164 0 SECTION LOCAL DEFAULT 4
5: 00008204 0 SECTION LOCAL DEFAULT 5
6: 0000827c 0 SECTION LOCAL DEFAULT 6
7: 00008290 0 SECTION LOCAL DEFAULT 7
8: 000082b0 0 SECTION LOCAL DEFAULT 8
9: 000082b8 0 SECTION LOCAL DEFAULT 9
10: 000082f0 0 SECTION LOCAL DEFAULT 10
11: 00008304 0 SECTION LOCAL DEFAULT 11
12: 0000836c 0 SECTION LOCAL DEFAULT 12
13: 000085bc 0 SECTION LOCAL DEFAULT 13
14: 000085c8 0 SECTION LOCAL DEFAULT 14
15: 000105f4 0 SECTION LOCAL DEFAULT 15
16: 00010600 0 SECTION LOCAL DEFAULT 16
17: 00010604 0 SECTION LOCAL DEFAULT 17
18: 000106cc 0 SECTION LOCAL DEFAULT 18
19: 000106d4 0 SECTION LOCAL DEFAULT 19
20: 000106dc 0 SECTION LOCAL DEFAULT 20
21: 000106e0 0 SECTION LOCAL DEFAULT 21
22: 0001070c 0 SECTION LOCAL DEFAULT 22
23: 00000000 0 SECTION LOCAL DEFAULT 23
24: 00000000 0 SECTION LOCAL DEFAULT 24
25: 00000000 0 SECTION LOCAL DEFAULT 25
26: 00000000 0 SECTION LOCAL DEFAULT 26
27: 00000000 0 SECTION LOCAL DEFAULT 27
28: 00000000 0 SECTION LOCAL DEFAULT 28
29: 00000000 0 SECTION LOCAL DEFAULT 29
30: 00000000 0 SECTION LOCAL DEFAULT 30
31: 00000000 0 FILE LOCAL DEFAULT ABS /work/crosstool-0.27/buil
32: 00000000 0 FILE LOCAL DEFAULT ABS /work/crosstool-0.27/buil
33: 00000000 0 FILE LOCAL DEFAULT ABS /work/crosstool-0.27/buil
34: 00000000 0 FILE LOCAL DEFAULT ABS initfini.c
35: 00000000 0 FILE LOCAL DEFAULT ABS /work/crosstool-0.27/buil
36: 00000000 0 FILE LOCAL DEFAULT ABS <command line>
37: 00000000 0 FILE LOCAL DEFAULT ABS ./../include/libc-symbols
38: 00000000 0 FILE LOCAL DEFAULT ABS /work/crosstool-0.27/buil
39: 00000000 0 FILE LOCAL DEFAULT ABS ./../include/libc-symbols
40: 00000000 0 FILE LOCAL DEFAULT ABS <command line>
41: 00000000 0 FILE LOCAL DEFAULT ABS <built-in>
42: 00000000 0 FILE LOCAL DEFAULT ABS /work/crosstool-0.27/buil
43: 000083a4 0 FUNC LOCAL DEFAULT 12 call_gmon_start
44: 000083a4 0 FUNC LOCAL DEFAULT 12 $a
45: 000083cc 0 OBJECT LOCAL DEFAULT 12 $d
46: 000082f0 0 FUNC LOCAL DEFAULT 10 $a
47: 00000000 0 FILE LOCAL DEFAULT ABS <command line>
48: 00000000 0 FILE LOCAL DEFAULT ABS ./../include/libc-symbols
49: 00000000 0 FILE LOCAL DEFAULT ABS /work/crosstool-0.27/buil
50: 00000000 0 FILE LOCAL DEFAULT ABS ./../include/libc-symbols
51: 00000000 0 FILE LOCAL DEFAULT ABS <command line>
52: 00000000 0 FILE LOCAL DEFAULT ABS <built-in>
53: 0000836c 0 FUNC LOCAL DEFAULT 12 $a
54: 000105f4 0 OBJECT LOCAL DEFAULT 15 $d
55: 00000000 0 FILE LOCAL DEFAULT ABS abi-note.S
56: 00000000 0 FILE LOCAL DEFAULT ABS /work/crosstool-0.27/buil
57: 00000000 0 FILE LOCAL DEFAULT ABS abi-note.S
58: 00000000 0 FILE LOCAL DEFAULT ABS /work/crosstool-0.27/buil
59: 00000000 0 FILE LOCAL DEFAULT ABS abi-note.S
60: 00000000 0 FILE LOCAL DEFAULT ABS <command line>
61: 00000000 0 FILE LOCAL DEFAULT ABS ./../include/libc-symbols
62: 00000000 0 FILE LOCAL DEFAULT ABS /work/crosstool-0.27/buil
63: 00000000 0 FILE LOCAL DEFAULT ABS ./../include/libc-symbols
64: 00000000 0 FILE LOCAL DEFAULT ABS <command line>
65: 00000000 0 FILE LOCAL DEFAULT ABS <built-in>
66: 00000000 0 FILE LOCAL DEFAULT ABS abi-note.S
67: 00000000 0 FILE LOCAL DEFAULT ABS init.c
68: 00000000 0 FILE LOCAL DEFAULT ABS crtstuff.c
69: 000106cc 0 OBJECT LOCAL DEFAULT 18 __CTOR_LIST__
70: 000106d4 0 OBJECT LOCAL DEFAULT 19 __DTOR_LIST__
71: 000106dc 0 OBJECT LOCAL DEFAULT 20 __JCR_LIST__
72: 000105fc 0 OBJECT LOCAL DEFAULT 15 p.0
73: 0001070c 1 OBJECT LOCAL DEFAULT 22 completed.1
74: 000083d4 0 FUNC LOCAL DEFAULT 12 __do_global_dtors_aux
75: 000083d4 0 FUNC LOCAL DEFAULT 12 $a
76: 00008420 0 OBJECT LOCAL DEFAULT 12 $d
77: 00008428 0 FUNC LOCAL DEFAULT 12 call___do_global_dtors_au
78: 00008428 0 FUNC LOCAL DEFAULT 12 $a
79: 00008430 0 FUNC LOCAL DEFAULT 12 frame_dummy
80: 00008450 0 OBJECT LOCAL DEFAULT 12 $d
81: 00008458 0 FUNC LOCAL DEFAULT 12 call_frame_dummy
82: 00008458 0 FUNC LOCAL DEFAULT 12 $a
83: 00000000 0 FILE LOCAL DEFAULT ABS crtstuff.c
84: 000106d0 0 OBJECT LOCAL DEFAULT 18 __CTOR_END__
85: 000106d8 0 OBJECT LOCAL DEFAULT 19 __DTOR_END__
86: 00010600 0 OBJECT LOCAL DEFAULT 16 __FRAME_END__
87: 000106dc 0 OBJECT LOCAL DEFAULT 20 __JCR_END__
88: 0000857c 0 FUNC LOCAL DEFAULT 12 __do_global_ctors_aux
89: 0000857c 0 FUNC LOCAL DEFAULT 12 $a
90: 000085b0 0 OBJECT LOCAL DEFAULT 12 $d
91: 000085b4 0 FUNC LOCAL DEFAULT 12 call___do_global_ctors_au
92: 000085b4 0 FUNC LOCAL DEFAULT 12 $a
93: 00000000 0 FILE LOCAL DEFAULT ABS /work/crosstool-0.27/buil
94: 00000000 0 FILE LOCAL DEFAULT ABS /work/crosstool-0.27/buil
95: 00000000 0 FILE LOCAL DEFAULT ABS /work/crosstool-0.27/buil
96: 00000000 0 FILE LOCAL DEFAULT ABS initfini.c
97: 00000000 0 FILE LOCAL DEFAULT ABS /work/crosstool-0.27/buil
98: 00000000 0 FILE LOCAL DEFAULT ABS <command line>
99: 00000000 0 FILE LOCAL DEFAULT ABS ./../include/libc-symbols
100: 00000000 0 FILE LOCAL DEFAULT ABS /work/crosstool-0.27/buil
101: 00000000 0 FILE LOCAL DEFAULT ABS ./../include/libc-symbols
102: 00000000 0 FILE LOCAL DEFAULT ABS <command line>
103: 00000000 0 FILE LOCAL DEFAULT ABS <built-in>
104: 00000000 0 FILE LOCAL DEFAULT ABS /work/crosstool-0.27/buil
105: 00008300 0 FUNC LOCAL DEFAULT 10 $a
106: 00000000 0 FILE LOCAL DEFAULT ABS led_test.c
107: 00008460 0 FUNC LOCAL DEFAULT 12 $a
108: 000084e0 0 OBJECT LOCAL DEFAULT 12 $d
109: 00000000 0 FILE LOCAL DEFAULT ABS elf-init.c
110: 000084e8 0 FUNC LOCAL DEFAULT 12 $a
111: 0000852c 0 OBJECT LOCAL DEFAULT 12 $d
112: 00008534 0 FUNC LOCAL DEFAULT 12 $a
113: 00008574 0 OBJECT LOCAL DEFAULT 12 $d
114: 00010604 0 OBJECT GLOBAL DEFAULT 17 _DYNAMIC
115: 00010710 0 NOTYPE GLOBAL DEFAULT ABS _bss_end__
116: 000105f4 0 NOTYPE GLOBAL DEFAULT ABS __fini_array_end
117: 0001070c 0 NOTYPE GLOBAL DEFAULT ABS __bss_start__
118: 000105f8 0 OBJECT GLOBAL HIDDEN 15 __dso_handle
119: 00008534 72 FUNC GLOBAL DEFAULT 12 __libc_csu_fini
120: 000082f0 0 FUNC GLOBAL DEFAULT 10 _init
121: 00008318 508 FUNC GLOBAL DEFAULT UND abort@@GLIBC_2.0
122: 00010710 0 NOTYPE GLOBAL DEFAULT ABS __bss_end__
123: 0000836c 0 FUNC GLOBAL DEFAULT 12 _start
124: 00008324 380 FUNC GLOBAL DEFAULT UND sleep@@GLIBC_2.0
125: 000105f4 0 NOTYPE GLOBAL DEFAULT ABS __fini_array_start
126: 000084e8 76 FUNC GLOBAL DEFAULT 12 __libc_csu_init
127: 0001070c 0 NOTYPE GLOBAL DEFAULT ABS __bss_start
128: 00008460 136 FUNC GLOBAL DEFAULT 12 main
129: 00008330 292 FUNC GLOBAL DEFAULT UND __libc_start_main@@GLIBC_
130: 000105f4 0 NOTYPE GLOBAL DEFAULT ABS __init_array_end
131: 00010710 0 NOTYPE GLOBAL DEFAULT ABS __end__
132: 000105f4 0 NOTYPE WEAK DEFAULT 15 data_start
133: 0000833c 60 FUNC GLOBAL DEFAULT UND printf@@GLIBC_2.0
134: 000085bc 0 FUNC GLOBAL DEFAULT 13 _fini
135: 00008348 116 FUNC GLOBAL DEFAULT UND open@@GLIBC_2.0
136: 0001070c 0 NOTYPE GLOBAL DEFAULT ABS _edata
137: 000106e0 0 OBJECT GLOBAL DEFAULT 21 _GLOBAL_OFFSET_TABLE_
138: 00010710 0 NOTYPE GLOBAL DEFAULT ABS _end
139: 00008354 16 FUNC GLOBAL DEFAULT UND ioctl@@GLIBC_2.0
140: 000105f4 0 NOTYPE GLOBAL DEFAULT ABS __init_array_start
141: 000085c8 4 OBJECT GLOBAL DEFAULT 14 _IO_stdin_used
142: 000105f4 0 NOTYPE GLOBAL DEFAULT 15 __data_start
143: 00000000 0 NOTYPE WEAK DEFAULT UND _Jv_RegisterClasses
144: 00000000 0 NOTYPE WEAK DEFAULT UND __gmon_start__
Histogram for bucket list length (total of 3 buckets):
Length Number % of total Coverage
0 0 ( 0.0%)
1 1 ( 33.3%) 11.1%
2 0 ( 0.0%) 11.1%
3 1 ( 33.3%) 44.4%
4 0 ( 0.0%) 44.4%
5 1 ( 33.3%) 100.0%
Version symbols section ‘.gnu.version‘ contains 10 entries:
Addr: 000000000000827c Offset: 0x00027c Link: 4 (.dynsym)
000: 0 (*local*) 2 (GLIBC_2.0) 2 (GLIBC_2.0) 2 (GLIBC_2.0)
004: 2 (GLIBC_2.0) 2 (GLIBC_2.0) 2 (GLIBC_2.0) 1 (*global*)
008: 0 (*local*) 0 (*local*)
Version needs section ‘.gnu.version_r‘ contains 1 entries:
Addr: 0x0000000000008290 Offset: 0x000290 Link to section: 5 (.dynstr)
000000: Version: 1 File: libc.so.6 Cnt: 1
0x0010: Name: GLIBC_2.0 Flags: none Version: 2
3.从这一句[Requesting program interpreter: /lib/ld-linux.so.2],可知我们还需要ld-linux.so.2这个库文件,因此从编译器的lib目录下找出所需的库,并将其复制到开发板所在的 /lib目录下
4.从这一句 0x00000001 (NEEDED) Shared library: [libc.so.6]可以得到该应用程序需要libc.so.6这个库文件,因此从编译器的lib目录下找出所需的库,并将其复制到开发板所在的 /lib目录下
-/bin/sh: ./led: not found的解决办法