This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: configure doesn't set up CFLAGS properly
Type: behavior Stage: resolved
Components: Build Versions: Python 2.6
process
Status: closed Resolution: duplicate
Dependencies: Superseder: Improve CFLAGS handling
View: 9189
Assigned To: Nosy List: bos, joonas, lemburg, skrah
Priority: normal Keywords:

Created on 2005-01-17 22:54 by bos, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (5)
msg60636 - (view) Author: Bryan O'Sullivan (bos) Date: 2005-01-17 22:54
I'm trying to build a 32-bit python on an x86_64 Linux box running Fedora Core 3.

Here's my configure command line:

CFLAGS=-m32 LDFLAGS=-m32 ../../../python/configure --prefix=/opt/python --enable-shared --enable-ipv6 --enable-profiling --enable-unicode=ucs4

When I try to do a make afterwards, the build immediately fails:

gcc -pthread -c -pg  -fno-strict-aliasing -DNDEBUG -g -O3 -Wall -Wstrict-prototypes -I. -I../../../python/Include -fPIC -DPy_BUILD_CORE -o Modules/python.o ../../../python/Modules/python.c
In file included from ../../../python/Include/Python.h:55,
                 from ../../../python/Modules/python.c:3:
../../../python/Include/pyport.h:612:2: #error "LONG_BIT definition appears wrong for platform (bad gcc/glibc config?)."
make: *** [Modules/python.o] Error 1

Notice the lack of "-m32" on the gcc command line. Sure enough, look in the Makefile and LDFLAGS is set correctly, with -m32, but CFLAGS makes no mention of it, nor does BASECFLAGS.

If I modify BASECFLAGS by hand, python itself builds OK, but then the shared libraries fail to link because LDSHARED is not having LDFLAGS passed in.
msg60637 - (view) Author: Bryan O'Sullivan (bos) Date: 2005-01-17 22:55
Logged In: YES 
user_id=28380

The "correct" (i.e. works for me) way to work around this is to run configure with CC="gcc -32" CXX="g++ -m32" instead of setting CFLAGS and LDFLAGS.
msg60638 - (view) Author: Marc-Andre Lemburg (lemburg) * (Python committer) Date: 2005-01-17 23:18
Logged In: YES 
user_id=38388

Try using LDSHARED instead. This works for compiling
extensions on x86_64 (using C shell):

setenv CCSHARED "-m32 -fPIC"
setenv LDSHARED "gcc -m32 -shared"
msg93985 - (view) Author: M Joonas Pihlaja (joonas) Date: 2009-10-14 13:41
Here's a test case:

$ CFLAGS="--haflkhlaiuhfnafkghnaf" ./configure; make
[... configure does its thing... ]
[... make does its thing and completes successfully ...]

Expected result:  The build fails due to an unknown flag in CFLAGS.

Witnessed result:  CFLAGS is completely ignored.
msg114083 - (view) Author: Stefan Krah (skrah) * (Python committer) Date: 2010-08-16 22:52
Closing as a duplicate of issue 9189.
History
Date User Action Args
2022-04-11 14:56:09adminsetgithub: 41457
2010-08-16 22:52:45skrahsetstatus: open -> closed

superseder: Improve CFLAGS handling

nosy: + skrah
messages: + msg114083
resolution: duplicate
stage: test needed -> resolved
2009-10-14 13:41:07joonassetnosy: + joonas
messages: + msg93985
2009-02-14 19:09:40ajaksu2setstage: test needed
type: behavior
versions: + Python 2.6, - Python 2.4
2005-01-17 22:54:18boscreate