Create  Edit  Diff  FrontPage  Index  Search  Changes  History  Source  RSS  wikifarm  Login

PyPy

Using a pre-built binary of PyPy on RHEL

wget 'https://bitbucket.org/pypy/pypy/downloads/pypy-1.7-linux64.tar.bz2'
tar -xjf pypy-1.7-linux64.tar.bz2
$ ldd pypy-1.7/bin/pypy
       libdl.so.2 => /lib64/libdl.so.2 (0x0000003a21200000)
       libm.so.6 => /lib64/libm.so.6 (0x0000003a21600000)
       libssl.so.0.9.8 => not found
       libcrypto.so.0.9.8 => not found
       libexpat.so.1 => not found
       librt.so.1 => /lib64/librt.so.1 (0x0000003372e00000)
       libbz2.so.1.0 => not found
       libz.so.1 => /usr/lib64/libz.so.1 (0x0000003a22600000)
       libcrypt.so.1 => /lib64/libcrypt.so.1 (0x0000003ffd600000)
       libutil.so.1 => /lib64/libutil.so.1 (0x0000003a22a00000)
       libncurses.so.5 => /usr/lib64/libncurses.so.5 (0x0000003ffa200000)
       libpthread.so.0 => /lib64/libpthread.so.0 (0x00000037ef000000)
       libc.so.6 => /lib64/libc.so.6 (0x0000003a20e00000)
       /lib64/ld-linux-x86-64.so.2 (0x0000003a20a00000)

OpenSSL

See Git#l1

Bzip2

wget 'http://www.bzip.org/1.0.6/bzip2-1.0.6.tar.gz'
tar -xzf bzip2-1.0.6.tar.gz
cd bzip2-1.0.6
make -f Makefile-libbz2_so
cp libbz2.so* $pypypfx/lib

libexpat

# !!
wget 'http://ftp.de.debian.org/debian/pool/main/e/expat/expat_2.0.1.orig.tar.gz'
tar -xzf expat_2.0.1.orig.tar.gz
cd expat-2.0.1
./configure --prefix=$pypypfx
i=01; make &> make$i.log & tailf make$i.log
make install

Wrapper

#! /bin/sh

myself=`readlink -f $0`
mydir=${myself%/*}
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$mydir

exec "$mydir/pypy" "$@"

How to Build

libffi

wget 'ftp://sourceware.org/pub/libffi/libffi-3.0.10.tar.gz'
tar -xzf libffi-3.0.10.tar.gz
cd libffi-3.0.10
./configure --prefix=$pypypfx
echo libffi; i=01; make -j8 &> make$i.log & tailf make$i.log
make install
export PKG_CONFIG_PATH=~/work/pypy/lib/pkgconfig:$PKG_CONFIG_PATH
$ pkg-config libffi --cflags
-I/home/nodak/work/pypy/lib/libffi-3.0.10/include

PyPy

export PATH=/path/to/pypy/bin:$PATH
wget 'https://bitbucket.org/pypy/pypy/get/release-1.7.tar.bz2'
tar -xjf release-1.7.tar.bz2
cd pypy-pypy-ff4af8f31882/
cd pypy/translator/goal
time LANG=C python translate.py -Ojit

...

[translation:info] created: /local/2/home/nodak/src/pypy-pypy-ff4af8f31882/pypy/translator/goal/pypy-c
[Timer] Timings:
[Timer] annotate                       ---  562.7 s
[Timer] rtype_lltype                   ---  368.9 s
[Timer] pyjitpl_lltype                 ---  493.3 s
[Timer] backendopt_lltype              ---  170.6 s
[Timer] stackcheckinsertion_lltype     ---   33.0 s
[Timer] database_c                     ---  240.2 s
[Timer] source_c                       ---  268.2 s
[Timer] compile_c                      ---  350.8 s
[Timer] ===========================================
[Timer] Total:                         --- 2487.7 s
LANG=C python translate.py -Ojit  2166.93s user 4.21s system 85% cpu 42:05.32 total
$ ldd ./pypy-c
       libdl.so.2 => /lib64/libdl.so.2 (0x0000003a21200000)
       libm.so.6 => /lib64/libm.so.6 (0x0000003a21600000)
       libexpat.so.1 => /home/nodak/work/pypy/lib/libexpat.so.1 (0x00002afdbefed000)
       librt.so.1 => /lib64/librt.so.1 (0x0000003372e00000)
       libz.so.1 => /usr/lib64/libz.so.1 (0x0000003a22600000)
       libcrypt.so.1 => /lib64/libcrypt.so.1 (0x0000003ffd600000)
       libutil.so.1 => /lib64/libutil.so.1 (0x0000003a22a00000)
       libncurses.so.5 => /usr/lib64/libncurses.so.5 (0x0000003ffa200000)
       libpthread.so.0 => /lib64/libpthread.so.0 (0x00000037ef000000)
       libc.so.6 => /lib64/libc.so.6 (0x0000003a20e00000)
       /lib64/ld-linux-x86-64.so.2 (0x0000003a20a00000)

Packaging your PyPy build into tar.bz2

cd ./pypy/pypy/tool/release/
python package.py ../../.. pypy-my-own-package-name

How the build goes

  • /pypy/translator/goal/translate.py
    1. targetspec_dic, translateconfig, config, args = parse_options_and_load_target()
    2. drv = driver.TranslationDriver?.from_targetspec(...)
    3. goals = translateconfig.goals
    4. drv.proceed(goals)
Last modified:2012/06/12 10:52:35
Keyword(s):
References:[PyPy] [Python]