---
name: "library-specs"
section: "7"
platform: "openbsd"
package: "man"
version: "8.0-current-20261101"
release: "OpenBSD 8.0-current (2026-11-01)"
platforms: ["openbsd"]
url: "https://new.carta.tech/library-specs"
---

# library-specs(7)

shared library name specifications

## NAME

**library-specs** – shared library name specifications

## DESCRIPTION

Each WANTLIB item in the ports tree conforms to

```
[path/]libname[=major[.minor]]
```

or

```
[path/]libname[>=major[.minor]]
```

All libraries that a package needs must be mentioned in that list. Except for system and X11 libraries, they all must be reachable through LIB\_DEPENDS and RUN\_DEPENDS, directly, or indirectly through recursive dependencies.

Conversely, the ports tree uses WANTLIB to check whether a given LIB\_DEPENDS will be required at runtime for shared libraries, and thus turn it into a **@depend** line( see [pkg\_create(1)](/pkg_create/1.md)).

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.

Note that static libraries can only satisfy a library specification if no shared library has been found. Thus, if WANTLIB = foo\>=5, and both libfoo.so.4.0 and libfoo.a are present, the check will fail.

Therefore, porters must strive to respect correct shared library semantics in their own ports: by bumping the minor number each time the interface is augmented, and by bumping the major number each time the interface changes. Note that adding functions to a library is an interface augmentation. Removing functions is an interface change.

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)](/port-resolve-lib-helper/1.md). 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.

Most specifications won't mention a *path*: [port-resolve-lib-helper(1)](/port-resolve-lib-helper/1.md) will look in the default [ldconfig(8)](/ldconfig/8.md) path automatically, namely */usr/local/lib*, */usr/X11R6/lib*, */usr/lib*. It is generally a bad idea to put libraries elsewhere as they won't be reached directly.

However, 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.

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’.

## SEE ALSO

[check-lib-depends(1)](/check-lib-depends/1.md), [ld(1)](/ld/1.md), [ld.so(1)](/ld.so/1.md), pkg\_add(1), [port-resolve-lib-helper(1)](/port-resolve-lib-helper/1.md), [bsd.port.mk(5)](/bsd.port.mk/5.md), [packages(7)](/packages/7.md), [packages-specs(7)](/packages-specs/7.md), [ports(7)](/ports/7.md), [ldconfig(8)](/ldconfig/8.md)

## 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.
