[Python-Dev] 32-bit and 64-bit python on Solaris

Laszlo (Laca) Peter laca at sun.com
Tue Aug 29 23:04:25 CEST 2006


Hi,

I work in the team that delivers python on Solaris.  Recently we've
been getting requests for delivering python in 64-bit as well
as in 32-bit.  As you probably know, Solaris can run 64-bit and
32-bit binaries on the same system, but of course you can't mix and
match shared objects with different ISAs.  This seems to apply to
python bytecode as well: the pyc files generated by a 64-bit build
of python are incompatible with those generated by the 32-bit python.
Note the caveat at
http://aspn.activestate.com/ASPN/docs/ActivePython/2.3/python/lib/module-marshal.html

I guess my first question is if there are any plans to make the
bytecodes for different ISAs compatible.  That would make most of
our problems magically go away (;

If not, then the issue we have is how to separate the 32-bit and
64-bit pyc's on the same system so that:
 - loading the right pyc is transparent to the user
 - you can't accidentally load a pyc with the wrong ISA
   (by setting PYTHONPATH, for example)
So duplicating the libdir is not an option.

The usual technique used for Solaris shared objects is placing the
64-bit objects in a 64/ subdirectory, while the 32-bit objects stay
where they are.
We considered various solutions.  Our current proposal is this:

 .../some/dir/foo.py          <- python source
 .../some/dir/foo.pyc         <- 32-bit bytecode
 .../some/dir/foo.pyc64       <- 64-bit bytecode
 .../some/dir/foo.pyo         <- optimised 32-bit bytecode
 .../some/dir/foo.pyo64       <- optimised 64-bit bytecode

The 64-bit python would always look for pyc64/pyo64, so this would
take care of accidentally loading the wrong ISA.  PYTHONPATH could
be the same for the 32-bit and the 64-bit python.

Shared objects:

 .../some/dir/foo.so       <- 32-bit shared object
 .../some/dir/64/foo.so    <- 64-bit shared object

This is kinda inconsistent, but simple enough.  The 64-bit python
would automatically look for shared objects in the 64/ subdir.
ld.so.1 makes sure that the wrong share object is never loaded.

So I'm looking for advice and wondering if it would be possible to
support multiple ISAs out of the box.  Would you be willing to accept
patches that implement the above (or whatever solution we agree to)
on Solaris?

Thanks,
Laca




More information about the Python-Dev mailing list