Skip to content

Commit

Permalink
elf_utils: add missing triplet for i386
Browse files Browse the repository at this point in the history
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
```
  • Loading branch information
valentindavid authored and sergiusens committed Jun 4, 2023
1 parent 9f35295 commit 530ad01
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions snapcraft/elf/elf_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
}


Expand Down
3 changes: 3 additions & 0 deletions tests/unit/elf/test_elf_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand All @@ -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):
Expand Down Expand Up @@ -202,4 +204,5 @@ def test_get_all_arch_triplets(self):
"riscv64-linux-gnu",
"s390x-linux-gnu",
"x86_64-linux-gnu",
"i386-linux-gnu",
]

0 comments on commit 530ad01

Please sign in to comment.