Error during snap build with core20

I’m trying to build a snap with core20 in a Raspberry Pi 4.

This is my snapcraft.yaml:

 name: test
 summary: test summary.
 description: |
 test description.
 version: '1.0'
 grade: devel
 confinement: devmode
 base: core20

apps:
#myapps

parts:
#myparts

architectures:
  - build-on: arm64
    run-on: [arm64]

but I get this error:

Cannot find the linker to use for the target base ‘core20’. Please verify that the linker exists at the expected path ‘/snap/core20/current/lib/ld-linux-aarch64.so.1’ and try again. If the linker does not exist contact the author of the base (run snap info core20 to get information for this base).

I checked and the link is actually there: immagine

What am I doing wrong?

Bonus question: can I build a snap only with the “core20” installed? Without the “core”? Or the “core” is always necessary?

Thank you.

As far as I know, you need core20 in-order to build core20 based snaps. Use snap list to find whether core20 is installed or not. If not then use sudo snap install core20 in the shell to get it.

Edit: And you also need core

I already have both core20 and core on my system.

So you’re saying that it’s not possible to build a snap with only “core20” but I also need “core” (I need to know this for another system I have to install the snap).

Is it true? @hiran_sarkar

I am not really sure, but I think you will need core20 and core on the system where you would like to install the snap

How did you invoke snapcraft ?

Just typing snapcraft (or sudo snapcraft maybe, I don’t remember).

Raspberry PI 4 is an arm64 architecture or an armhf architecture?

You can install either an arm64 or an armhf image on the Raspberry Pi 4. What’s the output of arch and snap version on your Raspberry Pi 4?

Also, what is the output of snap list?

I’m using Ubuntu Core (https://cdimage.ubuntu.com/ubuntu-core/20/stable/current/). The output of snap list is:

core20          20211129       1274   latest/stable  canonical✓  base
pi              20-1           97     20/stable      canonical✓  gadget
pi-kernel       5.4.0-1048.53  377    20/stable      canonical✓  kernel
snapd           2.53.4         14296  latest/stable  canonical✓  snapd

I have to install the snap with “core20” and without the “core” snap. Is that possible?

You do not need the core snap installed on Ubuntu Core 20 unless you are trying to install a snap which has as it’s base core. The snapcraft.yaml you are sharing, assuming you are able to build it, will not need the core snap installed when you go to install this snap on Ubuntu Core 20.