Skip to content
Mario Limonciello edited this page Jan 6, 2024 · 17 revisions

Compiling

fwupd uses the Meson build system for compilation. All building is done in a temporary directory as a non-root user, and autotools is not required.

fwupd development environment

The fwupd development environment is utilized to perform builds and run a development fwupd release without conflicting with the system fwupd package. It is further described in the fwupd building documentation.

Compiling outside of fwupd development environment

The same helper script ./contrib/setup that is used to configure the fwupd development environment on your machine is used when you will compile outside of that environment. However it is suggested for most users to use the fwupd development environment. Running this script interactively will prompt you to set up missing build dependencies as well as set up your environment so that any commits you use are adjusted for fwupd project style as described in https://github.com/fwupd/fwupd/blob/master/CONTRIBUTING.md

Generate the build script

Any missing build time dependencies will be mentioned while running meson.

Create meson build script

# meson setup build

Compilation options

The default compilation options are documented in meson_options.txt in the root of the build tree. If you would like to override any option. you can do so when generating the build rules. For example to disable the DELL plugin on meson 0.44.0+ you would run meson like this:

# meson setup build -Dplugin_dell=false

Linker options

It is known that using -Wl,-Bsymbolic-functions will cause runtime failures. Be sure to remove this from your LDFLAGS before compiling. See https://github.com/hughsie/fwupd/issues/1077 for an example.

Compile using ninja

Compilation is executed by one command:

# ninja -C build

Install using ninja

# sudo ninja -C build install

Refresh linker cache

# sudo ldconfig

Configure dbus to let daemon start

If you didn't use the contrib/setup script, then by default everything is placed into /usr/local and most systems won't know how to manage dbus services from /usr/local.

You can either re-run that script or manually create /etc/dbus-1/system-local.conf with following contents:

<busconfig>
    <includedir>/usr/local/share/dbus-1/system.d</includedir>
</busconfig>

Reload dbus daemon

# systemctl reload dbus.service

error while loading shared libraries while running

Some Linux distributions don't configure /usr/local/lib or /usr/local/lib64 to the library search path. To fix add the library path to a conffile in /etc/ld.so.conf.d/ and run sudo ldconfig.

./contrib/setup will also prompt to set this up for you.

Runtime dependencies

Some plugins have additional runtime dependencies. Notable:

  • UEFI plugin requires udisks2 for some disk configurations
  • Modem manager plugin requires modemmanager to be useful

Distribution packages

Scripts for generating distribution packages are available in the contrib for popular distributions.

Clone this wiki locally