After switching the ldc2
compiler snap to use base: core
, I’ve noticed some warnings showing up in the builds.
For amd64 builds:
The 'ldc' part is missing libraries that are not included in the snap or base. They can be satisfied by adding the following entry for this part
stage-packages:
- lib32gcc1
- libc6-i386
For i386 builds:
The 'ldc' part is missing libraries that are not included in the snap or base. They can be satisfied by adding the following entry for this part
stage-packages:
- lib64gcc1
- libc6-amd64
The reason for this appears to be because the package always includes both 32- and 64-bit versions of the D runtime and standard libraries. The ones whose bitness matches the “host” bitness of the snap always link against the C libs on the core snap. In the pre-base
version of the snap package, the same happens for the other bitness, e.g. in the amd64
build of the snap, the 32-bit libs link as follows:
/snap/ldc2/115/lib32$ ldd libdruntime-ldc-shared.so
linux-gate.so.1 => (0xf771e000)
libm.so.6 => /snap/core/current/lib/i386-linux-gnu/libm.so.6 (0xf757d000)
libpthread.so.0 => /snap/core/current/lib/i386-linux-gnu/libpthread.so.0 (0xf7560000)
librt.so.1 => /snap/core/current/lib/i386-linux-gnu/librt.so.1 (0xf7557000)
libdl.so.2 => /snap/core/current/lib/i386-linux-gnu/libdl.so.2 (0xf7552000)
libgcc_s.so.1 => /snap/core/current/lib/i386-linux-gnu/libgcc_s.so.1 (0xf7534000)
libc.so.6 => /snap/core/current/lib/i386-linux-gnu/libc.so.6 (0xf737e000)
/lib/ld-linux.so.2 (0xf771f000)
However, once base: core
is set in snapcraft.yaml
, the linking of the non-host-bitness libs changes:
/snap/ldc2/132/lib32$ ldd libdruntime-ldc-shared.so
linux-gate.so.1 => (0xf7748000)
libm.so.6 => /lib/i386-linux-gnu/libm.so.6 (0xf75be000)
libpthread.so.0 => /lib/i386-linux-gnu/libpthread.so.0 (0xf75a1000)
librt.so.1 => /lib/i386-linux-gnu/librt.so.1 (0xf7598000)
libdl.so.2 => /lib/i386-linux-gnu/libdl.so.2 (0xf7593000)
libgcc_s.so.1 => /lib/i386-linux-gnu/libgcc_s.so.1 (0xf7575000)
libc.so.6 => /lib/i386-linux-gnu/libc.so.6 (0xf73bf000)
/lib/ld-linux.so.2 (0xf7749000)
Something similar happens in the i386 package for the 64-bit libs.
I’m a bit confused as to why, because the core
snap contains both lib/i386-linux-gnu
(which should provide all the core C libs needed by the 32-bit D libs) and lib/x86_64-linux-gnu
(which should provide all the core C libs needed by the 64-bit D libs).
It’s no problem to add stage-packages
as indicated (using on amd64
and on i386
to customize per arch), but before doing that I’d like to clarify why this is necessary. What changed when adding the base: core
to snapcraft.yaml
? Or is this a bug, with snapcraft
not recognizing the libs are available in core
?
Thanks in advance for any advice and feedback.