Make error when installing Python 1.5

Jason Swails jason.swails at
Wed Aug 29 03:34:49 CEST 2012

On Sun, Aug 26, 2012 at 9:54 PM, Steven D'Aprano <
steve+comp.lang.python at> wrote:

> Yes, you read the subject line right -- Python 1.5. Yes, I am nuts ;)
> (I like having old versions of Python around for testing historical
> behaviour.)
> On Debian squeeze, when I try to build Python 1.5, I get this error:
> fileobject.c:590: error: conflicting types for ‘getline’
> /usr/include/stdio.h:651: note: previous declaration of ‘getline’ was here
> make[1]: *** [fileobject.o] Error 1
> make[1]: Leaving directory `/home/steve/personal/python/Python-1.5.2/
> Objects'
> make: *** [Objects] Error 2

FWIW, I got the same error when I tried (Gentoo, with both GCC 4.1.2 and
4.5.3), and it worked just fine when I tried it on a CentOS 5 machine
(consistent with your observations).  There's a reasonably easy fix,
though, that appears to work.

You will need the compile line for that source file (and you'll need to go
into the Objects/ dir).  For me it was:

gcc -g -O2 -I./../Include -I.. -DHAVE_CONFIG_H   -c -o fileobject.o

Following Cameron's advice, use the -E flag to produce a pre-processed
source file, such as the command below:

gcc -E -g -O2 -I./../Include -I.. -DHAVE_CONFIG_H   -c -o fileobject_.c

Edit this fileobject_.c file and remove the stdio prototype of getline.
 Then recompile using the original compile line (on fileobject_.c):

gcc -g -O2 -I./../Include -I.. -DHAVE_CONFIG_H   -c -o fileobject.o

For me this finishes fine.  Then go back to the top-level directory and
resume "make".  It finished for me (and seems to be working):

Batman src # python1.5
Python 1.5.2 (#1, Aug 28 2012, 20:13:23)  [GCC 4.5.3] on linux3
Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam
>>> import sys
>>> dir(sys)
['__doc__', '__name__', '__stderr__', '__stdin__', '__stdout__', 'argv',
'builtin_module_names', 'copyright', 'exc_info', 'exc_type', 'exec_prefix',
'executable', 'exit', 'getrefcount', 'hexversion', 'maxint', 'modules',
'path', 'platform', 'prefix', 'ps1', 'ps2', 'setcheckinterval',
'setprofile', 'settrace', 'stderr', 'stdin', 'stdout', 'version']
>>> sys.version
'1.5.2 (#1, Aug 28 2012, 20:13:23)  [GCC 4.5.3]'

Good luck,
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the Python-list mailing list