{"id":13480426,"url":"https://github.com/libbpf/libbpf","last_synced_at":"2025-05-13T17:10:19.809Z","repository":{"id":37664626,"uuid":"152338895","full_name":"libbpf/libbpf","owner":"libbpf","description":"Automated upstream mirror for libbpf stand-alone build.","archived":false,"fork":false,"pushed_at":"2025-04-02T21:24:25.000Z","size":10335,"stargazers_count":2355,"open_issues_count":18,"forks_count":434,"subscribers_count":64,"default_branch":"master","last_synced_at":"2025-04-24T01:57:22.919Z","etag":null,"topics":["bpf","libbpf","tracing"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/libbpf.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2018-10-10T00:24:34.000Z","updated_at":"2025-04-23T22:27:09.000Z","dependencies_parsed_at":"2023-11-14T03:25:07.143Z","dependency_job_id":"b29c5a6d-6215-407b-865b-909fea05a47c","html_url":"https://github.com/libbpf/libbpf","commit_stats":{"total_commits":2513,"total_committers":303,"mean_commits":8.293729372937294,"dds":0.730600875447672,"last_synced_commit":"fc064eb41e9de925beaeaf5b656ecf0f5ff83c08"},"previous_names":[],"tags_count":45,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/libbpf%2Flibbpf","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/libbpf%2Flibbpf/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/libbpf%2Flibbpf/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/libbpf%2Flibbpf/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/libbpf","download_url":"https://codeload.github.com/libbpf/libbpf/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253990467,"owners_count":21995774,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bpf","libbpf","tracing"],"created_at":"2024-07-31T17:00:39.133Z","updated_at":"2025-05-13T17:10:14.777Z","avatar_url":"https://github.com/libbpf.png","language":"C","funding_links":[],"categories":["C","HarmonyOS"],"sub_categories":["Windows Manager"],"readme":"\u003cpicture\u003e\n  \u003csource media=\"(prefers-color-scheme: dark)\" srcset=\"assets/libbpf-logo-sideways-darkbg.png\" width=\"40%\"\u003e\n  \u003cimg src=\"assets/libbpf-logo-sideways.png\" width=\"40%\"\u003e\n\u003c/picture\u003e\n\nlibbpf\n[![Github Actions Builds \u0026 Tests](https://github.com/libbpf/libbpf/actions/workflows/test.yml/badge.svg)](https://github.com/libbpf/libbpf/actions/workflows/test.yml)\n[![Coverity](https://img.shields.io/coverity/scan/18195.svg)](https://scan.coverity.com/projects/libbpf)\n[![CodeQL](https://github.com/libbpf/libbpf/workflows/CodeQL/badge.svg?branch=master)](https://github.com/libbpf/libbpf/actions?query=workflow%3ACodeQL+branch%3Amaster)\n[![OSS-Fuzz Status](https://oss-fuzz-build-logs.storage.googleapis.com/badges/libbpf.svg)](https://oss-fuzz-build-logs.storage.googleapis.com/index.html#libbpf)\n[![Read the Docs](https://readthedocs.org/projects/libbpf/badge/?version=latest)](https://libbpf.readthedocs.io/en/latest/)\n======\n\n**This is the official home of the libbpf library.**\n\n*Please use this Github repository for building and packaging libbpf\nand when using it in your projects through Git submodule.*\n\nLibbpf *authoritative source code* is developed as part of [bpf-next Linux source\ntree](https://kernel.googlesource.com/pub/scm/linux/kernel/git/bpf/bpf-next) under\n`tools/lib/bpf` subdirectory and is periodically synced to Github. As such, all the\nlibbpf changes should be sent to [BPF mailing list](http://vger.kernel.org/vger-lists.html#bpf),\nplease don't open PRs here unless you are changing Github-specific parts of libbpf\n(e.g., Github-specific Makefile).\n\nLibbpf and general BPF usage questions\n======================================\n\nLibbpf documentation can be found [here](https://libbpf.readthedocs.io/en/latest/api.html).\nIt's an ongoing effort and has ways to go, but please take a look and consider contributing as well.\n\nPlease check out [libbpf-bootstrap](https://github.com/libbpf/libbpf-bootstrap)\nand [the companion blog post](https://nakryiko.com/posts/libbpf-bootstrap/) for\nthe examples of building BPF applications with libbpf.\n[libbpf-tools](https://github.com/iovisor/bcc/tree/master/libbpf-tools) are also\na good source of the real-world libbpf-based tracing tools.\n\nSee also [\"BPF CO-RE reference guide\"](https://nakryiko.com/posts/bpf-core-reference-guide/)\nfor the coverage of practical aspects of building BPF CO-RE applications and\n[\"BPF CO-RE\"](https://nakryiko.com/posts/bpf-portability-and-co-re/) for\ngeneral introduction into BPF portability issues and BPF CO-RE origins.\n\nAll general BPF questions, including kernel functionality, libbpf APIs and\ntheir application, should be sent to bpf@vger.kernel.org mailing list. You can\nsubscribe to it [here](http://vger.kernel.org/vger-lists.html#bpf) and search\nits archive [here](https://lore.kernel.org/bpf/). Please search the archive\nbefore asking new questions. It very well might be that this was already\naddressed or answered before.\n\nbpf@vger.kernel.org is monitored by many more people and they will happily try\nto help you with whatever issue you have. This repository's PRs and issues\nshould be opened only for dealing with issues pertaining to specific way this\nlibbpf mirror repo is set up and organized.\n\nBuilding libbpf\n===============\nlibelf is an internal dependency of libbpf and thus it is required to link\nagainst and must be installed on the system for applications to work.\npkg-config is used by default to find libelf, and the program called can be\noverridden with `PKG_CONFIG`.\n\nIf using `pkg-config` at build time is not desired, it can be disabled by\nsetting `NO_PKG_CONFIG=1` when calling make.\n\nTo build both static libbpf.a and shared libbpf.so:\n```bash\n$ cd src\n$ make\n```\n\nTo build only static libbpf.a library in directory\nbuild/ and install them together with libbpf headers in a staging directory\nroot/:\n```bash\n$ cd src\n$ mkdir build root\n$ BUILD_STATIC_ONLY=y OBJDIR=build DESTDIR=root make install\n```\n\nTo build both static libbpf.a and shared libbpf.so against a custom libelf\ndependency installed in /build/root/ and install them together with libbpf\nheaders in a build directory /build/root/:\n```bash\n$ cd src\n$ PKG_CONFIG_PATH=/build/root/lib64/pkgconfig DESTDIR=/build/root make install\n```\n\nBPF CO-RE (Compile Once – Run Everywhere)\n=========================================\n\nLibbpf supports building BPF CO-RE-enabled applications, which, in contrast to\n[BCC](https://github.com/iovisor/bcc/), do not require Clang/LLVM runtime\nbeing deployed to target servers and doesn't rely on kernel-devel headers\nbeing available.\n\nIt does rely on kernel to be built with [BTF type\ninformation](https://www.kernel.org/doc/html/latest/bpf/btf.html), though.\nSome major Linux distributions come with kernel BTF already built in:\n  - Fedora 31+\n  - RHEL 8.2+\n  - OpenSUSE Tumbleweed (in the next release, as of 2020-06-04)\n  - Arch Linux (from kernel 5.7.1.arch1-1)\n  - Manjaro (from kernel 5.4 if compiled after 2021-06-18)\n  - Ubuntu 20.10\n  - Debian 11 (amd64/arm64)\n\nIf your kernel doesn't come with BTF built-in, you'll need to build custom\nkernel. You'll need:\n  - `pahole` 1.16+ tool (part of `dwarves` package), which performs DWARF to\n    BTF conversion;\n  - kernel built with `CONFIG_DEBUG_INFO_BTF=y` option;\n  - you can check if your kernel has BTF built-in by looking for\n    `/sys/kernel/btf/vmlinux` file:\n  \n```shell\n$ ls -la /sys/kernel/btf/vmlinux\n-r--r--r--. 1 root root 3541561 Jun  2 18:16 /sys/kernel/btf/vmlinux\n```\n  \nTo develop and build BPF programs, you'll need Clang/LLVM 10+. The following\ndistributions have Clang/LLVM 10+ packaged by default:\n  - Fedora 32+\n  - Ubuntu 20.04+\n  - Arch Linux\n  - Ubuntu 20.10 (LLVM 11)\n  - Debian 11 (LLVM 11)\n  - Alpine 3.13+\n\nOtherwise, please make sure to update it on your system.\n\nThe following resources are useful to understand what BPF CO-RE is and how to\nuse it:\n- [BPF CO-RE reference guide](https://nakryiko.com/posts/bpf-core-reference-guide/)\n- [BPF Portability and CO-RE](https://nakryiko.com/posts/bpf-portability-and-co-re/)\n- [HOWTO: BCC to libbpf conversion](https://nakryiko.com/posts/bcc-to-libbpf-howto-guide/)\n- [libbpf-tools in BCC repo](https://github.com/iovisor/bcc/tree/master/libbpf-tools)\n  contain lots of real-world tools converted from BCC to BPF CO-RE. Consider\n  converting some more to both contribute to the BPF community and gain some\n  more experience with it.\n\nDistributions\n=============\n\nDistributions packaging libbpf from this mirror:\n  - [Fedora](https://src.fedoraproject.org/rpms/libbpf)\n  - [Gentoo](https://packages.gentoo.org/packages/dev-libs/libbpf)\n  - [Debian](https://packages.debian.org/source/sid/libbpf)\n  - [Arch](https://archlinux.org/packages/core/x86_64/libbpf/)\n  - [Ubuntu](https://packages.ubuntu.com/source/jammy/libbpf)\n  - [Alpine](https://pkgs.alpinelinux.org/packages?name=libbpf)\n\nBenefits of packaging from the mirror over packaging from kernel sources:\n  - Consistent versioning across distributions.\n  - No ties to any specific kernel, transparent handling of older kernels.\n    Libbpf is designed to be kernel-agnostic and work across multitude of\n    kernel versions. It has built-in mechanisms to gracefully handle older\n    kernels, that are missing some of the features, by working around or\n    gracefully degrading functionality. Thus libbpf is not tied to a specific\n    kernel version and can/should be packaged and versioned independently.\n  - Continuous integration testing via\n    [GitHub Actions](https://github.com/libbpf/libbpf/actions).\n  - Static code analysis via [LGTM](https://lgtm.com/projects/g/libbpf/libbpf)\n    and [Coverity](https://scan.coverity.com/projects/libbpf).\n\nPackage dependencies of libbpf, package names may vary across distros:\n  - zlib\n  - libelf\n\n[![libbpf distro packaging status](https://repology.org/badge/vertical-allrepos/libbpf.svg)](https://repology.org/project/libbpf/versions)\n\n\nbpf-next to Github sync\n=======================\n\nAll the gory details of syncing can be found in `scripts/sync-kernel.sh`\nscript. See [SYNC.md](SYNC.md) for instruction.\n\nSome header files in this repo (`include/linux/*.h`) are reduced versions of\ntheir counterpart files at\n[bpf-next](https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git/)'s\n`tools/include/linux/*.h` to make compilation successful.\n\nLicense\n=======\n\nThis work is dual-licensed under BSD 2-clause license and GNU LGPL v2.1 license.\nYou can choose between one of them if you use this work.\n\n`SPDX-License-Identifier: BSD-2-Clause OR LGPL-2.1`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flibbpf%2Flibbpf","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flibbpf%2Flibbpf","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flibbpf%2Flibbpf/lists"}