From 530ad01f916608d38ad8be59eeecdc984f1bc3c8 Mon Sep 17 00:00:00 2001 From: Valentin David Date: Thu, 1 Jun 2023 14:36:27 +0200 Subject: [PATCH] elf_utils: add missing triplet for i386 When cross compiling a snap to i386, snap yaml generation fails with `RuntimeError: Arch triplet not defined for arch 'i686'` ``` architectures: - build-on: amd64 build-for: i386 ``` --- snapcraft/elf/elf_utils.py | 1 + tests/unit/elf/test_elf_utils.py | 3 +++ 2 files changed, 4 insertions(+) diff --git a/snapcraft/elf/elf_utils.py b/snapcraft/elf/elf_utils.py index 2de36d2920..b715ce0e16 100644 --- a/snapcraft/elf/elf_utils.py +++ b/snapcraft/elf/elf_utils.py @@ -104,6 +104,7 @@ class _ArchConfig: "riscv64": _ArchConfig("riscv64-linux-gnu", "lib/ld-linux-riscv64-lp64d.so.1"), "s390x": _ArchConfig("s390x-linux-gnu", "lib/ld64.so.1"), "x86_64": _ArchConfig("x86_64-linux-gnu", "lib64/ld-linux-x86-64.so.2"), + "i686": _ArchConfig("i386-linux-gnu", "lib/ld-linux.so.2"), } diff --git a/tests/unit/elf/test_elf_utils.py b/tests/unit/elf/test_elf_utils.py index 854199dc4a..db4c00bd12 100644 --- a/tests/unit/elf/test_elf_utils.py +++ b/tests/unit/elf/test_elf_utils.py @@ -157,6 +157,7 @@ class TestArchConfig: ("riscv64", "riscv64-linux-gnu"), ("s390x", "s390x-linux-gnu"), ("x86_64", "x86_64-linux-gnu"), + ("i686", "i386-linux-gnu"), ], ) def test_get_arch_triplet_host(self, mocker, machine, expected_arch_triplet): @@ -175,6 +176,7 @@ def test_get_arch_triplet_host(self, mocker, machine, expected_arch_triplet): ("riscv64", "riscv64-linux-gnu"), ("s390x", "s390x-linux-gnu"), ("x86_64", "x86_64-linux-gnu"), + ("i686", "i386-linux-gnu"), ], ) def test_get_arch_triplet(self, mocker, machine, expected_arch_triplet): @@ -202,4 +204,5 @@ def test_get_all_arch_triplets(self): "riscv64-linux-gnu", "s390x-linux-gnu", "x86_64-linux-gnu", + "i386-linux-gnu", ]