Pack wrong libraries into snap

Bug #1587358 reported by Robert Liu
16
This bug affects 3 people
Affects Status Importance Assigned to Milestone
Snapcraft
Fix Released
High
Kyle Fazzari

Bug Description

I am porting pulseaduio to Intel NUC. The original work is from Simon Fels[1].
After executed 'snapcraft snap', I found the libraries of pulseaudio in 'stage/' are not the same with 'snap/'.

According to the ls result (see the attachment), I guess that snapcraft uses the libraries in my host machine instead.

I think that snapcraft should keep the libraries which are from the 'stage/'

[1] https://code.launchpad.net/~snappy-hwe-team/snappy-hwe-snaps/+git/pulseaudio

Revision history for this message
Robert Liu (robertliu) wrote :
Changed in snapcraft:
assignee: nobody → Sergio Schvezov (sergiusens)
Changed in snapcraft:
assignee: Sergio Schvezov (sergiusens) → nobody
Changed in snapcraft:
status: New → Triaged
importance: Undecided → High
Revision history for this message
Kyle Fazzari (kyrofa) wrote :

Snapcraft does indeed keep the libraries which are from the staging area, at least, in a typical case. The problem here is that the libraries are in a non-standard place, so snapcraft doesn't add them to the LD_LIBRARY_PATH, thereby missing their presence when running `ldd` and finding the system-installed ones instead.

The fix is likely to check detected system dependencies against files in stage and prime, and only migrate them if they're missing there. Since the snap is self-contained, note that a workaround while we're working on this is to install the libs in question to a more standard place, e.g. directly into /usr/lib.

Revision history for this message
Kyle Fazzari (kyrofa) wrote :

The discussed fix is here: https://github.com/snapcore/snapcraft/pull/977 . Please give it a test if you're able!

Changed in snapcraft:
assignee: nobody → Kyle Fazzari (kyrofa)
milestone: none → 2.24
Revision history for this message
Robert Liu (robertliu) wrote :

Hi @Kyle,

I patched /usr/lib/python3/dist-packages/snapcraft/internal/pluginhandler.py on my laptop, and built the project again.
but it still have the same issue.

$ md5sum /usr/lib/pulse-8.0/modules/libalsa-util.so stage/usr/lib/pulse-8.0/modules/libalsa-util.so prime/usr/lib/pulse-8.0/modules/libalsa-util.so
d31bbe68fd8879da68f1d4db5d7c5d04 /usr/lib/pulse-8.0/modules/libalsa-util.so
957f4394d81ce1703a07e6b769e3ea81 stage/usr/lib/pulse-8.0/modules/libalsa-util.so
d31bbe68fd8879da68f1d4db5d7c5d04 prime/usr/lib/pulse-8.0/modules/libalsa-util.so
$ ls -l /usr/lib/pulse-8.0/modules/libalsa-util.so stage/usr/lib/pulse-8.0/modules/libalsa-util.so prime/usr/lib/pulse-8.0/modules/libalsa-util.so
-rw-r--r-- 1 root root 298032 Nov 4 02:25 /usr/lib/pulse-8.0/modules/libalsa-util.so
-rw-r--r-- 1 robertliu robertliu 298032 Nov 4 02:25 prime/usr/lib/pulse-8.0/modules/libalsa-util.so
-rwxr-xr-x 2 robertliu robertliu 420296 Dec 15 11:59 stage/usr/lib/pulse-8.0/modules/libalsa-util.so

Revision history for this message
Kyle Fazzari (kyrofa) wrote :

@Robert, thanks for giving it a shot! I made a mistake in the PR and have fixed it. I managed to build your project (thanks for linking that) and verified that the libs in prime are the ones from stage. Would you mind taking another look?

Changed in snapcraft:
status: Triaged → In Progress
Revision history for this message
Robert Liu (robertliu) wrote :

@Kyle,
it looks the libraries are now correct.
Thank you.

$ md5sum /usr/lib/pulse-8.0/modules/libalsa-util.so stage/usr/lib/pulse-8.0/modules/libalsa-util.so prime/usr/lib/pulse-8.0/modules/libalsa-util.so
d31bbe68fd8879da68f1d4db5d7c5d04 /usr/lib/pulse-8.0/modules/libalsa-util.so
d86af6daef60bfcd0971bb2e28f4f22a stage/usr/lib/pulse-8.0/modules/libalsa-util.so
d86af6daef60bfcd0971bb2e28f4f22a prime/usr/lib/pulse-8.0/modules/libalsa-util.so
$ ls -l /usr/lib/pulse-8.0/modules/libalsa-util.so stage/usr/lib/pulse-8.0/modules/libalsa-util.so prime/usr/lib/pulse-8.0/modules/libalsa-util.so
-rwxr-xr-x 3 robertliu robertliu 420296 Dec 16 11:54 prime/usr/lib/pulse-8.0/modules/libalsa-util.so
-rwxr-xr-x 3 robertliu robertliu 420296 Dec 16 11:54 stage/usr/lib/pulse-8.0/modules/libalsa-util.so
-rw-r--r-- 1 root root 298032 Nov 4 02:25 /usr/lib/pulse-8.0/modules/libalsa-util.so

Changed in snapcraft:
status: In Progress → Fix Committed
Kyle Fazzari (kyrofa)
Changed in snapcraft:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.