Search code examples
pythonbinarytranslatepypyrpython

PyPy translate 64bit


I can't seem to find the answer to this question anywhere. I'd just like to know, does the PyPy translate.py script produce 64bit or 32bit binary files? Is there an option to choose between the two that I'm missing or can PyPy only produce 32bit binaries?


Solution

  • RPython currently produces binaries according to the “host-Pyhton”, that is, typically a 32 bit binary on a 32 bit system and a 64 bit binary on a 64 bit system

    However, to work cross-bit you can do the following:

    On Linux

    If you have a 64 bit system

    • just translate to get a 64 bit binary or
    • you can try to translate within a 32 bit chroot environment [1,2,3,4] to produce a 32 bit one.

    If you have a 32 bit system

    • you can only produce 32 bit binaries.

    On OS X

    On OS X > 10.7, you typically have a 64 bit system so

    • just translate to get a 64 bit binary or
    • use the environment variable VERSIONER_PYTHON_PREFER_32_BIT to control the “bitness” of python. For a 32 bit binary, you can run

      PYTHONPATH=$PYPYPATH:… VERSIONER_PYTHON_PREFER_32_BIT=yes python $PYPYPATH/rpython/bin/rpython target….py
      

      Note that you have to use python in this case (typically, rpython detects an installed pypy and uses that), because pypy does not respect the versioner variable and does not come as a 32 bit binary for OS X in the first place.