Re: Force 32 bit build

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello,

On 5/6/21 7:45 PM, aotto wrote:
I want to write a "autoconf/automake" script for an application ONLY for 32 bit on 64 bit Linux.
This meant that the default for configure must be 32 bit and nothing else.


I know that a user can do "configure CC="gcc -m32"... etc but this is NOT what I want.
I want that the 'configure' script set the 32bin once at start and fix.

I think that's a bad use of autoconf which is meant to provide a portability shim for any kind of system, be it 32 or 64 bits. Also, specifically on Linux there are two 32 bit modes (i386 and x32).

Regarding your problem: your first try uses commands that precede the AC_INIT and will consequently be ignored by autoconf. You should probably put those before AC_PROG_CC, but after AC_INIT. What do you mean by being too late in the second attempt?

Still: I very much recommend against trying to force a particular system property that might easily go away (modern x86_64 Linux installations often don't include 32 bit headers anymore, Ubuntu for example has stopped support of its i386 variant).

Better invest your time in creating software that works with any number of address bits.

Kind regards, Thomas



---------------------------------
my FIRST try fails, the "CCT-MARK" does NOT show up in configure :

# CCT-MARK
# https://www.gnu.org/software/automake/manual/html_node/Cross_002dCompilation.html
# force 32 bit only
export CFLAGS="$CFLAGS -m32 -O2"
export CXXFLAGS="$CXXFLAGS -m32 -O2"
export LDFLAGS="$LDFLAGS -m32 -O2"

# set CCT3 VERSION information also in:
AC_INIT(....)
AC_CANONICAL_TARGET
AM_INIT_AUTOMAKE([gnu tar-ustar no-dist-gzip dist-bzip2 -Wno-portability subdir-objects])


---------------------------------------
my SECOND try fails to, the "CCT-MARK" show up but too late :


# set CCT3 VERSION information also in:
AC_INIT(....)

# CCT-MARK
# https://www.gnu.org/software/automake/manual/html_node/Cross_002dCompilation.html
# force 32 bit only
export CFLAGS="$CFLAGS -m32 -O2"
export CXXFLAGS="$CXXFLAGS -m32 -O2"
export LDFLAGS="$LDFLAGS -m32 -O2"

AC_CANONICAL_TARGET
AM_INIT_AUTOMAKE([gnu tar-ustar no-dist-gzip dist-bzip2 -Wno-portability subdir-objects])


The "CCT-MARK" section is AFTER the ac_XXXX definition, I think this mean that tests are done
with 64 bit.

created 'configure' script
===============================================
...
## -------------------- ##
## Main body of script. ##
## -------------------- ##

ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_c_compiler_gnu

# CCT-MARK
# https://www.gnu.org/software/automake/manual/html_node/Cross_002dCompilation.html
# force 32 bit only
export CFLAGS="$CFLAGS -m32 -O2"
export CXXFLAGS="$CXXFLAGS -m32 -O2"
export LDFLAGS="$LDFLAGS -m32 -O2"
...
=================================================

 > Question, what I have to do to force 32 bit ?


mfg.



Attachment: smime.p7s
Description: S/MIME Cryptographic Signature


[Index of Archives]     [GCC Help]     [Kernel Discussion]     [RPM Discussion]     [Red Hat Development]     [Yosemite News]     [Linux USB]     [Samba]

  Powered by Linux