From 5f1a8bf84d6863ac1dbb67a7bbc221b613c756ae Mon Sep 17 00:00:00 2001 From: torlando-tech Date: Wed, 29 Oct 2025 11:37:08 -0400 Subject: [PATCH] fix: install system dependencies before Reticulum to provide libffi-dev MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Move system dependencies installation (Step 1) before Reticulum installation (Step 2) to ensure libffi-dev is available when RNS installs its dependency cryptography, which requires cffi compilation on armhf (32-bit ARM). Root cause: RNS dependency chain (RNS -> cryptography -> cffi) triggered cffi source compilation during pip install rns, before libffi-dev was installed in the old Step 2. New order: 1. Basic prerequisites (python3, pip, git) 2. System dependencies (including conditional libffi-dev for armhf) 3. Reticulum installation 4. Python dependencies (bleak, bluezero) The libffi-dev package remains conditional for armhf only - x86_64 and arm64 have pre-built cffi wheels and don't need compilation. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- install.sh | 122 ++++++++++++++++++++++++++--------------------------- 1 file changed, 61 insertions(+), 61 deletions(-) diff --git a/install.sh b/install.sh index 4414acf..f9cdbca 100755 --- a/install.sh +++ b/install.sh @@ -158,7 +158,67 @@ fi echo -# Step 1: Check for Reticulum installation +# Step 1: Install system dependencies +print_header "Installing System Dependencies" + +if command -v apt-get &> /dev/null; then + # Debian/Ubuntu/Raspberry Pi OS + print_info "Detected Debian/Ubuntu-based system" + + # Detect architecture for platform-specific dependencies + ARCH=$(dpkg --print-architecture 2>/dev/null || echo "unknown") + print_info "Detected architecture: $ARCH" + + PACKAGES="python3-pip python3-gi python3-dbus python3-cairo bluez libcap2-bin" + + # Add libffi-dev only for 32-bit ARM (armhf) - needed for cffi compilation + # x86_64 and arm64 have pre-built cffi wheels available + if [[ "$ARCH" == "armhf" ]]; then + PACKAGES="$PACKAGES libffi-dev" + print_info "32-bit ARM detected - adding libffi-dev for cffi compilation" + fi + + echo "Installing: $PACKAGES" + + # Use sudo only if not running as root + if [ "$EUID" -eq 0 ]; then + apt-get update + apt-get install -y $PACKAGES + else + sudo apt-get update + sudo apt-get install -y $PACKAGES + fi + print_success "System dependencies installed (using pre-compiled system packages)" +elif command -v pacman &> /dev/null; then + # Arch Linux + print_info "Detected Arch Linux" + echo "Installing: base-devel gobject-introspection python-pip python-dbus python-cairo bluez bluez-utils libcap" + print_warning "Note: PyGObject will be compiled from pip due to version requirements (bluezero needs <3.52.0, Arch has 3.54.5)" + # Use sudo only if not running as root + if [ "$EUID" -eq 0 ]; then + # Sync package database first (may have been synced in basic prereqs, but ensure it's current) + pacman -Sy --noconfirm + # Skip python-gobject to avoid version conflict - pip will compile PyGObject + # gobject-introspection provides dev files needed for PyGObject compilation + pacman -S --needed --noconfirm base-devel gobject-introspection python-pip python-dbus python-cairo bluez bluez-utils libcap + else + sudo pacman -Sy --noconfirm + sudo pacman -S --needed --noconfirm base-devel gobject-introspection python-pip python-dbus python-cairo bluez bluez-utils libcap + fi + print_success "System dependencies installed (PyGObject will be compiled from pip)" +else + print_warning "Could not detect package manager" + print_info "Please manually install: BlueZ 5.x, python3-dbus" + read -p "Continue anyway? (y/N) " -n 1 -r + echo + if [[ ! $REPLY =~ ^[Yy]$ ]]; then + exit 1 + fi +fi + +echo + +# Step 2: Check for Reticulum installation print_header "Checking for Reticulum" RNS_VENV="" @@ -260,66 +320,6 @@ fi echo -# Step 2: Install system dependencies -print_header "Installing System Dependencies" - -if command -v apt-get &> /dev/null; then - # Debian/Ubuntu/Raspberry Pi OS - print_info "Detected Debian/Ubuntu-based system" - - # Detect architecture for platform-specific dependencies - ARCH=$(dpkg --print-architecture 2>/dev/null || echo "unknown") - print_info "Detected architecture: $ARCH" - - PACKAGES="python3-pip python3-gi python3-dbus python3-cairo bluez libcap2-bin" - - # Add libffi-dev only for 32-bit ARM (armhf) - needed for cffi compilation - # x86_64 and arm64 have pre-built cffi wheels available - if [[ "$ARCH" == "armhf" ]]; then - PACKAGES="$PACKAGES libffi-dev" - print_info "32-bit ARM detected - adding libffi-dev for cffi compilation" - fi - - echo "Installing: $PACKAGES" - - # Use sudo only if not running as root - if [ "$EUID" -eq 0 ]; then - apt-get update - apt-get install -y $PACKAGES - else - sudo apt-get update - sudo apt-get install -y $PACKAGES - fi - print_success "System dependencies installed (using pre-compiled system packages)" -elif command -v pacman &> /dev/null; then - # Arch Linux - print_info "Detected Arch Linux" - echo "Installing: base-devel gobject-introspection python-pip python-dbus python-cairo bluez bluez-utils libcap" - print_warning "Note: PyGObject will be compiled from pip due to version requirements (bluezero needs <3.52.0, Arch has 3.54.5)" - # Use sudo only if not running as root - if [ "$EUID" -eq 0 ]; then - # Sync package database first (may have been synced in basic prereqs, but ensure it's current) - pacman -Sy --noconfirm - # Skip python-gobject to avoid version conflict - pip will compile PyGObject - # gobject-introspection provides dev files needed for PyGObject compilation - pacman -S --needed --noconfirm base-devel gobject-introspection python-pip python-dbus python-cairo bluez bluez-utils libcap - else - sudo pacman -Sy --noconfirm - sudo pacman -S --needed --noconfirm base-devel gobject-introspection python-pip python-dbus python-cairo bluez bluez-utils libcap - fi - print_success "System dependencies installed (PyGObject will be compiled from pip)" -else - print_warning "Could not detect package manager" - print_info "Please manually install: BlueZ 5.x, python3-dbus" - read -p "Continue anyway? (y/N) " -n 1 -r - echo - if [[ ! $REPLY =~ ^[Yy]$ ]]; then - exit 1 - fi -fi - -echo - # Step 3: Install Python dependencies print_header "Installing Python Dependencies"