【问题标题】:How do I build 32-bit executables on x86_64 Fedora?如何在 x86_64 Fedora 上构建 32 位可执行文件?
【发布时间】:2015-07-15 13:50:25
【问题描述】:

我正在尝试在 64 位 Fedora 21 上运行 32 位可执行文件。

#include <stdio.h>

int main(){
    printf ("Hello C\n");

    return 1;
}


cc -m32 hello.c   -o helloi686

可执行文件返回错误的系统调用,或者不是动态可执行文件。

已安装的包

 glibc                                      i686                       2.20-8.fc21                                  @updates                                                   15 M
 glibc-devel                                i686                       2.20-8.fc21                                  @updates                                                  1.0 M
 libX11                                     i686                       1.6.2-2.fc21                                 @fedora                                                   1.3 M
 libXau                                     i686                       1.0.8-4.fc21                                 @fedora                                                    49 k
 libXext                                    i686                       1.3.3-2.fc21                                 @fedora                                                    87 k
 libXrandr                                  i686                       1.4.2-2.fc21                                 @fedora                                                    46 k
 libXrender                                 i686                       0.9.8-4.fc21                                 @fedora                                                    45 k
 libgcc                                     i686                       4.9.2-6.fc21                                 @updates                                                  202 k
 libstdc++                                  i686                       4.9.2-6.fc21                                 @updates                                                  1.0 M
 libxcb                                     i686                       1.11-3.fc21                                  @updates                                                  875 k
 ncurses-libs                               i686                       5.9-16.20140323.fc21                         @fedora                                                   932 k
 nss-softokn-freebl                         i686                       3.18.0-1.fc21                                @updates                                                  432 k
 zlib                                       i686                       1.2.8-7.fc21                                 @fedora                                                   187 k

在命令行中:

[root@machine platform-tools]# ldconfig -v | grep ld-linux
        ld-linux.so.2 -> ld-2.20.so
        ld-linux-x86-64.so.2 -> ld-2.20.so

[root@machine platform-tools]# ls -l /lib/ld-2.20.so
-rwxr-xr-x 1 root root 159020 feb 27 13:02 /lib/ld-2.20.so

哪些软件包可以解决这个问题?

【问题讨论】:

  • ldd helloi686 说什么?
  • $ldd helloi686 "不是动态可执行文件"
  • 有来自cc -Wall -m32 hello.c -o helloi686file helloi686的有用信息吗?
  • file helloi686:ELF 32 位 LSB 可执行文件,Intel 80386,版本 1 (SYSV),动态链接,解释器 /lib/ld-linux.so.2,适用于 GNU/Linux 2.6.32, BuildID[sha1]=4e2190e93b0b50901a5097701f89b95b5e33129f,未剥离
  • objdump -p helloi686 | grep NEEDED 输出怎么样?

标签: fedora cpu-architecture


【解决方案1】:

可能是 systemd 配置文件 system.conf 已启用 SystemCallArchitectures 与其他架构。

调整/删除它。 dracut -f,然后重启。

【讨论】:

    猜你喜欢
    • 2014-03-14
    • 2019-03-31
    • 2011-11-01
    • 1970-01-01
    • 1970-01-01
    • 2016-12-01
    • 2011-02-18
    • 2011-06-23
    • 1970-01-01
    相关资源
    最近更新 更多