aboutsummaryrefslogtreecommitdiffstats
path: root/INSTALL
blob: 4cb814dc442c909943b4cfa7902809b9d6102b4d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
Installation instructions
=========================

The Btrfs utility programs require the following libraries/tools to build:

- libuuid - provided by util-linux, e2fsprogs/e2fslibs or libuuid
- libblkid - block device id library
- liblzo2 - LZO data compression library
- zlib - ZLIB data compression library
- libzstd - ZSTD data compression library version >= 1.0.0

For the btrfs-convert utility:

- e2fsprogs - ext2/ext3/ext4 file system libraries, or called e2fslibs
- libreiserfscore - reiserfs file system library version >= 3.6.27

Optionally, the checksums based on cryptographic hashes can be implemented by
external libraries. Builtin implementations are provided in case the library
dependencies are not desired.

- libgcrypt >= 1.8.0
- libsodium >= 1.0.4
- libkcapi >= 1.0.0
- Botan >= 2.19.0
- OpenSSL >= 3.2.0

Optionally, multipath device detection requires libudev and running udev
daemon, as it's the only source of the path information. Static build has a
fallback and does not need static version of libudev.

- libudev

For zoned device support, the system headers installed in /usr/include/linux
must be 5.10 or newer.

Generating documentation:

- sphinx

Please note that the package names may differ according to the distribution.


Building from sources
---------------------

To build from git sources you need to generate the configure script using the
autotools:

    $ ./autogen.sh

To build from the released tarballs:

    $ ./configure
    $ make
    $ make install

To install the libbtrfsutil Python bindings:

    $ make install_python

You may disable building some parts like documentation, btrfs-convert or
backtrace support. See ./configure --help for more.

Specific CFLAGS or LDFLAGS should be set like

    $ CFLAGS=... LDFLAGS=... ./configure --prefix=/usr

and not as arguments to make. You can specify additional flags to build via
variables EXTRA_CFLAGS and EXTRA_LDFLAGS that get appended to the predefined
values of the respective variables. There are further build tuning options
documented in the Makefile.

    $ make EXTRA_CFLAGS=-ggdb3

The build utilizes autotools, dependencies for generating the configure
scripts are:

* autoconf, autoheader
* automake, aclocal
* pkg-config


Statically built binaries
-------------------------

The makefiles are ready to let you build static binaries of the utilities. This
may be handy in rescue environments. Your system has to provide static version
of the libraries.

    $ make static
    $ make btrfs.static
    $ make btrfs-convert.static

The resulting binaries have the '.static' suffix, the intermediate object
files do not conflict with the normal (dynamic) build.

There are pre-built static binaries for download available at the latest
release (under Assets), https://github.com/kdave/btrfs-progs/releases .


All-in-one binary (busybox style)
---------------------------------

Since version 5.2 it's possible to build a single binary that can act as other
standalone tools, based on the file name:

    $ make btrfs.box
    $ mv btrfs.box btrfs
    $ ln -s btrfs mkfs.btrfs

The list of built-ins can be obtained by

    $ btrfs help --box

The basic set will always contain: mkfs.btrfs, btrfs-image, btrfs-convert.


32bit build on 64bit host
-------------------------

The combination of 32bit build on 64bit host could work but depends on the
libraries that must provide the 32bit versions, or even 32bit static versions.
This is fairly uncommon on contemporary distributions and building 32bit
versions on a 32bit host is recommended.


References:
* https://btrfs.readthedocs.io
* https://btrfs.wiki.kernel.org (outdated)