Sources for snaps

how to get the sources of the snap find applications(eg: hello/hello-word). i am running snap in arm64. i tried to build the hello word in host machine for arm64 (https://snapcraft.io/docs/build-snaps/your-first-snap)

ERROR: command ‘[’/bin/sh’, ‘/tmp/tmpon0i6aeh’, ‘./configure’, ‘–prefix=’, ‘–host=arm64’]’ returned non-zero exit status 1

vinaysimha@localhost:~$ snap find hello
Name Version Developer Notes Summary
hello-world 6.3 canonical - The ‘hello-world’ of snaps
hello-takaakisuzuki-aarch 2.12 takaakisuzuki - GNU Hello, the “hello world” snap
hello-securx-snap 1.0 securx - Single-line elevator pitch for your amazing snap
hello 2.10 canonical - GNU Hello, the “hello world” snap

There should be more errors above the line you quoted which detail what exactly went wrong with ./configure.

hello $ snapcraft --target-arch arm64
Setting target machine to ‘arm64’
“grade” property not specified: defaulting to “stable”
Skipping pull gnu-hello (already ran)
Preparing to build gnu-hello
Building gnu-hello
./configure --prefix= --host=arm64
checking for a BSD-compatible install… /usr/bin/install -c
checking whether build environment is sane… yes
checking for arm64-strip… no
checking for strip… strip
checking for a thread-safe mkdir -p… /bin/mkdir -p
checking for gawk… no
checking for mawk… mawk
checking whether make sets $(MAKE)… yes
checking whether make supports nested variables… yes
checking for arm64-gcc… aarch64-linux-gnu-gcc
checking whether the C compiler works… yes
checking for C compiler default output file name… a.out
checking for suffix of executables…
checking whether we are cross compiling… yes
checking for suffix of object files… o
checking whether we are using the GNU C compiler… yes
checking whether aarch64-linux-gnu-gcc accepts -g… yes
checking for aarch64-linux-gnu-gcc option to accept ISO C89… none needed
checking whether aarch64-linux-gnu-gcc understands -c and -o together… yes
checking for style of include used by make… GNU
checking dependency style of aarch64-linux-gnu-gcc… gcc3
checking how to run the C preprocessor… aarch64-linux-gnu-gcc -E
checking for grep that handles long lines and -e… /bin/grep
checking for egrep… /bin/grep -E
checking for Minix Amsterdam compiler… no
checking for arm64-ar… no
checking for ar… ar
configure: WARNING: using cross tools not prefixed with host triplet
checking for arm64-ranlib… no
checking for ranlib… ranlib
checking for ANSI C header files… yes
checking for sys/types.h… yes
checking for sys/stat.h… yes
checking for stdlib.h… yes
checking for string.h… yes
checking for memory.h… yes
checking for strings.h… yes
checking for inttypes.h… yes
checking for stdint.h… yes
checking for unistd.h… yes
checking minix/config.h usability… no
checking minix/config.h presence… no
checking for minix/config.h… no
checking whether it is safe to define EXTENSIONS… yes
checking whether _XOPEN_SOURCE should be defined… no
checking build system type… x86_64-unknown-linux-gnu
checking host system type… Invalid configuration arm64': machine arm64’ not recognized
configure: error: /bin/bash build-aux/config.sub arm64 failed
Command ‘[’/bin/sh’, ‘/tmp/tmp9_7gra_v’, ‘./configure’, ‘–prefix=’, ‘–host=arm64’]’ returned non-zero exit status 1
hello $

i dont think you can use --target-arch for non-kernel snaps like this … ( @kalikiana may correct me, but i think currently only kernel snap builds are allowed natively when using --target-arch, all other setups need a remote lxd on the respective arch)

i’d suggest to use the classic snap (snap install classic --beta --devmode; sudo classic) on your dragonboard and then install the snapcarft deb inside that …

You can use --target-arch for non-kernel snaps. But the remote machine needs to be armhf. So for example I have a Raspberry Pi running Ubuntu Server (not core) which has lxd installed. So on my laptop I do snapcraft cleanbuild --remote raspberrypi --target-arch armhf which spins up a lxc container on the pi, builds the snap there, then copies the armhf snap back to my laptop.

1 Like

This bug has been fixed btw and was just a workaround when using remote containers.

1 Like

Question, is the hello project cross compilable? We do support it in most plugins now as long as no stage-packages are needed (or extra build-packages which required support for on arch-from-arch selector support).