如何在 64 位 RHEL 上编译 32 位应用程序? [英] How to Compile 32-bit Apps on 64-bit RHEL?

查看:36
本文介绍了如何在 64 位 RHEL 上编译 32 位应用程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用 gcc 4.8 在 RHEL 7 64 位上编译 32 位 C 应用程序.我收到编译器错误 /usr/include/gnu/stubs.h:7:27: error: gnu/stubs-32.h: No such file or directory.我需要做什么才能编译和链接 32 位应用程序?

I'm trying to compile a 32-bit C application on RHEL 7 64-bit using gcc 4.8. I'm getting a compiler error /usr/include/gnu/stubs.h:7:27: error: gnu/stubs-32.h: No such file or directory. What do I need to do to get 32 bit apps compiled and linked?

推荐答案

要让 RHEL 7 64 位编译 gcc 4.8 32 位程序,您需要做两件事.

To get RHEL 7 64-bit to compile gcc 4.8 32-bit programs, you'll need to do two things.

  1. 确保所有 32 位 gcc 4.8 开发工具都已完全安装:

  1. Make sure all the 32-bit gcc 4.8 development tools are completely installed:

sudo yum install glibc-devel.i686 libgcc.i686 libstdc++-devel.i686 ncurses-devel.i686

  • 使用 -m32 标志编译程序

  • Compile programs using the -m32 flag

    gcc pgm.c -m32 -o pgm
    

  • 这篇关于如何在 64 位 RHEL 上编译 32 位应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

    查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆