libbpf_build.rst 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. .. SPDX-License-Identifier: (LGPL-2.1 OR BSD-2-Clause)
  2. Building libbpf
  3. ===============
  4. libelf and zlib are internal dependencies of libbpf and thus are required to link
  5. against and must be installed on the system for applications to work.
  6. pkg-config is used by default to find libelf, and the program called
  7. can be overridden with PKG_CONFIG.
  8. If using pkg-config at build time is not desired, it can be disabled by
  9. setting NO_PKG_CONFIG=1 when calling make.
  10. To build both static libbpf.a and shared libbpf.so:
  11. .. code-block:: bash
  12. $ cd src
  13. $ make
  14. To build only static libbpf.a library in directory build/ and install them
  15. together with libbpf headers in a staging directory root/:
  16. .. code-block:: bash
  17. $ cd src
  18. $ mkdir build root
  19. $ BUILD_STATIC_ONLY=y OBJDIR=build DESTDIR=root make install
  20. To build both static libbpf.a and shared libbpf.so against a custom libelf
  21. dependency installed in /build/root/ and install them together with libbpf
  22. headers in a build directory /build/root/:
  23. .. code-block:: bash
  24. $ cd src
  25. $ PKG_CONFIG_PATH=/build/root/lib64/pkgconfig DESTDIR=/build/root make