ogra
July 19, 2018, 10:22am
2
see the architectures documentation, build-on
and run-on
were recently added (this does not yet fully work with build.snapcraft.io though, you will have to build locally):
By default, Snapcraft builds a snap to run on the same architecture as the build environment. This behaviour can be modified with the top-level keywords architectures and platforms in the snap’s snapcraft.yaml.
The architectures and platforms keywords are used to create a build plan. See build plans for an explanation of how build plans are created.
The keywords are base-dependent:
platforms is used for core24 snaps
architectures is used for core20 and core22 snaps
How to create a snap for …
there is also $SNAP_ARCH_TRIPLET
:
Summary
In bug LP: #1742565 a way for the snap to get the gnu arch triplet (like x86_64-linux-gnu) in addition to the SNAP_ARCH (amd64) is requested.
Many snaps use paths internally that use the triplet to find plugins or libraries which means that currently there are a lot of wrapper scripts that contain code like:
case $SNAP_ARCH in
amd64) export TRIPLET=x86_64-linux-gnu
...
by providing this as an environment via snap run we are one step close to the goal of getting rid of wrapper scrip…
and $SNAPCRAFT_ARCH_TRIPLET
:
when using scriptlets to handle more complex build use cases, it’s difficult to keep cross compilation option working when one does not know what is target architecture.
Can you we add something like: SNAPCRAFT_TARGET_ARCH
1 Like