2024-12-23 22:12:26 -06:00
|
|
|
# Build
|
2024-12-21 16:36:07 +01:00
|
|
|
|
|
|
|
|
**NOTE:** Prebuilt packages can be found at and recommended for most
|
|
|
|
|
users: https://github.com/trapexit/mergerfs/releases
|
|
|
|
|
|
|
|
|
|
**NOTE:** Only tagged releases are supported. `master` and other
|
|
|
|
|
branches should be considered works in progress.
|
|
|
|
|
|
|
|
|
|
First, get the code from [github](https://github.com/trapexit/mergerfs).
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
$ git clone https://github.com/trapexit/mergerfs.git
|
|
|
|
|
$ # or
|
|
|
|
|
$ wget https://github.com/trapexit/mergerfs/releases/download/<ver>/mergerfs-<ver>.tar.gz
|
|
|
|
|
```
|
|
|
|
|
|
2024-12-23 22:12:26 -06:00
|
|
|
## Debian / Ubuntu
|
2024-12-21 16:36:07 +01:00
|
|
|
|
|
|
|
|
```
|
|
|
|
|
$ cd mergerfs
|
2025-04-28 12:00:20 -07:00
|
|
|
$ sudo buildtools/install-build-pkgs
|
2026-11-29 23:10:54 -05:00
|
|
|
$ . /etc/mergerfs-build-env
|
2024-12-21 16:36:07 +01:00
|
|
|
$ make deb
|
2026-11-25 13:36:02 -05:00
|
|
|
$ sudo dpkg -i build/pkgs/mergerfs_<version>_<arch>.deb
|
2024-12-21 16:36:07 +01:00
|
|
|
```
|
|
|
|
|
|
2026-11-05 14:14:03 -06:00
|
|
|
Debian package compilation uses the available CPUs by default. To limit
|
|
|
|
|
parallelism, set `DEB_BUILD_OPTIONS`:
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
$ DEB_BUILD_OPTIONS=parallel=4 make deb
|
|
|
|
|
```
|
|
|
|
|
|
2024-12-23 22:12:26 -06:00
|
|
|
## RHEL / CentOS / Rocky / Fedora
|
2024-12-21 16:36:07 +01:00
|
|
|
|
|
|
|
|
```
|
|
|
|
|
$ su -
|
2024-12-23 22:12:26 -06:00
|
|
|
# cd mergerfs
|
2025-04-28 12:00:20 -07:00
|
|
|
# buildtools/install-build-pkgs
|
2024-12-23 22:12:26 -06:00
|
|
|
# make rpm
|
2026-11-29 23:10:56 -05:00
|
|
|
# rpm -i rpmbuild/RPMS/<arch>/mergerfs-<version>-1.<dist>.<arch>.rpm
|
2024-12-23 22:12:26 -06:00
|
|
|
```
|
|
|
|
|
|
2026-11-29 23:10:56 -05:00
|
|
|
Distributions that enforce RPM signature checking reject the unsigned
|
|
|
|
|
local build. When installing a locally built RPM that you built and
|
|
|
|
|
trust, pass `--nosignature` to `rpm`.
|
2026-11-02 18:57:58 -06:00
|
|
|
|
2026-05-13 13:56:09 -05:00
|
|
|
mergerfs requires a C++20 compiler and the system `g++` on RHEL /
|
|
|
|
|
Rocky 8 is too old. On RHEL / Rocky `install-build-pkgs` installs the
|
|
|
|
|
newest GCC Toolset when it is newer than the system compiler, and the
|
|
|
|
|
Rocky Linux container builds use it. When `CXX` is unset and the
|
|
|
|
|
default `g++` can't build C++20, `make rpm` activates the newest
|
|
|
|
|
installed GCC Toolset automatically. If the selected compiler lacks
|
|
|
|
|
the annobin plugin that the RPM build flags load, `make rpm` also
|
|
|
|
|
disables RPM's annobin annotations (`--undefine _annotated_build`).
|
|
|
|
|
Both the Rocky 10 `/usr/lib/gcc-toolset/<version>-env.source`
|
|
|
|
|
activation script and the older `/opt/rh/gcc-toolset-<version>/enable`
|
|
|
|
|
layout are supported. To build outside of `make rpm` on such systems
|
|
|
|
|
(for example `make` or `make install`) activate the toolset first:
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
# . /opt/rh/gcc-toolset-<version>/enable
|
|
|
|
|
# make
|
|
|
|
|
```
|
2026-11-05 14:14:03 -06:00
|
|
|
|
2026-11-02 18:57:58 -06:00
|
|
|
## Container packages
|
|
|
|
|
|
|
|
|
|
Package build targets are defined in `buildtools/containerfiles/`, with
|
|
|
|
|
the standard distro targets listed in `buildtools/target-containers.txt`.
|
2026-11-05 14:14:03 -06:00
|
|
|
Debian release builds target Debian 12 and 13. Other targets include
|
|
|
|
|
Fedora 45 on `amd64` and `arm64`, and Ubuntu 26.10 on `amd64`, `arm64`,
|
|
|
|
|
`armhf`, and `riscv64`. Foreign-architecture builds require QEMU/binfmt
|
|
|
|
|
support.
|
2026-11-02 18:57:58 -06:00
|
|
|
|
build: make the release driver and Debian changelogs dependable
- The container release driver wrote rv=fail but returned success to
CI. Run every selected target, keep its report line, and exit
nonzero if any target fails or its builder can't run. A missing
podman during --cleanup is reported per target instead of aborting
the run. Reject a target name that matches no containerfile.
- --branch silently defaulted to master, and the tarball containerfile
did too, so a release could package a moving branch instead of the
intended tag. Require --branch and --git-repo for direct calls.
- Remove the static installer target. Its makeself command printed
"foo", and it copied whatever static archives the output directory
held, possibly from an older release or missing one built later in
the same run. The static archives themselves are unchanged.
- git2debcl enumerated every tag and used symmetric differences, so a
private tag could become a package version and commits from another
branch could be listed. Take release and release-candidate tags
reachable from the requested revision, ordered by version with each
final after its candidates, with one-sided ranges between ancestor
boundaries. Keep the requested version when tags share a revision or
a range is empty. A tagless snapshot gets 0~git.<count>.<hash>; a
shallow tagless checkout must give --version.
- Debian versions for candidates are printed as 2.42.0~~rc1, so dpkg
orders them below the 2.42.0 final. The raw -rc1 form sorted above
it, making the final release look like a downgrade.
- TEST_release_metadata covers the driver's results and arguments,
sibling and merged histories, non-release tags, candidates,
tagless and shallow checkouts, and dpkg version ordering.
- Document the static and release targets and the driver's arguments.
2026-11-25 13:36:10 -05:00
|
|
|
Standalone static archives (`mergerfs-<version>-static-linux_<arch>.tar.gz`)
|
|
|
|
|
are built with `make release-static`, which selects every `static.<arch>`
|
|
|
|
|
containerfile: `amd64`, `arm64`, `armhf`, `i386`, and `riscv64`.
|
|
|
|
|
`make release-all` builds every containerfile in the directory. A target
|
|
|
|
|
name that matches no containerfile (exact or substring) makes
|
|
|
|
|
`buildtools/build-release` fail with `no package targets match '<name>'`;
|
|
|
|
|
there is no installer target.
|
|
|
|
|
|
|
|
|
|
For a release, pass the intended tag to the Makefile (`GITREF=<tag>`)
|
|
|
|
|
or call `buildtools/build-release` directly with both `--git-repo` (the
|
|
|
|
|
repository for the container to clone) and `--branch` (the intended
|
|
|
|
|
tag); the script fails when either is missing. The named ref must be
|
|
|
|
|
available in that repository. A failed target gives the driver a
|
|
|
|
|
nonzero exit status; `build-report.txt` in the output directory lists
|
|
|
|
|
each target's result.
|
|
|
|
|
|
2025-01-12 14:55:04 -06:00
|
|
|
## Generic Linux
|
2024-12-23 22:12:26 -06:00
|
|
|
|
2025-01-12 14:55:04 -06:00
|
|
|
Have git, g++ or clang, make, python installed.
|
2024-12-23 22:12:26 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
$ cd mergerfs
|
|
|
|
|
$ make
|
|
|
|
|
$ sudo make install
|
|
|
|
|
```
|
|
|
|
|
|
2025-01-12 14:55:04 -06:00
|
|
|
## FreeBSD
|
|
|
|
|
|
|
|
|
|
Have git, g++ or clang, gmake, python installed.
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
$ cd mergerfs
|
|
|
|
|
$ gmake
|
|
|
|
|
$ gmake install # as root
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
2024-12-23 22:12:26 -06:00
|
|
|
## Build options
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
$ make help
|
build: make NDEBUG=1 and make release build the release profile
- The RELEASE=1 profile replaced 2.42.0's NDEBUG=1 one, but the
static archives and the container image still build with NDEBUG=1,
which therefore selected the debug profile: -O0 -g3 with assertions
on. Both Makefiles accept NDEBUG=1 again, as -O3 -DNDEBUG, and the
debug profile defines DEBUG. The vendored libfuse follows the same
profile as mergerfs.
- make release first removes the objects, binaries and stamp under
build/ and cleans vendored/libfuse, because make only compares
timestamps: objects from an earlier debug build were otherwise
linked into the release binary unchanged. Packages and build reports
in build/pkgs are kept; TEST_release_pkg_preservation checks both.
- make release also builds preload.so. It takes the release defines
through its own PRELOAD_CPPFLAGS: the global CPPFLAGS add
_FILE_OFFSET_BITS=64, which would hide its unsuffixed
open/openat/fopen/creat interposers.
- mergerfs.spec builds the release target, as debian/rules does. The
distribution's CFLAGS, CXXFLAGS and LDFLAGS still apply.
- The release driver mounts the repository with ":ro,z", not ":ro:z",
which Podman read as an extra field instead of a mount option.
TEST_release_metadata runs the driver against a fake podman and
checks the volume argument and the build report.
- Remove release-installer: build-release has no installer target.
- make help printed a literal "\n" where /bin/sh is bash. Match the
build.md transcript to its output and document the profiles.
Performance: static archives and the container image go from -O0 with
assertions back to optimized builds, now -O3 -DNDEBUG (2.42.0: -O2
-DNDEBUG). RPM packages keep the distribution's -O2 and no longer
evaluate assertions. A plain make is unoptimized, as before.
2026-11-29 23:10:53 -05:00
|
|
|
usage: make ARG
|
|
|
|
|
USE_XATTR=0 - build program without xattrs functionality
|
|
|
|
|
STATIC=1 - build static binary
|
|
|
|
|
LTO=1 - build with link time optimization
|
|
|
|
|
SANITIZE=1 - build with sanitizers (address,undefined,leak)
|
|
|
|
|
SANITIZE=list - build with custom sanitizers (comma separated)
|
|
|
|
|
CLEANUP=1 - cleanup images between release build process
|
|
|
|
|
PKGDIR=/dir/ - location for release build pkgs
|
|
|
|
|
GITREF=gitref - gitref to use for release builds
|
2024-12-21 16:36:07 +01:00
|
|
|
```
|
build: make NDEBUG=1 and make release build the release profile
- The RELEASE=1 profile replaced 2.42.0's NDEBUG=1 one, but the
static archives and the container image still build with NDEBUG=1,
which therefore selected the debug profile: -O0 -g3 with assertions
on. Both Makefiles accept NDEBUG=1 again, as -O3 -DNDEBUG, and the
debug profile defines DEBUG. The vendored libfuse follows the same
profile as mergerfs.
- make release first removes the objects, binaries and stamp under
build/ and cleans vendored/libfuse, because make only compares
timestamps: objects from an earlier debug build were otherwise
linked into the release binary unchanged. Packages and build reports
in build/pkgs are kept; TEST_release_pkg_preservation checks both.
- make release also builds preload.so. It takes the release defines
through its own PRELOAD_CPPFLAGS: the global CPPFLAGS add
_FILE_OFFSET_BITS=64, which would hide its unsuffixed
open/openat/fopen/creat interposers.
- mergerfs.spec builds the release target, as debian/rules does. The
distribution's CFLAGS, CXXFLAGS and LDFLAGS still apply.
- The release driver mounts the repository with ":ro,z", not ":ro:z",
which Podman read as an extra field instead of a mount option.
TEST_release_metadata runs the driver against a fake podman and
checks the volume argument and the build report.
- Remove release-installer: build-release has no installer target.
- make help printed a literal "\n" where /bin/sh is bash. Match the
build.md transcript to its output and document the profiles.
Performance: static archives and the container image go from -O0 with
assertions back to optimized builds, now -O3 -DNDEBUG (2.42.0: -O2
-DNDEBUG). RPM packages keep the distribution's -O2 and no longer
evaluate assertions. A plain make is unoptimized, as before.
2026-11-29 23:10:53 -05:00
|
|
|
|
|
|
|
|
A plain `make` builds the debug profile (`-O0 -g3`, assertions
|
|
|
|
|
enabled). `make release` builds the binaries and `preload.so` with
|
|
|
|
|
`-O3` and assertions disabled. It rebuilds the objects, binaries and
|
|
|
|
|
vendored libfuse so debug objects cannot end up in the release build.
|
|
|
|
|
It leaves packages and reports in `build/pkgs/` (or your `PKGDIR`)
|
|
|
|
|
alone. `make clean` still removes the entire `build/` directory.
|
|
|
|
|
`make NDEBUG=1` selects the same release flags without cleaning; the
|
|
|
|
|
static package builds use it together with `LTO=1 STATIC=1`.
|