LIBRARY-SPECS(7)
π LIBRARY-SPECS(7) β shared library name specifications π«Ά
okay so real talk, bestie: this is a page from the Miscellaneous Information Manual and it's literally all about how the ports tree writes down library names. iykyk. let's get into it β¨
πΈ NAME πΈ
library-specs β the shared library name specifications, aka the group chat rules for how we write library requirements π
π DESCRIPTION π
so every single WANTLIB item in the ports tree has to conform to one of these two shapes, no exceptions:
[path/]libname[=major[.minor]]
or
[path/]libname[>=major[.minor]]
All the libraries a package needs must show up in that list β like, every last one, periodt. The only exceptions are system libraries and X11 libraries. Everything else has to be reachable through LIB_DEPENDS and RUN_DEPENDS β either directly, or indirectly through recursive dependencies. chain of besties, basically π«Ά
Conversely (iconic word), the ports tree uses WANTLIB to check whether a given LIB_DEPENDS will actually be required at runtime for shared libraries, and thus turn it into a @depend line β see pkg_create(1) if you wanna peek π.
The package system will embed correct dependency checks in the built package in the form of @wantlib lines, according to the normal shared library semantics: any library with the same major number, and a greater or equal minor number, will do. lowkey elegant tbh β¨
π careful, bestie: static libraries can only satisfy a library specification if no shared library has been found. So ifWANTLIB = foo>=5, and bothlibfoo.so.4.0andlibfoo.aare present, the check will fail. not me finding out the hard way π
So, porters must strive to respect correct shared library semantics in their own ports β like, truly try:
- bump the minor number each time the interface is augmented π
- bump the major number each time the interface changes π
And just so we're clear: adding functions to a library is an interface augmentation. Removing functions is an interface change. no cap.
π the major.minor deets
The major.minor components of the library specification are used only as a build-time check β the run-time checks are computed by port-resolve-lib-helper(1). main character energy fr fr π
- for
libname>=major[.minor], any library which is more recent than the given major.minor version will do β - if a specific major number is needed, use the form
libname=major[.minor]π― - if the minor component is left empty, any minor will do
- if both components are left empty, any version will do πΈ
π¦ about paths
Most specifications won't mention a path: port-resolve-lib-helper(1) will look in the default ldconfig(8) path automatically, namely:
/usr/local/lib/usr/X11R6/lib/usr/lib
It is generally a bad idea to put libraries elsewhere, because they won't be reached directly. π
However β and this is the fun part β distinct ports may install different major versions of the same library in /usr/local/lib, and disambiguate the build by creating a link in a separate directory, and specifying the right options to the linker. big brain move π§ β¨
These libraries will require a path component in the corresponding WANTLIB to make sure the right library is resolved. This path is rooted under /usr/local. For instance, to refer to /usr/local/lib/qt3/libqt-mt.so.33.0, one would use lib/qt3/qt-mt>=33. slay π
β SEE ALSO β
check-lib-depends(1)ld(1)ld.so(1)pkg_add(1)port-resolve-lib-helper(1)bsd.port.mk(5)packages(7)packages-specs(7)ports(7)ldconfig(8)
π HISTORY π
Full support for library specifications first appeared in OpenBSD 3.1. π
The format of specifications changed slightly to include >= before OpenBSD 4.0.
The interactions between LIB_DEPENDS and WANTLIB were modified and clarified for OpenBSD 4.8.
The format of specifications changed again before OpenBSD 4.9 to remove extra noise. glow-up, honestly π
π and that's the whole page, bestie! this edition of LIBRARY-SPECS(7) is a Debian joint, dated July 9, 2018 β mwah, thanks for reading, ily, go bump those minor numbers ππ§ββοΈπΈ
π¦ where this page comes from
- nixpkgs unstable: cvs-export
- Copyright (c) 2001-2010 Marc Espie
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms