From 3eff7deeb00efe22428921b1d45e50fa2fdb9ae2 Mon Sep 17 00:00:00 2001 From: Thiago Alves Date: Fri, 23 Jan 2026 12:40:06 -0500 Subject: [PATCH 1/4] fix: Use system cryptography package on ARM v7 to fix Docker build On ARM v7 (linux/arm/v7), pre-built wheels for cffi/cryptography are not available on PyPI, causing pip to attempt building from source. This fails because the build requires libffi-dev. This fix: - Installs libffi-dev for building cffi if needed - Installs python3-cffi and python3-cryptography via apt (pre-built) - Uses --system-site-packages when creating plugin venvs on ARM v7 - Mirrors the existing MSYS2 strategy for handling packages that can't be built from source Fixes Docker multi-arch build failure on linux/arm/v7. Co-Authored-By: Claude Opus 4.5 --- install.sh | 5 ++++- scripts/manage_plugin_venvs.sh | 13 +++++++++++-- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/install.sh b/install.sh index c969f900..035b0f3f 100755 --- a/install.sh +++ b/install.sh @@ -186,7 +186,10 @@ install_deps_apt() { gcc \ make \ cmake \ - pkg-config + pkg-config \ + libffi-dev \ + python3-cffi \ + python3-cryptography } # For yum-based distros (RHEL 7, CentOS 7, Amazon Linux) diff --git a/scripts/manage_plugin_venvs.sh b/scripts/manage_plugin_venvs.sh index c1ce59fc..ae606926 100755 --- a/scripts/manage_plugin_venvs.sh +++ b/scripts/manage_plugin_venvs.sh @@ -21,6 +21,12 @@ is_msys2() { esac } +# Detect if running on ARM v7 (32-bit ARM) +# On this platform, cffi/cryptography wheels are not available and must use system packages +is_armv7() { + [ "$(uname -m)" = "armv7l" ] +} + # Colors for output RED='\033[0;31m' GREEN='\033[0;32m' @@ -90,12 +96,15 @@ create_plugin_venv() { fi # Create virtual environment - # On MSYS2/Cygwin, use --system-site-packages to access pre-built packages like - # cryptography that cannot be built from source on this platform + # On MSYS2/Cygwin and ARM v7, use --system-site-packages to access pre-built packages like + # cryptography that cannot be built from source on these platforms log_info "Creating Python virtual environment at: $venv_path" if is_msys2; then log_info "MSYS2 detected: using --system-site-packages for pre-built package access" python3 -m venv --system-site-packages "$venv_path" + elif is_armv7; then + log_info "ARM v7 detected: using --system-site-packages for pre-built package access" + python3 -m venv --system-site-packages "$venv_path" else python3 -m venv "$venv_path" fi From f7442306d8e5d2a07e80c28390a0d052e916159a Mon Sep 17 00:00:00 2001 From: Thiago Alves Date: Fri, 23 Jan 2026 12:55:51 -0500 Subject: [PATCH 2/4] ci: Add platform selection input to Docker workflow Allow manual workflow dispatch to specify which platforms to build. Useful for testing platform-specific fixes without building all archs. Default remains all platforms (linux/amd64,linux/arm64,linux/arm/v7). Co-Authored-By: Claude Opus 4.5 --- .github/workflows/docker.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 1828c119..9b4f855a 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -6,6 +6,12 @@ on: pull_request: branches: [ main, development ] workflow_dispatch: + inputs: + platforms: + description: 'Platforms to build (comma-separated)' + default: 'linux/amd64,linux/arm64,linux/arm/v7' + required: false + type: string jobs: build: @@ -36,7 +42,7 @@ jobs: with: context: . push: true - platforms: linux/amd64,linux/arm64,linux/arm/v7 + platforms: ${{ inputs.platforms || 'linux/amd64,linux/arm64,linux/arm/v7' }} tags: | ghcr.io/autonomy-logic/openplc-runtime:latest ghcr.io/autonomy-logic/openplc-runtime:${{ github.sha }} From 045166a37ba03fe8ccf721ee6c3d9b997bc15738 Mon Sep 17 00:00:00 2001 From: Thiago Alves Date: Fri, 23 Jan 2026 13:23:04 -0500 Subject: [PATCH 3/4] refactor: Remove redundant system packages from apt deps libffi-dev alone provides the headers needed to build cffi from source. python3-cffi and python3-cryptography were redundant since pip successfully builds and installs newer versions in the venv. Co-Authored-By: Claude Opus 4.5 --- install.sh | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/install.sh b/install.sh index 035b0f3f..4b5b633c 100755 --- a/install.sh +++ b/install.sh @@ -187,9 +187,7 @@ install_deps_apt() { make \ cmake \ pkg-config \ - libffi-dev \ - python3-cffi \ - python3-cryptography + libffi-dev } # For yum-based distros (RHEL 7, CentOS 7, Amazon Linux) From 14f6eec9c1192d72ad9e99d6d46d6be248bba889 Mon Sep 17 00:00:00 2001 From: Thiago Alves Date: Fri, 23 Jan 2026 13:24:35 -0500 Subject: [PATCH 4/4] refactor: Remove ARM v7 system-site-packages workaround With libffi-dev installed, cffi can be built from source on ARM v7. The --system-site-packages workaround is no longer needed for this platform. MSYS2 still requires it due to Windows-specific build issues. Co-Authored-By: Claude Opus 4.5 --- scripts/manage_plugin_venvs.sh | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/scripts/manage_plugin_venvs.sh b/scripts/manage_plugin_venvs.sh index ae606926..2069e147 100755 --- a/scripts/manage_plugin_venvs.sh +++ b/scripts/manage_plugin_venvs.sh @@ -21,12 +21,6 @@ is_msys2() { esac } -# Detect if running on ARM v7 (32-bit ARM) -# On this platform, cffi/cryptography wheels are not available and must use system packages -is_armv7() { - [ "$(uname -m)" = "armv7l" ] -} - # Colors for output RED='\033[0;31m' GREEN='\033[0;32m' @@ -96,15 +90,12 @@ create_plugin_venv() { fi # Create virtual environment - # On MSYS2/Cygwin and ARM v7, use --system-site-packages to access pre-built packages like - # cryptography that cannot be built from source on these platforms + # On MSYS2/Cygwin, use --system-site-packages to access pre-built packages like + # cryptography that cannot be built from source on Windows log_info "Creating Python virtual environment at: $venv_path" if is_msys2; then log_info "MSYS2 detected: using --system-site-packages for pre-built package access" python3 -m venv --system-site-packages "$venv_path" - elif is_armv7; then - log_info "ARM v7 detected: using --system-site-packages for pre-built package access" - python3 -m venv --system-site-packages "$venv_path" else python3 -m venv "$venv_path" fi