[Python-bugs-list] [ python-Bugs-616786 ] Problems (fixes) compiling 2.2.1 on sun4

noreply@sourceforge.net noreply@sourceforge.net
Mon, 30 Sep 2002 14:57:32 -0700


Bugs item #616786, was opened at 2002-09-30 17:57
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=616786&group_id=5470

Category: Build
Group: Platform-specific
Status: Open
Resolution: None
Priority: 5
Submitted By: No Spam (not4spam)
Assigned to: Nobody/Anonymous (nobody)
Summary: Problems (fixes) compiling 2.2.1 on sun4

Initial Comment:
I had a few problems compiling "Python-2.2.1" on
"SunOS 4.1.4 1 sun4m" using gcc "version egcs-2.91.5"
(sorry it's not my system and I had no choice).  I'd
guess this applies to other versions of python as well,
but this is the first time I tried this.

The most serious problem was in the function
"PyOS_vsnprintf"
in the file "Python/mysnprintf.c".  For the case where
HAVE_SNPRINTF is NOT #defined there is the call,
        len = vsprintf(buffer, format, va);
But on "SunOS 4.1.4", on success "vsprintf" returns the
first argument (buffer) and NOT the length of the string!
I "fixed" this by adding after the above call,
    if (len == (int)buffer) len = strlen(buffer);
I guess a better way would be to have a #ifdef for the OS
but this seems to work OK for all systems.

Three other source files needed minor tweaking:

    --  In Objects/fileobject.c at the beginning of
function
        file_init() I needed to add the line:
            extern int fclose(FILE *);
    --  In Modules/posixmodule.c at the beginning of
function
        posix_chroot()  I needed to add the line:
            int chroot();
    --  In Modules/xxsubtype.c at the beginning of function
        spam_bench() I needed to add the lines:
            #ifndef CLOCKS_PER_SEC
            # define CLOCKS_PER_SEC  1000000l   /* ? */
            #endif

Seems like the first 2 would be OK in general.  And perhaps
there's an equivalent of CLOCKS_PER_SEC in some "sun4"
header
file but I couldn't find it.

I realize supporting this antiquated operation system
and "gcc"
isn't a high priority, but since the changes are so minimal
perhaps they could be added to save some other poor
soul some
headaches.


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

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