InvalidArchitecture: Architecture 'armv8l' is not supported

Hi. I am trying to build armhf snap inside the container on arm64 machine. I am using armhf lxc ubuntu image. Getting this error. Changes to architectures field does not seem to have any effect. Any pointers on how to deal with this?

root@octo-pi3:/var/octo-avenger# snapcraft snap --destructive-mode --verbosity=debug
2024-03-24 14:09:11.570 Starting Snapcraft 7.5.5
Traceback (most recent call last):
  File "/snap/snapcraft/11046/bin/snapcraft", line 8, in <module>
  File "/snap/snapcraft/11046/lib/python3.8/site-packages/snapcraft/", line 256, in run
    _run_dispatcher(dispatcher, global_args)
  File "/snap/snapcraft/11046/lib/python3.8/site-packages/snapcraft/", line 229, in _run_dispatcher
  File "/snap/snapcraft/11046/lib/python3.8/site-packages/craft_cli/", line 448, in run
  File "/snap/snapcraft/11046/lib/python3.8/site-packages/snapcraft/commands/", line 138, in run, parsed_args)
  File "/snap/snapcraft/11046/lib/python3.8/site-packages/snapcraft/parts/", line 209, in run
  File "/snap/snapcraft/11046/lib/python3.8/site-packages/snapcraft/parts/", line 728, in _expand_environment
    info = craft_parts.ProjectInfo(
  File "/snap/snapcraft/11046/lib/python3.8/site-packages/craft_parts/", line 94, in __init__
  File "/snap/snapcraft/11046/lib/python3.8/site-packages/craft_parts/", line 281, in _set_machine
    raise errors.InvalidArchitecture(self._host_arch)
craft_parts.errors.InvalidArchitecture: Architecture 'armv8l' is not supported.
Make sure the architecture name is correct.

Snapcraft and craft-parts expect armv7l and not armv8l. It would be trivial to add armv8l to craft-parts but I’m not sure if it’s intentionally omitted.

If we make added support for armv8l, then a snap marked with the debian architecture armhf built on armv8l will not work on armv7l machines. (based on my limited understanding of arm architectures)

@cmatsuoka - what do you think?

Well … armv8l output in uname actually means that you are running on an arm64 (aarch64) host that is operating in 32bit compatibility mode, as long as the snap does not actually call directly into the kernel you should be fine since your userspace is most likely armhf anayway …

With armhf on the decline (thanks to 2038 approaching fast and not all distros doing the time_t transition to hold timestamp values in 64bit allocations (a 32bit integer as used by armhf today is to small to hold a unix timestamp beyond 2038)) we will likely see more often that armhf snaps will be built in 64bit hosts that run a 32bit container/userspace, so it might make sense to allow armv8l as a pattern match in snapcraft.

Yup, exactly my use case, I created lxc container with armhf userspace. With 0 aarch64 dependencies. I have a graviton aarch64 machine that I wanted to also use for pi3 armhf builds.

I guess I can find a code that checks the supported architectures and patch it inside my container for now. Snap will still mark the architecture though, is there a way to override that part easily?

I guess for local development I can patch that file? Do the same mapping you have for armv7hl perhaps and it should just work?

Yeah, a patch of that file I linked to above should work fine since your using destructive-mode. I think the same mapping for armv7l would work fine.

Do you mind creating an issue here so we can get this fixed?

Of course not -

Is this only a matter of adding armv8l: armv7l here? If so I can also make a PR for that (and updating a test)

    # Maps other possible ``platform.machine()`` values to the arch translations below.
    "arm64": "aarch64",
    "armv7hl": "armv7l",
    "i386": "i686",
    "amd64": "x86_64",
    "x64": "x86_64",

Edit: I did a PR - If it’s not the way you want to implement this either reject it or leave comments and I will fix them.

1 Like

Yes, thanks! I’ll follow up in the PR.

1 Like