Solaris 10 + Sun Studio 12 Pyrhon 2.4.4 64-bit build problem

MrJean1 MrJean1 at
Tue Oct 30 05:15:06 CET 2007

Here is one way to build a 64-bit Python binary on Solaris 10 using
SUN's compilers**.  This is probably not the recommended procedure but
it does create a partial, expected result.

Here are the 4 steps I used:

1 - Run  ./configure --without-gcc  --with-cxx-main=CC  --enable-64-
bit  ....

2 - Edit the generated Makefile and change 3 lines

    CC     = cc -xtarget=opteron -xarch=amd64
    CXX    = CC -xtarget=opteron -xarch=amd64
    MAINCC = CC -xtarget=opteron -xarch=amd64

    The -xtarget and -xarch flags must be adjusted for UltraSparc.

3 - Edit python source file ./Include/pyport.h before line 728 (in
Python 2.5.1) as follows.

    Add these 3 lines:

    #ifndef __GNUC__  /* non-GNU C/C++, like SUN */
    # undef LONG_BIT

    such that LONG_BIT is #define'd next

    #ifndef LONG_BIT
    #define LONG_BIT (8 * SIZEOF_LONG)

    before this error message can occur

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

4 - Run make and check the resulting Python binary with  file ./

However, make test still fails and that will require further

/Jean Brouwers

**) Sun C/C++ 5.8 2005/10/14 on an Ultra 20 Opteron machine

On Oct 29, 12:06 pm, MrJean1 <MrJe... at> wrote:
> Building 64-bit Python is still elusive. I tried various ways to add  -
> xtarget=opteron -xarch-amd64  to the C/C++ flags but that still fails
> to produce a 64-bit build.  Changing the Makefile is not sufficient
> since that causes compilation errors.
> It looks like the ./configure command must run with those additional
> flags.  Passing the flags in environment variables defining CC and CXX
> only works for CXX.  The additional flags do not appear on the C
> compiler command lines.
> /Jean Brouwers
> On Oct 28, 11:03 pm, plumb and tree <plumbandt... at> wrote:

More information about the Python-list mailing list