[ python-Bugs-1023838 ] Include/pyport.h: Bad LONG_BIT assumption on non-glibc sys

SourceForge.net noreply at sourceforge.net
Tue Sep 14 21:12:02 CEST 2004


Bugs item #1023838, was opened at 2004-09-07 10:30
Message generated for change (Comment added) made by cdgregorr
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1023838&group_id=5470

Category: Build
Group: Python 2.3
Status: Open
Resolution: None
Priority: 5
Submitted By: Gregor Richards (cdgregorr)
Assigned to: Nobody/Anonymous (nobody)
Summary: Include/pyport.h: Bad LONG_BIT assumption on non-glibc sys

Initial Comment:
While attempting to compile on Solaris 8 64-bit or HPUX 
64-bit, Python 2.3.4 has an "error" because LONG_BIT is 
not defined properly.  This error is incorrect on non-glibc 
systems, and Python compiles fine with it disabled.  
Here's the incorrect assumption:

#if LONG_BIT != 8 * SIZEOF_LONG
/* 04-Oct-2000 LONG_BIT is apparently (mis)defined as 
64 on some recent
 * 32-bit platforms using gcc.  We try to catch that 
here at compile-time
 * rather than waiting for integer multiplication to trigger 
bogus
 * overflows.
 */
#error "LONG_BIT definition appears wrong for platform 
(bad gcc/glibc config?)."
#endif

This should include something to limit it to only glibc 
systems.

 - Gregor Richards

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

>Comment By: Gregor Richards (cdgregorr)
Date: 2004-09-14 12:12

Message:
Logged In: YES 
user_id=835341

export CC="/usr/bin/gcc"
export CFLAGS="-m64 -O2"
./configure

 - Gregor Richards

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

Comment By: Martin v. Löwis (loewis)
Date: 2004-09-14 00:55

Message:
Logged In: YES 
user_id=21627

Did you specify CFLAGS during configure? If not, how did the
flags get added for 64-bit mode?

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

Comment By: Gregor Richards (cdgregorr)
Date: 2004-09-13 09:36

Message:
Logged In: YES 
user_id=835341

I managed to track down the problem.  Both of these 
architectures require a cc flag to build in 64-bit mode, but the 
tests in configure were done without CFLAGS.  Thus, they 
build 32-bit, and the wrong values came out.

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

Comment By: Tim Peters (tim_one)
Date: 2004-09-07 10:57

Message:
Logged In: YES 
user_id=31435

What are LONG_BIT and SIZEOF_LONG on these platforms?  
It doesn't matter whether gcc is being used, if LONG_BIT is 
defined incorrectly for the platform, then it's defined 
incorrectly period.

Read the comment you quoted to see why it doesn't matter 
whether Python "compiles fine" if you disable this.  It's 
guarding against runtime errors in Python's intobject.c, which 
needs a correct value for LONG_BIT.  Presumably LONG_BIT 
should be 64 on these boxes, and SIZEOF_LONG should be 8.

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

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1023838&group_id=5470


More information about the Python-bugs-list mailing list