Skip to content

elPytel/Python_3.11_on_N900

Repository files navigation

Python 3.11 Compilation Guide for N900

Warning

This app was not yet tested on the N900 device. Use at your own risk.

Compilation Guide

Note

This guide assumes you are using a Debian-based system (like Ubuntu 24.04) on an x86_64 architecture.

Usage

Run the script compile_python.sh on your x86_64 device to cross-compile Python 3.11 for the N900 device. This script automates the process of downloading, configuring, and compiling Python 3.11.

The script installs dependencies listed in the dependencies.txt file, such as:

arm-linux-gnueabihf-gcc
gcc-arm-linux-gnueabihf 
g++-arm-linux-gnueabihf
crossbuild-essential-armhf
build-essential
...

Compilation

The script compile_python.sh will configure the make file for cross-compilation, and compile it for the ARM architecture. Used settings are:

CC=arm-linux-gnueabihf-gcc \
./configure \
  --build="$(./config.guess)" \
  --host=arm-linux-gnueabihf \
  --prefix="$INSTALL_DIR" \
  --enable-optimizations \
  --disable-ipv6 \
  --enable-shared \
  --without-ensurepip \
  --with-build-python=/usr/bin/python3.11 \
  ac_cv_file__dev_ptmx=no \
  ac_cv_file__dev_ptc=no

Validate the output binary

After running the script, Python 3.11 will be installed in the python-arm-install directory.

Note

Check if the installation was successful by running:

file python-arm-install/bin/python3.11

It should output something like: ELF 32-bit ARM

Limitations

This guide does not support IPv6.

configure: error: You must get working getaddrinfo() function or pass the "--disable-ipv6" option to configure.

Could not build the ssl module! Python requires a OpenSSL 1.1.1 or newer

Changing Python Version

For compiling Python 3.11 you need compatible versions of Python and its dependencies already installed on your system. If you change the Python version, you may need to update the dependencies accordingly.

Warning

checking for --with-build-python... configure: error: "/usr/bin/python3" has incompatible version 3.12 (expected: 3.11)

OpenSSL

[!warning] TODO This script was not yet done.

Resources

Packaging Python 3.11 for N900

Run helper script package_python.sh to create a Debian package for Python 3.11.

Build guide

Run the packaging script to create folder structure

Run the script package_python.sh to create the necessary directory structure for packaging Python 3.11:

./package_python.sh

Edit the control file

You have to manually edit the DEBIAN/control file to set the correct package name, version, architecture, maintainer, and description.

control file example:

Package: python
Version: 3.11.10
Architecture: armhf
Maintainer: elPytel <[email protected]>
Section: interpreters
Priority: optional
Description: Python 3.11.10 for Nokia N900

Move the python binaries

After compiling Python, you need to move the binaries to the correct location in the package structure. Move the python binaries to the python_3.11.10_armhf/usr/bin/ directory:

Build the Debian package

Run the helper script build_python_deb.sh (again) to create the Debian package:

./build_python_deb.sh

This will create a .deb file in the current directory, which you can then install on your N900 device.

Copy the package to N900 over SSH

You can use scp to copy the package to your N900 device:

scp python_3.11.10_armhf.deb user@<n900_ip>:/home/user/MyDocs/

About

Script for x-compiling the Python3 for N900.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages