Skip to content

Instantly share code, notes, and snippets.

@fedej
Created November 1, 2022 19:38
Show Gist options
  • Save fedej/676147a9c055e714de0be82793e8e600 to your computer and use it in GitHub Desktop.
Save fedej/676147a9c055e714de0be82793e8e600 to your computer and use it in GitHub Desktop.
cross-compiling python3.11 for Raspberry pi 1
FROM debian:bullseye-slim as base
RUN apt update && apt install -y git make build-essential libssl-dev zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev wget curl llvm libncursesw5-dev xz-utils tk-dev libxml2-dev libxmlsec1-dev libffi-dev liblzma-dev
RUN curl https://pyenv.run | bash
RUN $HOME/.pyenv/bin/pyenv install 3.11.0
FROM dockcross/linux-armv6-lts
COPY --from=base /root/.pyenv /root/.pyenv
RUN wget https://github.com/python/cpython/archive/refs/tags/v3.11.0.tar.gz
RUN tar -xvf v3.11.0.tar.gz
WORKDIR cpython-3.11.0
RUN apt update && apt install -y binutils-multiarch gcc-arm-linux-gnueabihf
RUN echo "ac_cv_file__dev_ptmx=yes" >> config.site
RUN echo "ac_cv_file__dev_ptc=yes" >> config.site
RUN echo "ac_cv_little_endian_double=yes" >> config.site
RUN mkdir -p /root/python311
ENV COMMON_CONFIGURE_ARGS --prefix=/root/python311 \
--disable-ipv6 \
--enable-loadable-sqlite-extensions \
--with-dbmliborder=bdb:gdbm \
--with-computed-gotos \
--without-ensurepip \
--with-system-expat \
--without-ffi \
--enable-shared \
--with-lto \
--with-system-libmpdec \
--disable-test-modules \
--enable-optimizations \
--with-wheel-pkg-dir=/usr/share/python-wheels/
RUN CONFIG_SITE=config.site ./configure --with-build-python=$HOME/.pyenv/versions/3.11.0/bin/python --host=arm-linux-gnueabihf --prefix=$HOME/.local --build=arm $COMMON_CONFIGURE_ARGS --enable-bolt
RUN make -j -l 4
RUN make install
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment