Snapcraft uses “ldd” to check library dependencies.
This is not working for cross-builds (building will give lots of “Unable to determine library dependencies” warnings).
Here is how to solve this:
- Make ldd “cross-capable” (only a few simple modifications required, see attached example for armhf)
- Force snapcraft to use your new “cross-ldd”. I did this by symlinking it to /usr/local/bin/ldd, but there might be better solutions (that don’t override your host-ldd).
- Add build dependency on qemu-user-static (which does the heavy lifting in getting ldd “cross-capable”)
How it works:
ldd is just a script that calls the system linker/loader (ld*.so).
We just need to change its list of eligible linker/loaders to include the target-platform ones, and then use QEMU for the call. By relying on binfmt, it is even possible to completely emit qemu from the cross-ldd file, but this does not work inside LXC containers.
arm-linux-gnueabihf-ldd: https://pastebin.com/LDgZaE7K