美文网首页
在64位的Linux上执行32位的程序

在64位的Linux上执行32位的程序

作者: Ar0nW | 来源:发表于2017-09-15 02:18 被阅读0次

    作者:Ar0nW

    原文地址:https://ar0n.wang/execute-32-bit-program-on-64-bit-linux/

    在对linux上的程序进行调试时,使用file program_name查看这个可执行文件的相关信息,可以看出可执行文件是32位程序。

    由于系统的环境是64位的,默认不支持运行32位程序,所以需要安装32位的支持库以执行32位程序。

    ar0nw@box: ~$ file program_name

    program_name:

    ELF 32-bit LSB executable,

    Intel 80386, version 1 (SYSV),

    dynamically linked,

    Interpreter /lib/ld-linux.so.2,

    for GNU/Linux 2.6.18,

    BuildID[sha1]=96997aacd6ee7889b99dc156d83c9d205eb58092,

    stripped

    通过uname -a命令可以得知系统是64位的

    所以使用sudo apt-getinstall ia32-libs下载32位的lib库

    ar0nw@box:~$ sudo apt-get install lib32z1

    Reading package lists... Done

    Building dependency tree

    Reading state information... Done

    The following additional packages will be installed:

    libc6-i386

    The following NEW packages will be installed:

    lib32z1 libc6-i386

    0 upgraded, 2 newly installed, 0 to remove and 88 not upgraded.

    Need to get 2,381 kB of archives.

    After this operation, 10.6 MB of additional disk space will be used.

    Do you want to continue? [Y/n] y

    Get:1 http://mirrors.aliyun.com/ubuntu xenial-updates/main amd64 libc6-i386 amd64 2.23-0ubuntu5 [2,329 kB]

    Get:2 http://mirrors.aliyun.com/ubuntu xenial/main amd64 lib32z1 amd64 1:1.2.8.dfsg-2ubuntu4 [52.2 kB]

    Fetched 2,381 kB in 2s (988 kB/s)

    Selecting previously unselected package libc6-i386.

    (Reading database ... 180885 files and directories currently installed.)

    Preparing to unpack .../libc6-i386_2.23-0ubuntu5_amd64.deb ...

    Unpacking libc6-i386 (2.23-0ubuntu5) ...

    Selecting previously unselected package lib32z1.

    Preparing to unpack .../lib32z1_1%3a1.2.8.dfsg-2ubuntu4_amd64.deb ...

    Unpacking lib32z1 (1:1.2.8.dfsg-2ubuntu4) ...

    Processing triggers for libc-bin (2.23-0ubuntu5) ...

    Setting up libc6-i386 (2.23-0ubuntu5) ...

    Setting up lib32z1 (1:1.2.8.dfsg-2ubuntu4) ...

    Processing triggers for libc-bin (2.23-0ubuntu5) ...

    之后32位的可执行程序即可在64位系统上执行。

    相关文章

      网友评论

          本文标题:在64位的Linux上执行32位的程序

          本文链接:https://www.haomeiwen.com/subject/odnjsxtx.html