Cross-Compiling Python & C Extensions for Embedded Systems

Audience level:
Embedded Systems
March 10th 4:15 p.m. – 4:55 p.m.


Cross-compiling is not a use case directly supported by the Python build and extension system. This talk will discuss the process of building python for your embedded platform, and the basics of getting C extensions compiled and running. It will focus on Linux so that the build host and the build target are the same.


Outline of talk

  • Ground Rules:
    • This talk is on cross-compiling. Porting Python to your favourite OS is a whole other (much longer) talk
    • Examples Focus on embedded Linux so that build host and target are the same OS. Different host and target OS is way harder
  • What makes cross-compiling Python challenging?

  • Why can't I just use OpenEmbedded?

    • may not support most recent Python versions
    • may not have a build recipe for a required extension
    • won't support your custom extensions
    • you must use another platform
  • Building Python (a short overview)

    • build, patch, cross-build
    • build standard lib extensions
  • Building Extensions

    • satisfying C dependencies
    • modifying
    • building for your platform
    • packaging for distribution
  • Other Things to Look Out for:

    • package dependencies
    • virtualenv & easy_install / pip
    • Challenges you may encounter with platforms other than Linux
  • Demo:

    • Python 3.3 on hardware TBD
  • Invitation to discuss ways to make Python more accessible to embedded developers