canonical / rockcraft

Tool to create OCI Images using the language from Snapcraft and Charmcraft.
GNU General Public License v3.0
35 stars 43 forks source link

Building for arm not possible on Raspberry Pi 3 (32 bit) #319

Open ghislainbourgeois opened 1 year ago

ghislainbourgeois commented 1 year ago

Bug Description

Building a ROCK for arm does not work on a Raspberry Pi 3 running the 32 bit version of Ubuntu 22.04.

Rockcraft simply refuses to build with the following error message:

Error for platform entry 'arm': this machine's architecture (armv7l) is not compatible with the ROCK's target architecture. Can only build a ROCK for arm if the host is compatible with ['arm'].

To Reproduce

rockcraft init
sed -i "s/amd64/arm/" rockcraft.yaml
rockcraft --verbose

Environment

Raspberry Pi 3 Model B Ubuntu Server 22.04.2 LTS

rockcraft.yaml

name: my-rock-name # the name of your ROCK
base: ubuntu:22.04 # the base environment for this ROCK
version: '0.1' # just for humans. Semantic versioning is recommended
summary: Single-line elevator pitch for your amazing ROCK # 79 char long summary
description: |
    This is my my-rock-name's description. You have a paragraph or two to tell the
    most important story about it. Keep it under 100 words though,
    we live in tweetspace and your description wants to look good in the
    container registries out there.
license: GPL-3.0 # your application's SPDX license
platforms: # The platforms this ROCK should be built on and run on
    arm:

parts:
    my-part:
        plugin: nil

Relevant log output

Error for platform entry 'arm': this machine's architecture (armv7l) is not compatible with the ROCK's target architecture. Can only build a ROCK for arm if the host is compatible with ['arm'].
cjdcordeiro commented 1 year ago

right, the desired arch must be compatible with the host's machine architecture. The latter is inferred from within the code, and its true value seems to be armv7l. Can you try sed -i "s/amd64/armv7l/" rockcraft.yaml instead? (although I think it might fail too, after a quick glance at the code)