Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to Compile 32-bit Apps on 64-bit RHEL?

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?

like image 793
BSalita Avatar asked May 13 '14 17:05

BSalita


People also ask

Can 32-bit programs run on 64-bit Linux?

You can have 32bit userland running on a 64bit kernel, and install support for 64bit binaries.

Can Linux run 32-bit apps?

Linux kernel supports chroot technology that allows to run 32-bit apps in an isolated environment (sandbox) inside a 64-bit OS.

How can I install 32-bit rpm on 64-bit using yum?

So to install the 32-bit library, you have to use an IBM-provided installer script called ibm-yum.sh. If you are an external customer, then use the yum program. Get the ibm-yum.sh script and put it on any temp dir on your system, then use it as shown in the subsequent screenshot steps.


1 Answers

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

  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
    
  2. Compile programs using the -m32 flag

    gcc pgm.c -m32 -o pgm
    
like image 163
BSalita Avatar answered Sep 20 '22 14:09

BSalita