Snapcraft 3.x target-arch not working

When I try to build my snap using snapcraft --target-arch=armhf it still installs the amd64 version of the dependencies.

My snapcraft.yaml:

    build-packages:
      - to armhf: ["libgphoto2-dev:armhf", "v4l-utils:armhf", "libssl-dev:armhf"]
      - to amd64: ["libgphoto2-dev:amd64", "v4l-utils:amd64", "libssl-dev:amd64"]
    stage-packages:
      - to armhf: ["libgphoto2-6:armhf", "libv4l-0:armhf", "libssl1.0.0:armhf"]
      - to amd64: ["libgphoto2-6:amd64", "libv4l-0:amd64", "libssl1.0.0:amd64"]
1 Like

We decided not to move with --target-arch yet when using bases as we want to have an improved experience.

Sorry for the disruption, but it should be possible to use this with --destructive-mode still. The reason for moving out of this is that there are many corner cases presented with cross compilation and the experience is not that great for general use.

1 Like

Ah okay, I was hoping it was just a different syntax. I will be eagerly looking forward to that feature arriving. :slight_smile:

Using both --target-arch=armhf and --destructive-mode for my snap on my 18.04.1 LTS host results in “Sorry, an error occurred in Snapcraft”. The trace.txt file shows that the make plugin throws a NotImplementedError (“does not support cross-compiling to a different architecture”). I think that snapcraft v2.x printed this warning directly to STDOUT, so this might be a slight DX improvement.

Until the make plugin gains cross-compilation support, the instructions in “Request help troubleshoot cross compilation problem ” worked for me.

1 Like

this is specific to the make plugin though, cross-compiling didnt work with that plugin in 2.x either …

EDIT: oops ignore that … i should read to the end before replying

1 Like