Bugs item #1628484, was opened at 2007-01-05 09:45
Message generated for change (Comment added) made by loewis
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1628484&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Build
Group: None
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Bob Atkins (bobatkins)
Assigned to: Nobody/Anonymous (nobody)
Summary: Python 2.5 64 bit compile fails on Solaris 10/gcc 4.1.1

Initial Comment:
This looks like a recurring and somewhat sore topic.

For those of us that have been fighting the dreaded:

./Include/pyport.h:730:2: error: #error "LONG_BIT definition appears wrong for 
platform (bad gcc/glibc config?)."

when performing a 64 bit compile. I believe I have identified the problems. All 
of which are directly related to the Makefile(s) that are generated as part of 
the configure script. There does not seem to be anything wrong with the 
configure script or anything else once all of the Makefiles are corrected 
Python will build 64 bit

Although it is possible to pass the following environment variables to 
configure as is typical on most open source software:

  CC          C compiler command
  CFLAGS      C compiler flags
  LDFLAGS     linker flags, e.g. -L<lib dir> if you have libraries in a
              nonstandard directory <lib dir>
  CPPFLAGS    C/C++ preprocessor flags, e.g. -I<include dir> if you have
              headers in a nonstandard directory <include dir>
  CPP         C preprocessor

These flags are *not* being processed through to the generated Makefiles. This 
is where the problem is. configure is doing everything right and generating all 
of the necessary stuff for a 64 bit compile but when the compile is actually 
performed - the necessary CFLAGS are missing and a 32 bit compile is initiated.

Taking a close look at the first failure I found the following:

gcc -pthread -c -fno-strict-aliasing -DNDEBUG -g -O3 -Wall -Wstrict-prototypes  
-I. -I./Include  -fPIC -DPy_BUILD_CORE -o Modules/python.o ./Modules/python.c

Where are my CFLAGS???

I ran the configure with:

CFLAGS="-O3 -m64 -mcpu=ultrasparc -L/opt/lib/sparcv9 -R/opt/lib/sparcv9" \
CXXFLAGS="-O3 -m64 -mcpu=ultrasparc -L/opt/lib/sparcv9 -R/opt/lib/sparcv9" \
LDFLAGS="-m64 -L/opt/lib/sparcv9 -R/opt/lib/sparcv9" \
./configure --prefix=/opt \
--enable-shared \
--libdir=/opt/lib/sparcv9

Checking the config.log and config.status it was clear that the flags were used 
properly as the configure script ran however, the failure is in the various 
Makefiles to actually reference the CFLAGS and LDFLAGS.

LDFLAGS is simply not included in any of the link stages in the Makefiles and 
CFLAGS is overidden by BASECFLAGS, OPT and EXTRA_CFLAGS!

Ah!

EXTRA_CFLAGS="-O3 -m64 -mcpu=ultrasparc -L/opt/lib/sparcv9 -R/opt/lib/sparcv9" \
make

Actually got the core parts to compile for the library and then failed to build 
the library because - LDFLAGS was missing from the Makefile for the library 
link stage - :-(

Close examination suggests that the OPT environment variable could be used to 
pass the necessary flags through from conifgure but this still did not help the 
link stage problems.

The fixes are pretty minimal to ensure that the configure variables are passed 
into the Makefile. My patch to the Makefile.pre.in is attached to this bug 
report.

Once these changes are made Python will build properly for both 32 and 64 bit 
platforms with the correct CFLAGS and LDFLAGS passed into the configure script.

BTW, while this bug is reported under a Solaris/gcc build the patches to 
Makefile.pre.in should fix similar build issues on all platforms.

----------------------------------------------------------------------

>Comment By: Martin v. Löwis (loewis)
Date: 2007-01-06 01:52

Message:
Logged In: YES 
user_id=21627
Originator: NO

Can you please report what the actual problem is that you got? I doubt
it's the #error, as that error is generated by the preprocessor, yet your
fix seems to deal with LDFLAGS only.

So please explain what command you invoked, what the actual output was,
and what the expected output was.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1628484&group_id=5470
_______________________________________________
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to