Skip to content

config:shared_linking:missing_library_policy to error/warn about accidental use of system libraries on linux/freebsd#47365

Merged
haampie merged 49 commits intodevelopfrom
feature/check-needed-libs-elf-files
Dec 16, 2024
Merged

config:shared_linking:missing_library_policy to error/warn about accidental use of system libraries on linux/freebsd#47365
haampie merged 49 commits intodevelopfrom
feature/check-needed-libs-elf-files

Conversation

@haampie
Copy link
Copy Markdown
Member

@haampie haampie commented Nov 1, 2024

This is a retry to land #28109

It adds a config option config:shared_linking:missing_library_policy:error/warn/ignore which will cause installation errors or warnings when ELF executables or libraries need shared libraries which cannot be resolved from RPATH search paths. The default is to ignore.

This is a safeguard against accidentally linking to system libraries instead of Spack libraries. It makes it more likely that build cache installs work on different machines.

It does not attempt to resolve symbols.

Some system dependencies are allowed (e.g. kernel and libc).

Packages can (but are discouraged to) set unresolved_libraries to a list of patterns of sonames/library names that are know to be unresolvable in RPATHs. In the future this could be made more fine-grained in a non-breaking way by allowing a dictionary of patterns lib => [deps].

@spackbot-app spackbot-app bot added core PR affects Spack core functionality defaults update-package labels Nov 1, 2024
@spackbot-app spackbot-app bot requested a review from LydDeb November 1, 2024 11:19
@haampie haampie changed the title config:shared_linking:strict to prevent runtime system deps on linux/freebsd config:shared_linking:missing_library_policy to error/warn about accidental runtime deps on linux/freebsd Nov 1, 2024
@spackbot-app spackbot-app bot added the gitlab Issues related to gitlab integration label Nov 1, 2024
@haampie haampie changed the title config:shared_linking:missing_library_policy to error/warn about accidental runtime deps on linux/freebsd config:shared_linking:missing_library_policy to error/warn about accidental use of system libraries on linux/freebsd Nov 1, 2024
@haampie

This comment was marked as outdated.

@haampie
Copy link
Copy Markdown
Member Author

haampie commented Nov 3, 2024

@hainest do you know how to configure Boost.Locale to disable icu when ~icu?

Spack has this variant but when you install boost +locale it will still autodetect and use icu libs.

https://github.com/boostorg/locale/blob/ff917062e50b7d789a58279bf2416037486d5901/build.jam#L13

I guess for now I'll just require +icu when +locale is on.

@haampie haampie force-pushed the feature/check-needed-libs-elf-files branch from 4a4cffc to b2ece16 Compare November 3, 2024 09:15
@spackbot-app spackbot-app bot added the patch label Nov 3, 2024
@haampie
Copy link
Copy Markdown
Member Author

haampie commented Nov 3, 2024

@alecbcs fyi 1e64287

@haampie haampie force-pushed the feature/check-needed-libs-elf-files branch from 5f539bb to 60fbba4 Compare November 3, 2024 17:47
@hainest
Copy link
Copy Markdown
Contributor

hainest commented Nov 3, 2024

@hainest do you know how to configure Boost.Locale to disable icu when ~icu?

Spack has this variant but when you install boost +locale it will still autodetect and use icu libs.

https://github.com/boostorg/locale/blob/ff917062e50b7d789a58279bf2416037486d5901/build.jam#L13

I guess for now I'll just require +icu when +locale is on.

I ran into issues with this for #30627. Let me get back to you.

@haampie haampie added this to the v1.0.0 milestone Dec 13, 2024
@haampie
Copy link
Copy Markdown
Member Author

haampie commented Dec 14, 2024

@spackbot run pipeline

@spackbot-app
Copy link
Copy Markdown

spackbot-app bot commented Dec 14, 2024

I've started that pipeline for you!

alalazo
alalazo previously approved these changes Dec 16, 2024
Copy link
Copy Markdown
Member

@alalazo alalazo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only a very minor comment. LGTM.

@alalazo alalazo self-assigned this Dec 16, 2024
Co-authored-by: Massimiliano Culpo <[email protected]>
@haampie haampie merged commit 06eae96 into develop Dec 16, 2024
@haampie haampie deleted the feature/check-needed-libs-elf-files branch December 16, 2024 11:32
tdrwenski pushed a commit to tdrwenski/spack that referenced this pull request Dec 26, 2024
…cidental use of system libraries on linux/freebsd (spack#47365)

This commit adds a config option `config:shared_linking:missing_library_policy:error/warn/ignore` which will cause installation errors or warnings when ELF executables or libraries need shared libraries which cannot be resolved from RPATH search paths. The default is to ignore.

This is a safeguard against accidentally linking to system libraries instead of Spack libraries. It makes it more likely that build cache installs work on different machines. It works only at the level of libraries, not at the level of symbols. Some system dependencies are allowed (e.g. kernel and libc).

Packages can (but are discouraged to) set `unresolved_libraries` to a list of patterns of sonames/library names that are know to be unresolvable in RPATHs.  In the future this could be made more fine-grained in a non-breaking way by allowing a dictionary of patterns `lib => [deps]`.
kshea21 pushed a commit to kshea21/spack that referenced this pull request Dec 26, 2024
…cidental use of system libraries on linux/freebsd (spack#47365)

This commit adds a config option `config:shared_linking:missing_library_policy:error/warn/ignore` which will cause installation errors or warnings when ELF executables or libraries need shared libraries which cannot be resolved from RPATH search paths. The default is to ignore.

This is a safeguard against accidentally linking to system libraries instead of Spack libraries. It makes it more likely that build cache installs work on different machines. It works only at the level of libraries, not at the level of symbols. Some system dependencies are allowed (e.g. kernel and libc).

Packages can (but are discouraged to) set `unresolved_libraries` to a list of patterns of sonames/library names that are know to be unresolvable in RPATHs.  In the future this could be made more fine-grained in a non-breaking way by allowing a dictionary of patterns `lib => [deps]`.
teaguesterling pushed a commit to teaguesterling/spack that referenced this pull request Feb 5, 2025
…cidental use of system libraries on linux/freebsd (spack#47365)

This commit adds a config option `config:shared_linking:missing_library_policy:error/warn/ignore` which will cause installation errors or warnings when ELF executables or libraries need shared libraries which cannot be resolved from RPATH search paths. The default is to ignore.

This is a safeguard against accidentally linking to system libraries instead of Spack libraries. It makes it more likely that build cache installs work on different machines. It works only at the level of libraries, not at the level of symbols. Some system dependencies are allowed (e.g. kernel and libc).

Packages can (but are discouraged to) set `unresolved_libraries` to a list of patterns of sonames/library names that are know to be unresolvable in RPATHs.  In the future this could be made more fine-grained in a non-breaking way by allowing a dictionary of patterns `lib => [deps]`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants