NordicPlayground/nrf-docker

nrfutil 6 is not compatible with aarch64

jfroy opened this issue · 10 comments

jfroy commented

Building the container on aarch64 results in nrfutil 5.2.0 being installed, which cannot run under python3 and fails.

sudo docker run --rm nrfconnect-sdk nrfutil version
nrfutil version 5.2.0

Doing the same under amd64 results in nrfutil 6.1.7.

Can you try the change in #27 and see if that works for you?

Right GitHub Actions only supports x86_64 architecture, so I cannot test this automatically.

jfroy commented

That seems to break the build.

upgrading shared libraries...
installing nrfutil from spec 'nrfutil>=6.0.0'...
Fatal error from pip prevented installation. Full pip output in file:
    /opt/pipx/logs/cmd_2022-10-10_08.25.27_pip_errors.log

pip seemed to fail to build package:
    nrfutil>=6.0.0

Some possibly relevant errors from pip install:
    ERROR: Cannot install nrfutil==6.0.1, nrfutil==6.1.0, nrfutil==6.1.1, nrfutil==6.1.2, nrfutil==6.1.3, nrfutil==6.1.4, nrfutil==6.1.5, nrfutil==6.1.6 and nrfutil==6.1.7 because these package versions have conflicting dependencies.
    ERROR: ResolutionImpossible: for help visit https://pip.pypa.io/en/latest/topics/dependency-resolution/#dealing-with-dependency-conflicts
Error installing nrfutil from spec 'nrfutil>=6.0.0'.

Ran the pipx command outside of a container build to get the log:

----------
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Collecting nrfutil>=6.0.0
  Using cached https://www.piwheels.org/simple/nrfutil/nrfutil-6.1.7-py3-none-any.whl (898 kB)
  Downloading https://www.piwheels.org/simple/nrfutil/nrfutil-6.1.6-py3-none-any.whl (898 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 898.0/898.0 kB 1.1 MB/s eta 0:00:00
  Downloading https://www.piwheels.org/simple/nrfutil/nrfutil-6.1.5-py3-none-any.whl (898 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 898.0/898.0 kB 2.7 MB/s eta 0:00:00
  Downloading https://www.piwheels.org/simple/nrfutil/nrfutil-6.1.4-py3-none-any.whl (897 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 897.9/897.9 kB 2.7 MB/s eta 0:00:00
  Downloading https://www.piwheels.org/simple/nrfutil/nrfutil-6.1.3-py3-none-any.whl (896 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 896.7/896.7 kB 3.0 MB/s eta 0:00:00
Collecting pyyaml
  Using cached PyYAML-6.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (731 kB)
Collecting pyspinel>=1.0.0a3
  Using cached https://www.piwheels.org/simple/pyspinel/pyspinel-1.0.3-py3-none-any.whl (65 kB)
Collecting intelhex
  Using cached https://www.piwheels.org/simple/intelhex/intelhex-2.3.0-py2.py3-none-any.whl (50 kB)
Collecting ecdsa
  Using cached https://www.piwheels.org/simple/ecdsa/ecdsa-0.18.0-py2.py3-none-any.whl (142 kB)
Collecting crcmod
  Using cached crcmod-1.7-cp39-cp39-linux_aarch64.whl
Collecting tqdm
  Using cached https://www.piwheels.org/simple/tqdm/tqdm-4.64.1-py2.py3-none-any.whl (78 kB)
Collecting protobuf
  Using cached protobuf-4.21.7-cp37-abi3-manylinux2014_aarch64.whl (403 kB)
Collecting piccata
  Using cached https://www.piwheels.org/simple/piccata/piccata-2.0.1-py3-none-any.whl (21 kB)
Collecting libusb1==1.9.3
  Using cached https://www.piwheels.org/simple/libusb1/libusb1-1.9.3-py3-none-any.whl (60 kB)
Collecting click
  Using cached https://www.piwheels.org/simple/click/click-8.1.3-py3-none-any.whl (96 kB)
Collecting pyserial
  Using cached https://www.piwheels.org/simple/pyserial/pyserial-3.5-py2.py3-none-any.whl (90 kB)
Collecting nrfutil>=6.0.0
  Downloading https://www.piwheels.org/simple/nrfutil/nrfutil-6.1.2-py3-none-any.whl (896 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 896.7/896.7 kB 1.1 MB/s eta 0:00:00
  Downloading https://www.piwheels.org/simple/nrfutil/nrfutil-6.1.1-py3-none-any.whl (896 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 896.7/896.7 kB 2.3 MB/s eta 0:00:00
Collecting libusb1
  Using cached https://www.piwheels.org/simple/libusb1/libusb1-3.0.0-py3-none-any.whl (62 kB)

The conflict is caused by:
    nrfutil 6.1.7 depends on pc-ble-driver-py>=0.16.4
    nrfutil 6.1.6 depends on pc-ble-driver-py>=0.16.4
    nrfutil 6.1.5 depends on pc-ble-driver-py>=0.16.4
    nrfutil 6.1.4 depends on pc-ble-driver-py>=0.16.4
    nrfutil 6.1.3 depends on pc-ble-driver-py>=0.16.1
    nrfutil 6.1.2 depends on pc-ble-driver-py==0.16.2
    nrfutil 6.1.1 depends on pc-ble-driver-py>=0.16.1

To fix this you could try to:
1. loosen the range of package versions you've specified
2. remove package versions to allow pip attempt to solve the dependency conflict


PIP STDERR
----------
ERROR: Cannot install nrfutil==6.1.1, nrfutil==6.1.2, nrfutil==6.1.3, nrfutil==6.1.4, nrfutil==6.1.5, nrfutil==6.1.6 and nrfutil==6.1.7 because these package versions have conflicting dependencies.
ERROR: ResolutionImpossible: for help visit https://pip.pypa.io/en/latest/topics/dependency-resolution/#dealing-with-dependency-conflicts

And this is basically NordicSemiconductor/pc-ble-driver-py#193 and NordicSemiconductor/pc-ble-driver-py#227.

jfroy commented

Seems like the only viable path would be to either run the old version under python2, or ignore that dependency and declare that some functionality will be missing, or try to automate a from-source build process (maybe inspired by NordicSemiconductor/pc-ble-driver#271 (comment)).

I guess the solution for now would be to provide nrfutil v5 for arm64 and v6+ for amd64. Building v6 from source for arm64 which we cannot test here is not a thing I would want to do right now.

Let's hear what @gregersrygg has to say as well, he is working on a Mac.

I guess™️ btw. that the way forward is not a PyPi release of nrfutil for arm64, because today you can use the Toolchain manager to install all the necessary tools. However this does not help today, in case you need nrfutil for CI/CD.

Closed PR #28, because nrfutil 5 does not work with Python 3.

Disable shipping nrfutil on arm64 for now.

jfroy commented

I guess™️ btw. that the way forward is not a PyPi release of nrfutil for arm64, because today you can use the Toolchain manager to install all the necessary tools. However this does not help today, in case you need nrfutil for CI/CD.

A Docker container is very useful, not just for CI/CD, but also for quickly getting a workstation working. It's also a pure command line solution for headless VMs and systems.

As another note, on Macs Rosetta provides good support for x84_64 binaries, but on aarch64 / arm64 Linux devices there isn't a good solution. There are tons of arm Chromebooks out there, and beefy workstations are coming from Ampere Computing, Nvidia, and other vendors.

Fully agree, that it is useful beyond CI/CD. However this project is not intended for bootstrapping developer machines. For that we have nRF Connect for Desktop.