Skip to content

Snapcraft library linter warnings about unused libs #10230

@mmmarcos

Description

@mmmarcos

During snap creation, snapcraft library linter warns about some unused libraries:

$ snapcraft pack --use-lxd -v
...
Extracting and updating metadata...
Copying snap assets...
Generating snap metadata...
Generated snap metadata
Reading snap metadata...
Running linters...
Running linter: classic 
Running linter: library 
Lint OK:
- classic: Snap confinement is set to classic.
Lint warnings:
- library: libdconf.so.1: unused library 'usr/lib/x86_64-linux-gnu/libdconf.so.1.0.0'. (https://snapcraft.io/docs/linters-library)
- library: libicuio.so.70: unused library 'usr/lib/x86_64-linux-gnu/libicuio.so.70.1'. (https://snapcraft.io/docs/linters-library)
- library: libicutu.so.70: unused library 'usr/lib/x86_64-linux-gnu/libicutu.so.70.1'. (https://snapcraft.io/docs/linters-library)
- library: libxml2.so.2: unused library 'usr/lib/x86_64-linux-gnu/libxml2.so.2.9.13'. (https://snapcraft.io/docs/linters-library)
Creating snap package... 
Created snap package parsec_3.4.0-a.7+dev_amd64.snap

Library linter docs explain how to fix unused library warnings:

Library type Resolution
Dynamic linking If the stage-packages key of the part contains the unused library and no other entries, remove the library from the key. If the library contains other assets the snap needs, then instead move it to the part’s stage key and prefix it with a minus sign (-). It’s then excluded from the stage step of the build.
Static linking Static linking libraries must only be present at build time. So, the part should list the library in its build-package key, not stage-package. Again, if the library contains other necessary assets for the snap, then move it into the part’s stage key and prefix it with a minus sign.
Dynamic loading Snapcraft may falsely flag dynamic loading libraries as unused. In this case, don’t change its declaration in the recipe. Moving or removing it has a high risk of causing your app to malfunction at runtime. Instead, list it in the lint.ignore. key to suppress the warning for this library.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-LinuxArea: Linux issueI-CICDImpact: CI/CD, automated stuff on this repoI-SnapImpact: Snap & Snapcraft related stuff

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions