While Building 32-Bit Executable File in 64-Bit Linux I Get Crt1.O: No Such File Even with the -M32 Flag

Cannot find crtn.o, linking 32 bit code on 64 bit system

You are not assembling, but linking an executable, which needs OS startup files.

It seems you don't have gcc-*-multilib installed, which contains the necessary files: http://packages.ubuntu.com/oneiric/amd64/gcc-4.6-multilib/filelist

Building a 32-bit app in 64-bit Ubuntu

You need to use link with -m32 as well.

gcc -m32 -o xgap xcmds.o utils.o gapgraph.o gaptext.o pty.o popdial.o xgap.o selfile.o   -L/usr/lib32 -lXaw -lXmu -lXt -lXext -lX11  -lSM -lICE

All things considered, I think you should be able to drop the -L/usr/lib32 when using -m32.

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

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

How to make compiler generate a elf32-x86-64 format object file?

GCC will adjust the linker command line accordingly if you invoke it as gcc -mx32. It is more than just a compiler flag.



Related Topics



Leave a reply



Submit