Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Core22 snaps do not build on Apple silicon #4211

Closed
mr-cal opened this issue Jun 15, 2023 · 3 comments
Closed

Core22 snaps do not build on Apple silicon #4211

mr-cal opened this issue Jun 15, 2023 · 3 comments
Labels
Bug Actual bad behavior that don't fall into maintenance or documentation

Comments

@mr-cal
Copy link
Collaborator

mr-cal commented Jun 15, 2023

Bug Description

Building core22 snaps fails due to how craft-parts parses system architecture from the python call platform.machine().

This issue was uncovered when Multipass 1.12.0 was released, which enables using snapcraft on Apple silicon.

To Reproduce

snapcraft

Environment

MacOS on Apple silicon (M1 or M2), snapcraft 7.3.1 via brew

snapcraft.yaml

name: my-snap-name
base: core22
version: '0.1'
summary: hello world
description: hello world
grade: devel
confinement: devmode

parts:
  my-part:
    plugin: nil

Relevant log output

snapcraft --trace       
Options -t and --trace are deprecated, use --verbosity=debug instead.                                                            
2023-06-15 09:29:08.520 Starting Snapcraft 7.3.1                                                                                 
2023-06-15 09:29:08.520 Logging execution to '/Users/<user>/Library/Logs/snapcraft/snapcraft-20230615-092908.520220.log'   
2023-06-15 09:29:08.521 lifecycle command: 'pack', arguments: Namespace(destructive_mode=False, use_lxd=False, debug=False, enable_manifest=False, manifest_image_information=None, bind_ssh=False, build_for=None, http_proxy=None, https_proxy=None, ua_token=None, enable_experimental_ua_services=False, enable_experimental_extensions=False, enable_developer_debug=False, enable_experimental_target_arch=False, target_arch=None, provider=None, directory=None, output=None)                                                  
2023-06-15 09:29:08.521 command: pack, arguments: Namespace(destructive_mode=False, use_lxd=False, debug=False, enable_manifest=False, manifest_image_information=None, bind_ssh=False, build_for=None, http_proxy=None, https_proxy=None, ua_token=None, enable_experimental_ua_services=False, enable_experimental_extensions=False, enable_developer_debug=False, enable_experimental_target_arch=False, target_arch=None, provider=None, directory=None, output=None)                                                              
2023-06-15 09:29:08.525 CPU count (from multiprocessing): 8                                                                      
2023-06-15 09:29:08.525 Invalid SNAPCRAFT_MAX_PARALLEL_BUILD_COUNT ''                                                            
2023-06-15 09:29:08.525 Running on arm64 for arm64                                                                               Traceback (most recent call last):
  File "/opt/homebrew/bin/snapcraft", line 8, in <module>
    sys.exit(run())
             ^^^^^
  File "/opt/homebrew/Cellar/snapcraft/7.3.1/libexec/lib/python3.11/site-packages/snapcraft/cli.py", line 243, in run
    _run_dispatcher(dispatcher)
  File "/opt/homebrew/Cellar/snapcraft/7.3.1/libexec/lib/python3.11/site-packages/snapcraft/cli.py", line 219, in _run_dispatcher
    dispatcher.run()
  File "/opt/homebrew/Cellar/snapcraft/7.3.1/libexec/lib/python3.11/site-packages/craft_cli/dispatcher.py", line 448, in run
    return self._loaded_command.run(self._parsed_command_args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/snapcraft/7.3.1/libexec/lib/python3.11/site-packages/snapcraft/commands/lifecycle.py", line 259, in run
    super().run(parsed_args)
  File "/opt/homebrew/Cellar/snapcraft/7.3.1/libexec/lib/python3.11/site-packages/snapcraft/commands/lifecycle.py", line 132, in run
    parts_lifecycle.run(self.name, parsed_args)
  File "/opt/homebrew/Cellar/snapcraft/7.3.1/libexec/lib/python3.11/site-packages/snapcraft/parts/lifecycle.py", line 208, in run
    _expand_environment(
  File "/opt/homebrew/Cellar/snapcraft/7.3.1/libexec/lib/python3.11/site-packages/snapcraft/parts/lifecycle.py", line 681, in _expand_environment
    info = craft_parts.ProjectInfo(
           ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/snapcraft/7.3.1/libexec/lib/python3.11/site-packages/craft_parts/infos.py", line 92, in __init__
    self._set_machine(arch)
  File "/opt/homebrew/Cellar/snapcraft/7.3.1/libexec/lib/python3.11/site-packages/craft_parts/infos.py", line 268, in _set_machine
    raise errors.InvalidArchitecture(self._host_arch)
craft_parts.errors.InvalidArchitecture: Architecture 'arm64' is not supported.
Make sure the architecture name is correct.

Additional context

https://forum.snapcraft.io/t/architecture-arm64-is-not-supported-error-on-apple-m1-with-core22-base/35634/10

@mr-cal mr-cal added the Bug Actual bad behavior that don't fall into maintenance or documentation label Jun 15, 2023
@klinquist
Copy link

Looks like the craft-parts bug has been merged: canonical/craft-parts#476
Any idea when this will make it into a snapcraft brew macos release? Thanks!

@jacobsvante
Copy link

Oh pretty please make this happen 😀

@sergiusens
Copy link
Collaborator

Homebrew would be good to go as soon as #4145 is solved

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Actual bad behavior that don't fall into maintenance or documentation
Projects
None yet
Development

No branches or pull requests

4 participants