Can't install snapcraft on new M1 mac

Hey there,

I’m trying to run brew install snapcraft but am seeing this error when doing so:

Error: snapcraft dependencies not built for the arm64 CPU architecture:
  gdbm was built for x86_64

Anyone else facing this? Anyone have any suggestions for getting around it?

Thanks!
Thomas

2 Likes

Where is your home-brew prefix located? Is it /opt/homebrew or /usr/local? If the latter then the likelihood is you’re using homebrew for x86_64. I’ve checked my own m1 Mac and the homebrew repository - the gdbm formula correctly has an arm64 bottle so you should get it if your homebrew is an arm64 build. gdbm installed fine for me, as did snapcraft.

1 Like

Here’s my brew config:
% brew config
HOMEBREW_VERSION: 3.1.3
ORIGIN: https://github.com/Homebrew/brew
HEAD: d89eda09abbeae907eb88bd6d01dc9cde7ff0e19
Last commit: 9 hours ago
Core tap ORIGIN: https://github.com/Homebrew/homebrew-core
Core tap HEAD: e99bc3276a44bd2f7f80b5152688666d3aa72b19
Core tap last commit: 2 hours ago
Core tap branch: master
HOMEBREW_PREFIX: /opt/homebrew
HOMEBREW_CASK_OPTS: []
HOMEBREW_MAKE_JOBS: 8
Homebrew Ruby: 2.6.3 => /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/ruby
CPU: octa-core 64-bit arm_firestorm_icestorm
Clang: 12.0 build 1200
Git: 2.24.3 => /Applications/Xcode.app/Contents/Developer/usr/bin/git
Curl: 7.64.1 => /usr/bin/curl
macOS: 11.2.3-arm64
CLT: N/A
Xcode: 12.4
Rosetta 2: false

It looks like it is using /opt/homebrew ?

Maybe I’ll try re-installing homebrew?

I did a fresh install of brew on my system and now it seems to work!

2 Likes

@lucyllewy

I was able to install snapcraft after re-installing homebrew, but now I’m seeing a different issue when trying to run snapcraft login - Not able to run snapcraft login on mac m1

Thanks for taking look!

Were you also able to build your snap on the M1 ? I am trying to figure out if Multipass works on M1 to build snap packages.

Multipass cannot start VMs on an M1 mac, currently. This is due to using xHyve as the provider, instead of QEMU. VirtualBox does not support the M1 mac at all. QEMU should AFAICT support starting a VM on an M1 mac, but I haven’t tried it. Alternatively if Multipass could target Parallels that would work, but the backend code doesn’t exist for that and it would also require Multipass users to be Parallels customers.

The reason xHyve is an issue is it targets an older Apple API that has been deprecated in Big Sur, so Multipass is waiting on them to fix up their support first.

machyve/xhyve: xhyve, a lightweight OS X virtualization solution (github.com)

It looks like there has been great progress on this already by @townsend (https://github.com/canonical/multipass/issues/1857), hoping we can have something working in the medium term

I’ve downloaded the multipass build from that issue and installed it on my own m1 mac. While multipass seems to work, snapcraft is pulling images named snapcraft:$base_snap i.e. snapcraft:core20 et al, without any architecture specifics for arm64. This means that it is trying to launch an amd64 image on an arm64 cpu. So we need @sergiusens or @cjp256 to look into what is required for arm-based images for building there.