Building nvme‐cli - linux-nvme/nvme-cli GitHub Wiki
nvme-cli uses meson as its build system. This page covers the common path and
per-distro dependency packages. The full reference — install paths, debug and
sanitizer builds, plugin selection, the Windows build, distro packaging — lives
in
Documentation/BUILDING.md
in the source tree.
$ meson setup .build
$ meson compile -C .build
# meson install -C .buildSince nvme-cli 3.x, libnvme is part of the nvme-cli source tree. You do not need to build or install it separately first, unlike in nvme-cli 2.x.
By default this installs under /usr/local. To install into the paths a Linux
distribution normally uses instead:
$ meson setup .build --prefix /usr --sysconfdir /etcA minimal build needs a C compiler (gcc or clang), ninja, and meson. A few
optional libraries unlock extra features. Each is auto-detected by default; pass
-D<option>=enabled or -D<option>=disabled to force it:
| Library | Feature it unlocks |
|---|---|
json-c |
config.json parsing, all vendor plugins, JSON output. Without it, plugins are disabled. |
openssl |
TLS over NVMe-TCP, host authentication |
keyutils |
Key management for NVMe-oF authentication |
libdbus |
NVMe-MI endpoint discovery (disabled by default) |
liburing |
Get-log-page via io_uring (disabled by default) |
python |
Python bindings for libnvme |
For the full option list, including meson's own built-in options, run:
$ meson configure .buildBy default every vendor plugin is built. To build only some of them:
$ meson setup .build -Dplugins=intel,wdc,ocpOlder distributions may ship a meson version too old for nvme-cli.
muon is an implementation of the meson build
system in C99, with far fewer dependencies than meson itself. scripts/build.sh
drives it for you:
$ scripts/build.sh -m muonThis needs only:
- make
- gcc
- git
and produces a static binary. It downloads and builds muon and
samurai (its ninja replacement) as
part of the build.
For some older distributions, additional packages need to be installed first; see the sections below.
# dnf install json-c-devel openssl-devel keyutils-libs-devel dbus-devel python3-devel$ dnf config-manager --set-enabled powertools
$ dnf search glibc
$ dnf provides */libc.a
$ dnf install glibc-staticDependencies if using meson directly:
$ sudo apt install gcc make git
$ sudo pip3 install meson
$ sudo apt-get install python3 python3-pip python3-setuptools python3-wheel ninja-build
$ sudo apt install cmake swig libjson-c-dev libssl-dev libkeyutils-dev pkg-config# zypper install git meson gcc libjson-c-devel keyutils-devel openssl-develThese are unsupported for the muon minimal build, but are included here for reference:
CentOS 8
$ dnf config-manager --set-enabled powertools
$ dnf search glibc
$ dnf provides */libc.a
$ dnf install glibc-staticCentOS 7
$ yum install glibc-static