library linter fails on foreign archs and can't be disabled for core20
Metadata
Current evaluation
No evaluation has been recorded for this issue yet.
Issue body
### Bug Description
When building a snap that includes ELF files that target a foreign arch (i.e. not the build machine's arch), snapcraft still attempts to lint the library deps and fails. The way in which it fails differs depending on whether the lib is ubuntu archive built, or self-built. I haven't been able to pin down what the exact difference is, but in the self-built case, the failures present as SEGFAULTS in qemu-static, which generate core dumps which can take up 20+ gigabytes of disk space in a real-world use case.
Not a RCA, but to mitigate the issue, on base: core22, this can be worked around by disabling linting (since even in the best case the linting isn't working). On base: core20, there is no real mitigation because linting cannot be disabled.
### To Reproduce
Build the attached snapcraft.yaml using --use-lxd
### Environment
Ubuntu 22.04
snapcraft 7.5.2
Built with --use-lxd
### snapcraft.yaml
```shell
name: my-snap-name # you probably want to 'snapcraft register <name>'
base: core20 # the base snap is the execution environment for this snap
version: '0.1' # just for humans, typically '1.2+git' or '1.3.2'
summary: Single-line elevator pitch for your amazing snap # 79 char long summary
description: |
This is my-snap's description. You have a paragraph or two to tell the
most important story about your snap. Keep it under 100 words though,
we live in tweetspace and your description wants to look good in the snap
store.
grade: devel # must be 'stable' to release into candidate/stable channels
confinement: devmode # use 'strict' once you have the right plugs and slots
architectures:
- build-on: [ amd64 ]
run-on: arm64
package-repositories:
- type: apt
architectures: [ arm64 ]
components: [ main, universe ]
suites: [ focal, focal-security, focal-updates, focal-backports ]
key-id: F6ECB3762474EDA9D21B7022871920D1991BC93C
url: http://ports.ubuntu.com/ubuntu-ports
parts:
a-part:
plugin: nil
stage-packages:
- jq:arm64
my-part:
plugin: dump
source: ./my-compiled-elfs
```
### Relevant log output
```shell
# When the files come from the ubuntu archive
...
Priming jq
+ snapcraftctl prime
not a dynamic executable
not a dynamic executable
Unable to determine library dependencies for '/root/prime/usr/lib/aarch64-linux-gnu/libjq.so.1.0.4'
not a dynamic executable
not a dynamic executable
aarch64-binfmt-P: Could not open '/lib/ld-linux-aarch64.so.1': No such file or directory
Unable to determine library dependencies for '/root/prime/usr/bin/jq'
...
# When it is self-built
Priming my-part
+ snapcraftctl prime
not a dynamic executable
not a dynamic executable
aarch64-binfmt-P: Could not open '/lib/ld-linux-aarch64.so.1': No such file or directory
Unable to determine library dependencies for '/root/prime/usr/bin/my-bin'
not a dynamic executable
not a dynamic executable
qemu: uncaught target signal 11 (Segmentation fault) - core dumped
Unable to determine library dependencies for '/root/prime/usr/lib/my-lib.so'
```
### Additional context
_No response_
Evaluation history
No evaluation history available.