2010-04-26 459 views
103

我在Ubuntu 9.10 x86_64上安装了二进制Linux应用程序。随旧版本的gzip(1.2.4)的应用程序,这是编译为一个更老的内核:执行二进制文件时出现“No such file or directory”错误

$ file gzip 
gzip: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.0.0, stripped 

我是不是能够执行该程序。如果我想,这个事情发生了:

$ ./gzip 
-bash: ./gzip: No such file or directory 

LDD也同样不满这个二进制:

$ ldd gzip 
     not a dynamic executable 

我很好奇:这是什么问题的最可能的来源?损坏的文件?还是由于为更老的{kernel,libc,...}而构建的二进制不兼容?

每号的suggestsions,这里的strace ./gzip输出:

execve("./gzip", ["./gzip"], [/* 24 vars */]) = -1 ENOENT (No such file or directory) 
dup(2)         = 3 
fcntl(3, F_GETFL)      = 0x8002 (flags O_RDWR|O_LARGEFILE) 
fstat(3, {st_mode=S_IFCHR|0620, st_rdev=makedev(136, 10), ...}) = 0 
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fa8c9eee000 
lseek(3, 0, 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(0x7fa8c9eee000, 4096)   = 0 
exit_group(1)       = ? 

这里是readelf -a ./gzip输出:

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:       Intel 80386 
    Version:       0x1 
    Entry point address:    0x8048d20 
    Start of program headers:   52 (bytes into file) 
    Start of section headers:   46852 (bytes into file) 
    Flags:        0x0 
    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:   26 
    Section header string table index: 25 

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  080480f4 0000f4 000013 00 A 0 0 1 
    [ 2] .note.ABI-tag  NOTE   08048108 000108 000020 00 A 0 0 4 
    [ 3] .hash    HASH   08048128 000128 000178 04 A 4 0 4 
    [ 4] .dynsym   DYNSYM   080482a0 0002a0 000370 10 A 5 1 4 
    [ 5] .dynstr   STRTAB   08048610 000610 0001ee 00 A 0 0 1 
    [ 6] .gnu.version  VERSYM   080487fe 0007fe 00006e 02 A 4 0 2 
    [ 7] .gnu.version_r VERNEED   0804886c 00086c 000030 00 A 5 1 4 
    [ 8] .rel.got   REL    0804889c 00089c 000008 08 A 4 20 4 
    [ 9] .rel.bss   REL    080488a4 0008a4 000030 08 A 4 22 4 
    [10] .rel.plt   REL    080488d4 0008d4 000158 08 A 4 12 4 
    [11] .init    PROGBITS  08048a2c 000a2c 00002f 00 AX 0 0 4 
    [12] .plt    PROGBITS  08048a5c 000a5c 0002c0 04 AX 0 0 4 
    [13] .text    PROGBITS  08048d20 000d20 007f4c 00 AX 0 0 16 
    [14] .fini    PROGBITS  08050c6c 008c6c 00001a 00 AX 0 0 4 
    [15] .rodata   PROGBITS  08050ca0 008ca0 001751 00 A 0 0 32 
    [16] .data    PROGBITS  08053400 00a400 000ab4 00 WA 0 0 32 
    [17] .eh_frame   PROGBITS  08053eb4 00aeb4 000004 00 WA 0 0 4 
    [18] .ctors   PROGBITS  08053eb8 00aeb8 000008 00 WA 0 0 4 
    [19] .dtors   PROGBITS  08053ec0 00aec0 000008 00 WA 0 0 4 
    [20] .got    PROGBITS  08053ec8 00aec8 0000bc 04 WA 0 0 4 
    [21] .dynamic   DYNAMIC   08053f84 00af84 0000a0 08 WA 5 0 4 
    [22] .bss    NOBITS   08054040 00b040 050630 00 WA 0 0 32 
    [23] .comment   PROGBITS  00000000 00b040 000487 00  0 0 1 
    [24] .note    NOTE   00000487 00b4c7 00017c 00  0 0 1 
    [25] .shstrtab   STRTAB   00000000 00b643 0000be 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) 

There are no section groups in this file. 

Program Headers: 
    Type   Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align 
    PHDR   0x000034 0x08048034 0x08048034 0x000c0 0x000c0 R E 0x4 
    INTERP   0x0000f4 0x080480f4 0x080480f4 0x00013 0x00013 R 0x1 
     [Requesting program interpreter: /lib/ld-linux.so.2] 
    LOAD   0x000000 0x08048000 0x08048000 0x0a3f1 0x0a3f1 R E 0x1000 
    LOAD   0x00a400 0x08053400 0x08053400 0x00c24 0x51270 RW 0x1000 
    DYNAMIC  0x00af84 0x08053f84 0x08053f84 0x000a0 0x000a0 RW 0x4 
    NOTE   0x000108 0x08048108 0x08048108 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.got .rel.bss .rel.plt .init .plt .text .fini .rodata 
    03  .data .eh_frame .ctors .dtors .got .dynamic .bss 
    04  .dynamic 
    05  .note.ABI-tag 

Dynamic section at offset 0xaf84 contains 20 entries: 
    Tag  Type       Name/Value 
0x00000001 (NEEDED)      Shared library: [libc.so.6] 
0x0000000c (INIT)      0x8048a2c 
0x0000000d (FINI)      0x8050c6c 
0x00000004 (HASH)      0x8048128 
0x00000005 (STRTAB)      0x8048610 
0x00000006 (SYMTAB)      0x80482a0 
0x0000000a (STRSZ)      474 (bytes) 
0x0000000b (SYMENT)      16 (bytes) 
0x00000015 (DEBUG)      0x0 
0x00000003 (PLTGOT)      0x8053ec8 
0x00000002 (PLTRELSZ)     344 (bytes) 
0x00000014 (PLTREL)      REL 
0x00000017 (JMPREL)      0x80488d4 
0x00000011 (REL)      0x804889c 
0x00000012 (RELSZ)      56 (bytes) 
0x00000013 (RELENT)      8 (bytes) 
0x6ffffffe (VERNEED)     0x804886c 
0x6fffffff (VERNEEDNUM)     1 
0x6ffffff0 (VERSYM)      0x80487fe 
0x00000000 (NULL)      0x0 

Relocation section '.rel.got' at offset 0x89c contains 1 entries: 
Offset  Info Type   Sym.Value Sym. Name 
08053f80 00000106 R_386_GLOB_DAT 00000000 __gmon_start__ 

Relocation section '.rel.bss' at offset 0x8a4 contains 6 entries: 
Offset  Info Type   Sym.Value Sym. Name 
08054040 00000505 R_386_COPY  08054040 stdout 
08054044 00002705 R_386_COPY  08054044 stderr 
08054048 00000805 R_386_COPY  08054048 __ctype_b 
0805404c 00001f05 R_386_COPY  0805404c stdin 
08054050 00001005 R_386_COPY  08054050 optarg 
08054054 00001e05 R_386_COPY  08054054 optind 

Relocation section '.rel.plt' at offset 0x8d4 contains 43 entries: 
Offset  Info Type   Sym.Value Sym. Name 
08053ed4 00000307 R_386_JUMP_SLOT 08048a6c chown 
08053ed8 00003407 R_386_JUMP_SLOT 08048a7c __register_frame_info 
08053edc 00001907 R_386_JUMP_SLOT 08048a8c write 
08053ee0 00002e07 R_386_JUMP_SLOT 08048a9c fileno 
08053ee4 00002607 R_386_JUMP_SLOT 08048aac strcmp 
08053ee8 00003507 R_386_JUMP_SLOT 08048abc close 
08053eec 00000d07 R_386_JUMP_SLOT 08048acc perror 
08053ef0 00001a07 R_386_JUMP_SLOT 08048adc fprintf 
08053ef4 00000907 R_386_JUMP_SLOT 08048aec getenv 
08053ef8 00002007 R_386_JUMP_SLOT 08048afc signal 
08053efc 00001207 R_386_JUMP_SLOT 08048b0c fflush 
08053f00 00002407 R_386_JUMP_SLOT 08048b1c unlink 
08053f04 00002a07 R_386_JUMP_SLOT 08048b2c __errno_location 
08053f08 00001407 R_386_JUMP_SLOT 08048b3c chmod 
08053f0c 00000e07 R_386_JUMP_SLOT 08048b4c malloc 
08053f10 00001d07 R_386_JUMP_SLOT 08048b5c __deregister_frame_inf 
08053f14 00002907 R_386_JUMP_SLOT 08048b6c __xstat 
08053f18 00000b07 R_386_JUMP_SLOT 08048b7c fgets 
08053f1c 00002c07 R_386_JUMP_SLOT 08048b8c __fxstat 
08053f20 00001507 R_386_JUMP_SLOT 08048b9c __lxstat 
08053f24 00000a07 R_386_JUMP_SLOT 08048bac __strtol_internal 
08053f28 00002207 R_386_JUMP_SLOT 08048bbc strncmp 
08053f2c 00003007 R_386_JUMP_SLOT 08048bcc __libc_start_main 
08053f30 00001c07 R_386_JUMP_SLOT 08048bdc strcat 
08053f34 00000407 R_386_JUMP_SLOT 08048bec printf 
08053f38 00001307 R_386_JUMP_SLOT 08048bfc lseek 
08053f3c 00000c07 R_386_JUMP_SLOT 08048c0c memcpy 
08053f40 00001607 R_386_JUMP_SLOT 08048c1c strrchr 
08053f44 00001b07 R_386_JUMP_SLOT 08048c2c ctime 
08053f48 00000707 R_386_JUMP_SLOT 08048c3c getopt_long 
08053f4c 00003207 R_386_JUMP_SLOT 08048c4c closedir 
08053f50 00002507 R_386_JUMP_SLOT 08048c5c opendir 
08053f54 00003107 R_386_JUMP_SLOT 08048c6c open 
08053f58 00002b07 R_386_JUMP_SLOT 08048c7c exit 
08053f5c 00001807 R_386_JUMP_SLOT 08048c8c calloc 
08053f60 00002d07 R_386_JUMP_SLOT 08048c9c _IO_putc 
08053f64 00003607 R_386_JUMP_SLOT 08048cac free 
08053f68 00000607 R_386_JUMP_SLOT 08048cbc utime 
08053f6c 00000f07 R_386_JUMP_SLOT 08048ccc isatty 
08053f70 00002307 R_386_JUMP_SLOT 08048cdc strncpy 
08053f74 00001107 R_386_JUMP_SLOT 08048cec readdir 
08053f78 00002107 R_386_JUMP_SLOT 08048cfc read 
08053f7c 00000207 R_386_JUMP_SLOT 08048d0c strcpy 

There are no unwind sections in this file. 

Symbol table '.dynsym' contains 55 entries: 
    Num: Value Size Type Bind Vis  Ndx Name 
    0: 00000000  0 NOTYPE LOCAL DEFAULT UND 
    1: 00000000  0 NOTYPE WEAK DEFAULT UND __gmon_start__ 
    2: 08048d0c 34 FUNC GLOBAL DEFAULT UND [email protected]_2.0 (3) 
    3: 08048a6c 136 FUNC GLOBAL DEFAULT UND [email protected]_2.1 (2) 
    4: 08048bec 41 FUNC GLOBAL DEFAULT UND [email protected]_2.0 (3) 
    5: 08054040  4 OBJECT GLOBAL DEFAULT 22 [email protected]_2.0 (3) 
    6: 08048cbc 59 FUNC GLOBAL DEFAULT UND [email protected]_2.0 (3) 
    7: 08048c3c 43 FUNC GLOBAL DEFAULT UND [email protected]_2.0 (3) 
    8: 08054048  4 OBJECT GLOBAL DEFAULT 22 [email protected]_2.0 (3) 
    9: 08048aec 224 FUNC GLOBAL DEFAULT UND [email protected]_2.0 (3) 
    10: 08048bac 1106 FUNC GLOBAL DEFAULT UND [email protected]_2.0 (3) 
    11: 08048b7c 202 FUNC WEAK DEFAULT UND [email protected]_2.0 (3) 
    12: 08048c0c 62 FUNC GLOBAL DEFAULT UND [email protected]_2.0 (3) 
    13: 08048acc 111 FUNC GLOBAL DEFAULT UND [email protected]_2.0 (3) 
    14: 08048b4c 338 FUNC WEAK DEFAULT UND [email protected]_2.0 (3) 
    15: 08048ccc 46 FUNC WEAK DEFAULT UND [email protected]_2.0 (3) 
    16: 08054050  4 OBJECT GLOBAL DEFAULT 22 [email protected]_2.0 (3) 
    17: 08048cec 142 FUNC WEAK DEFAULT UND [email protected]_2.0 (3) 
    18: 08048b0c 152 FUNC WEAK DEFAULT UND [email protected]_2.0 (3) 
    19: 08048bfc 61 FUNC WEAK DEFAULT UND [email protected]_2.0 (3) 
    20: 08048b3c 59 FUNC WEAK DEFAULT UND [email protected]_2.0 (3) 
    21: 08048b9c 314 FUNC GLOBAL DEFAULT UND [email protected]_2.0 (3) 
    22: 08048c1c 441 FUNC GLOBAL DEFAULT UND [email protected]_2.0 (3) 
    23: 0804f608 29 FUNC GLOBAL DEFAULT 13 basename 
    24: 08048c8c 563 FUNC WEAK DEFAULT UND [email protected]_2.0 (3) 
    25: 08048a8c 61 FUNC WEAK DEFAULT UND [email protected]_2.0 (3) 
    26: 08048adc 36 FUNC GLOBAL DEFAULT UND [email protected]_2.0 (3) 
    27: 08048c2c 35 FUNC GLOBAL DEFAULT UND [email protected]_2.0 (3) 
    28: 08048bdc 49 FUNC GLOBAL DEFAULT UND [email protected]_2.0 (3) 
    29: 08048b5c 162 FUNC WEAK DEFAULT UND [email protected]_2.0 (3) 
    30: 08054054  4 OBJECT GLOBAL DEFAULT 22 [email protected]_2.0 (3) 
    31: 0805404c  4 OBJECT GLOBAL DEFAULT 22 [email protected]_2.0 (3) 
    32: 08048afc 181 FUNC WEAK DEFAULT UND [email protected]_2.0 (3) 
    33: 08048cfc 61 FUNC WEAK DEFAULT UND [email protected]_2.0 (3) 
    34: 08048bbc 148 FUNC GLOBAL DEFAULT UND [email protected]_2.0 (3) 
    35: 08048cdc 147 FUNC GLOBAL DEFAULT UND [email protected]_2.0 (3) 
    36: 08048b1c 55 FUNC WEAK DEFAULT UND [email protected]_2.0 (3) 
    37: 08048c5c 412 FUNC WEAK DEFAULT UND [email protected]_2.0 (3) 
    38: 08048aac 58 FUNC GLOBAL DEFAULT UND [email protected]_2.0 (3) 
    39: 08054044  4 OBJECT GLOBAL DEFAULT 22 [email protected]_2.0 (3) 
    40: 0804f7fc 40 FUNC GLOBAL DEFAULT 13 error 
    41: 08048b6c 314 FUNC GLOBAL DEFAULT UND [email protected]_2.0 (3) 
    42: 08048b2c 27 FUNC WEAK DEFAULT UND [email protected]_2.0 (3) 
    43: 08048c7c 200 FUNC GLOBAL DEFAULT UND [email protected]_2.0 (3) 
    44: 08048b8c 314 FUNC GLOBAL DEFAULT UND [email protected]_2.0 (3) 
    45: 08048c9c 150 FUNC GLOBAL DEFAULT UND [email protected]_2.0 (3) 
    46: 08048a9c 53 FUNC GLOBAL DEFAULT UND [email protected]_2.0 (3) 
    47: 08050ca4  4 OBJECT GLOBAL DEFAULT 15 _IO_stdin_used 
    48: 08048bcc 261 FUNC GLOBAL DEFAULT UND [email protected]_2.0 (3) 
    49: 08048c6c 61 FUNC WEAK DEFAULT UND [email protected]_2.0 (3) 
    50: 08048c4c 112 FUNC WEAK DEFAULT UND [email protected]_2.0 (3) 
    51: 0804f824 66 FUNC GLOBAL DEFAULT 13 warn 
    52: 08048a7c 116 FUNC WEAK DEFAULT UND [email protected]_2.0 (3) 
    53: 08048abc 55 FUNC WEAK DEFAULT UND [email protected]_2.0 (3) 
    54: 08048cac 202 FUNC WEAK DEFAULT UND [email protected]_2.0 (3) 

Histogram for bucket list length (total of 37 buckets): 
Length Number  % of total Coverage 
     0 10   (27.0%) 
     1 14   (37.8%)  25.9% 
     2 4   (10.8%)  40.7% 
     3 4   (10.8%)  63.0% 
     4 5   (13.5%) 100.0% 

Version symbols section '.gnu.version' contains 55 entries: 
Addr: 00000000080487fe Offset: 0x0007fe Link: 4 (.dynsym) 
    000: 0 (*local*)  0 (*local*)  3 (GLIBC_2.0)  2 (GLIBC_2.1) 
    004: 3 (GLIBC_2.0)  3 (GLIBC_2.0)  3 (GLIBC_2.0)  3 (GLIBC_2.0) 
    008: 3 (GLIBC_2.0)  3 (GLIBC_2.0)  3 (GLIBC_2.0)  3 (GLIBC_2.0) 
    00c: 3 (GLIBC_2.0)  3 (GLIBC_2.0)  3 (GLIBC_2.0)  3 (GLIBC_2.0) 
    010: 3 (GLIBC_2.0)  3 (GLIBC_2.0)  3 (GLIBC_2.0)  3 (GLIBC_2.0) 
    014: 3 (GLIBC_2.0)  3 (GLIBC_2.0)  3 (GLIBC_2.0)  1 (*global*) 
    018: 3 (GLIBC_2.0)  3 (GLIBC_2.0)  3 (GLIBC_2.0)  3 (GLIBC_2.0) 
    01c: 3 (GLIBC_2.0)  3 (GLIBC_2.0)  3 (GLIBC_2.0)  3 (GLIBC_2.0) 
    020: 3 (GLIBC_2.0)  3 (GLIBC_2.0)  3 (GLIBC_2.0)  3 (GLIBC_2.0) 
    024: 3 (GLIBC_2.0)  3 (GLIBC_2.0)  3 (GLIBC_2.0)  3 (GLIBC_2.0) 
    028: 1 (*global*)  3 (GLIBC_2.0)  3 (GLIBC_2.0)  3 (GLIBC_2.0) 
    02c: 3 (GLIBC_2.0)  3 (GLIBC_2.0)  3 (GLIBC_2.0)  1 (*global*) 
    030: 3 (GLIBC_2.0)  3 (GLIBC_2.0)  3 (GLIBC_2.0)  1 (*global*) 
    034: 3 (GLIBC_2.0)  3 (GLIBC_2.0)  3 (GLIBC_2.0) 

Version needs section '.gnu.version_r' contains 1 entries: 
Addr: 0x000000000804886c Offset: 0x00086c Link: 5 (.dynstr) 
    000000: Version: 1 File: libc.so.6 Cnt: 2 
    0x0010: Name: GLIBC_2.0 Flags: none Version: 3 
    0x0020: Name: GLIBC_2.1 Flags: none Version: 2 

Notes at offset 0x00000108 with length 0x00000020: 
    Owner   Data size  Description 
    GNU   0x00000010  NT_GNU_ABI_TAG (ABI version tag) 

Notes at offset 0x0000b4c7 with length 0x0000017c: 
    Owner   Data size  Description 
    01.01   0x00000000  NT_VERSION (version) 
    01.01   0x00000000  NT_VERSION (version) 
    01.01   0x00000000  NT_VERSION (version) 
    01.01   0x00000000  NT_VERSION (version) 
    01.01   0x00000000  NT_VERSION (version) 
    01.01   0x00000000  NT_VERSION (version) 
    01.01   0x00000000  NT_VERSION (version) 
    01.01   0x00000000  NT_VERSION (version) 
    01.01   0x00000000  NT_VERSION (version) 
    01.01   0x00000000  NT_VERSION (version) 
    01.01   0x00000000  NT_VERSION (version) 
    01.01   0x00000000  NT_VERSION (version) 
    01.01   0x00000000  NT_VERSION (version) 
    01.01   0x00000000  NT_VERSION (version) 
    01.01   0x00000000  NT_VERSION (version) 
    01.01   0x00000000  NT_VERSION (version) 
    01.01   0x00000000  NT_VERSION (version) 
    01.01   0x00000000  NT_VERSION (version) 
    01.01   0x00000000  NT_VERSION (version) 

回答

138

答案是在这条线的readelf -a在原来的问题输出

[Requesting program interpreter: /lib/ld-linux.so.2] 

我错过了/lib/ld-linux.so.2文件,该文件是需要运行32位应用。有这个文件的Ubuntu软件包是libc6-i386。

+4

这让我的程序运行,但很快发生了另一个相关的错误。这个(大的安装)修正了它:sudo apt-get install ia32-libs – RyanfaeScotland 2013-10-11 12:44:27

+2

要说清楚:sudo apt-get install libc6-i386 – thiagolr 2014-03-19 16:59:34

+16

如果任何人在安装上述库后仍然遇到问题,请尝试以下操作我):'sudo apt-get install libc6-i386 lib32stdC++ 6 lib32gcc1 lib32ncurses5 lib32z1' – ctitze 2014-05-12 09:03:46

1

这可能是可执行静态链接,这就是为什么ldd gzip不看到任何链接 - 因为它不是。我不太了解遥远的事情,所以我不知道如果库静态链接,是否会有不兼容的问题。我可能预计会有。

我知道这是最明显的事情,我相信你已经做到了,但chmod +x ./gzip,是吗?没有这样的文件或目录是没有完成的典型症状,这就是为什么我提到它。

+0

是的,文件的权限设置正确。 – 2010-04-26 20:51:04

+0

尽可能多的想法。好东西。 – 2010-04-26 22:16:11

17

当您尝试在64位Linux上运行32位版本时,会出现此错误。

而且对比什么file不得不对你试图二进制说(即:32位),你获得了哪些/bin/gzip

$ file /bin/gzip 
/bin/gzip: ELF 64-bit LSB executable, x64-64, version 1 (SYSV), \ 
dynamically linked (uses shared libs), for GNU/Linux 2.6.15, stripped 

这是我得到的Ubuntu 9.10 AMD64又名x86_64的。

编辑:您的扩展后文章显示,因为readelf输出也反映了32位版本。

+0

我认为这是正确的,但安装正确的软件包后,32位应用程序可以运行。我认为它是libc-i386,我发布了一个单独的答案。 – 2010-05-01 15:02:49

3

我认为你是x86-64安装没有i386运行时链接程序。 ENOENT可能是由于操作系统寻找/lib/ld.so.1或类似的东西。这通常是32位glibc运行时的一部分,虽然我不直接熟悉Ubuntu,但我会假设他们有某种32位兼容性软件包来安装。幸运的是,gzip只依赖于C库,所以这可能是您需要安装的全部内容。

+0

它的确如此,如果你愿意,你可以安装ppc架构包。 'dpkg -i --force-architecture '会执行它,如果你有一个.deb文件。 – 2010-04-26 22:18:45

+0

我有一种感觉,也有一种方法可以通过apt/aptitude来做到这一点......我还没有在2+年使用过Ubuntu。 yum install ld.i686为fedora做了。 – 2010-04-26 22:19:41

15

老问题,但希望这会帮助别人。

在我的情况下,我在Ubuntu 12.04上构建的工具链(需要GCC 4.1构建)。由于大多数图书馆都已经转向多元化目录,因此无法找到ld.so.因此,为它建立一个符号链接。

检查所需的路径:

$ readelf -a arm-linux-gnueabi-gcc | grep interpreter: 
     [Requesting program interpreter: /lib/ld-linux-x86-64.so.2]

创建符号链接:

$ sudo ln -s /lib/x86_64-linux-gnu/ld-linux-x86-64.so.2 /lib/ld-linux-x86-64.so.2

如果你在32位,这将是i386的Linux的GNU的,而不是x86_64上,Linux的GNU。

+0

这对我来说运行Bossa(bossac,bossash)。在此处添加关键字以便在Google上轻松找到! – 2014-04-13 11:54:40

0

那么这样做的另一个可能的原因可能是在每行的结束和家当线 简单换行符如果您已在Windows编码IDE它可能是窗口每行结束之时已经加入了自己的断行你试图在Linux上运行它的断行导致问题

1

我也有问题,因为我的程序解释器是/lib/ld-linux.so.2但它是在嵌入式设备上,所以我通过询问解决了问题gcc使用ls-uClibc代替如下:

-Wl,--dynamic-linker=/lib/ld-uClibc.so.0 
相关问题