Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to use unix configure to compile 32 bits executable on 64 bits

Tags:

unix

configure

I want to compile a program using the standard ./configure , make, make install. I am using 64 bits machine but I want the executable to be 32 bits executable.

What is the way to do this, I did ./configure --help but saw nothing on this (it has the --disable-64bit but it does not seem to do the work

like image 925
eran Avatar asked Oct 01 '09 09:10

eran


People also ask

Is gcc 32 or 64 bit?

Compile 32-bit program on 64-bit gcc in C and C++Nowadays the compiler comes with default 64-bit version. Sometimes we need to compile and execute a code into some 32bit system. In that time, we have to use thisS feature. At first, we Shave to check the current target version of the gcc compiler.

Which command is used to compile programs in Linux?

The Unix command for compiling C code is gcc. This is a compiler from Gnu for Linux. If you are using a Unix machine like Solaris you may need to use the command cc.) When you compile your program the compiler produces a file containing binary code which is directly readable by the machine you are on.


1 Answers

What is the platform and compiler?

I'd be inclined to say either:

  1. run configure to get your Makefile and then add then relevant compiler option to the CFLAGS macro, e.g. CFLAGS=${CFLAGS} -m32 for Sun cc, or
  2. add that macro edit to the Makefile.in file being used as a template by configure.

Edit:

Forgot to add that I've done both several times before when I needed to.

like image 68
Rob Wells Avatar answered Oct 16 '22 15:10

Rob Wells