Skip to content

antoinefaure/meta-pypy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

42 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

meta-pypy

PyPy(https://bitbucket.org/pypy/pypy) support for Bitbake/Yocto/OpenEmbedded

  • Supports python setup.py build/install
  • Supports cross-compiling python C extensions
  • Supports pypy's fork of numpy (https://bitbucket.org/pypy/numpy/)
  • PyPy cross-translation flow relies heavily on scratchbox2, hence the pypy-core package is built outside of the bitbake flow

Cross translating PyPy

Initialize rootfs

add NO32LIBS=0 to conf/local.conf #for 64 bit hosts
bitbake pypy-rootfs #to build rootfs for cross-translation
export MACHINE=beaglebone #replace with your MACHINE from conf/local.conf
rm -rf /srv/chroot/precise_arm*
runqemu-extract-sdk tmp/deploy/images/$MACHINE/pypy-rootfs-$MACHINE.tar.gz /srv/chroot/precise_arm
cp /usr/bin/qemu-arm-static /srv/chroot/precise_arm/usr/bin/qemu-arm-static

#Initialize scratchbox2

sb2-init needs to be configured wiht bitbake's compiler. To obtain the desired variables, just open a dev console bitbake -c devshell bash and ``echo $CC `which $CC``` . Also add -I/usr/lib/libffi-3.2.1/include to -C.

  • Below is an example for beaglebone on Yocto 1.8:
  • cd /srv/chroot/precise_arm
  • sb2-init -C "-march=armv7-a -mfloat-abi=hard -mfpu=neon -mtune=cortex-a8 --sysroot=/home/mzakharo/dev/pypy/poky/build/tmp/sysroots/beaglebone -I/usr/lib/libffi-3.2.1/include" -c `which qemu-arm` ARM /home/mzakharo/dev/pypy/poky/build/tmp/sysroots/x86_64-linux/usr/bin/arm-poky-linux-gnueabi/arm-poky-linux-gnueabi-gcc

#Translation wget https://bitbucket.org/pypy/pypy/downloads/pypy-4.0.1-linux.tar.bz2
tar -jxvf pypy-4.0.1-linux.tar.bz2
wget https://bitbucket.org/pypy/pypy/downloads/pypy-4.0.1-src.zip
unzip pypy-4.0.1-src.zip && cd pypy-4.0.1-src
patch -p1 < $meta-pypy/patches/fix_unix_compiler.patch # issue 2217
patch -p1 < $META-PYPY_SRC/patches/fix_64bit_host.patch # issue 2218

  • Continue with steps from http://rpython.readthedocs.org/en/latest/arm.html#translation
    export SB2=/srv/chroot/precise_arm
    export SB2OPT='-t ARM'
    cd pypy/goal
    ../../../pypy-4.0.1-linux/bin/pypy ../../rpython/bin/rpython -Ojit --platform=arm --gcrootfinder=shadowstack --jit-backend=arm targetpypystandalone.py

#Package Example creating package for beaglebone
cd ../tool/release
sb2 -t ARM ../../goal/pypy-c package.py --nostrip --without-tk --without-sqlite3 --archive-name pypy-4.0.1-cortexa8 --targetdir $meta-pypy/recipes-devtools/pypy/pypy/

#Profit The following commands become available:
bitbake pypy
bitbake pypy-numpy

About

Cross/Embedded PyPy (https://bitbucket.org/pypy/pypy) support for OpenEmbedded/Bitbake/Yocto

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published