3

I am on a x86_64-linux-gnu machine and trying to build a snap from source for arm-linux-gnueabihf (Raspberry Pi3) using autotools.

I manage to build the snap but after I upload to the store it always says that the supported architecture is:

Supported architectures amd64

My snapcraft.yaml looks like this:

name: hellocsnap
version: '1.17'
summary:  Hello World snap written in C 
description: This snap says hello and adds 2 numbers.
grade: stable
confinement: strict
apps:
  hello:
    command: hellocsnap
parts:
  test-hellocsnap:
   plugin: autotools
   configflags: 
       - --build=x86_64-linux-gnu
       - --host=arm-linux-gnueabihf
source: source/

When running snapcraft I get the following error:

Priming test-hellocsnap 

Unable to determine library dependencies for b' /home/..../prime/bin/hellocsnap'

Does any one know how to pack a snap from source on a amd64 for Raspberry Pi?

2

I'm pretty sure I read somewhere that snapcraft does not yet provide option to crosscompile code for different architectures.

I wanted to do the same thing but could not figure out how to use autotools to do it. Instead I used eclipse to build my project and configured it to build for armhf. Later on I placed executable and everything needed for my app to work to one folder and used plugin: dump instead of plugin: autotools. You will need to add architectures: [armhf] if you are planning to add it to the Ubuntu store. I got the same message like you did but I already tested the code without the snap and I knew that I packaged everything I need so I just ignored it.

Alternatively you could take a look at Launchpad which could help you build it for a variety of environments.

| improve this answer | |
  • Did you have to add --target-arch armhf to your call to snapcraft? – RQDQ Jun 12 '18 at 14:12
0

I did run: snapcraft build --target-arch=armhf

And it ran all the way through without an error. However it did not create a hello_2.10_armhf.snap package as expected.

snapcraft.yaml:

name: hello
version: '2.10'
summary: GNU Hello, the "hello world" snap
description: |
  GNU hello prints a friendly greeting.
grade: devel
confinement: devmode
parts:
  gnu-hello:
    source: http://ftp.gnu.org/gnu/hello/hello-2.10.tar.gz
    plugin: autotools
| improve this answer | |
  • 2
    Just run snapcraft --target-arch=armhf, without the "build" keyword. Produces a nice snap package ready to go. – Jack Nimble Mar 29 '19 at 3:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.