Fail to build snap on riscv64

The go snap fails to build on riscv64.

The build log is at https://launchpad.net/~go-snap-maintainers/+snap/go120/+build/2067566

The relevant part is

Cannot pack snap file: Command '['snap', 'pack', '--filename', 'go_1.20.2_riscv64.snap', '--compression', 'xz', PosixPath('/build/go/prime'), PosixPath('/build/go')]' returned non-zero exit status 20. (error: cannot pack "/build/go/prime": mksquashfs call failed: libgcc_s.so.1 must be installed for pthread_cancel to work)

I assume the mksquashfs command is from the snapcraft snap (or snapd snap?)? So it’s broken by missing libgcc_s.so.1?

Has anyone successfully built snaps with core22 on riscv64?

Have you tried simply adding libgcc (probably with an architecture flag for riscv64) to your build-packages to work around the blocker for the moment?

I think it’s already there. I have build-essential in build-packages. It should brings libgcc-s1. And I can see libgcc-s1 is in the build log.

1 Like

@mvo care to look into this?

it’s already fixed 6 month ago, but not released in riscv64 branch.

ref:

Actually libgcc_s1 is in snapd’s snap

$ sudo find /snap/snapd/ -name libgcc_s.so.1
/snap/snapd/18440/lib/libgcc_s.so.1
/snap/snapd/18331/lib/libgcc_s.so.1

but the execution doesn’t include /lib path

ubuntu      1105 97.8  7.4 349004 73152 ttyS0    Sl+  07:47   4:35          \_ /snap/snapd/current/lib/riscv64-linux-gnu/ld-2.31.so --library-path /snap/snapd/current/usr/local/lib:/snap/sn
apd/current/usr/local/lib/riscv64-linux-gnu:/snap/snapd/current/lib/riscv64-linux-gnu:/snap/snapd/current/usr/lib/riscv64-linux-gnu /snap/snapd/current/usr/bin/mksquashfs . /home/ubuntu/go-
snap/prime/go_1.20.2_amd64.snap -noappend -comp xz -no-fragments -no-progress -wildcards -ef /tmp/.snap-pack-exclude-704354971 -all-root -no-xattrs 

I merged xnox branch in https://github.com/snapcore/snapd/pull/12616 and triggered a new build, hopefully that fixes the issue. Fwiw, in ā€œedgeā€ the problem is fixed so hopefully that is enough.

@mvo sadly it fails to build… (not sure why apparmor part is dropped in beta-riscv64 branch… accident?)

The snapcraft.yaml in riscv64 branch is almost same with release branch, and the difference is guarded by riscv64 condition… so maybe it’s time to merge back?

Hi zhsj,

The build works after another merge from mvo on 12 April.