gobpf icon indicating copy to clipboard operation
gobpf copied to clipboard

bcc/bcc_common.h: No such file or directory

Open guitmz opened this issue 5 years ago • 7 comments

I've tested in Debian 10, Ubuntu 18.04 and 19.10, Fedora 31 and they all output the same error. I have installed the kernel headers and bcc lib as instructed, naturally.

$ go get -u github.com/iovisor/gobpf/bcc
# github.com/iovisor/gobpf/bcc
root/go/src/github.com/iovisor/gobpf/bcc/module.go:32:10: fatal error: bcc/bcc_common.h: No such file or directory
   32 | #include <bcc/bcc_common.h>
      |          ^~~~~~~~~~~~~~~~~~
compilation terminated.

guitmz avatar Nov 08 '19 10:11 guitmz

This is due to this change https://github.com/iovisor/gobpf/commit/8f9d1f043a9eaad8848fecc08af3cc432e274f39 which is due to https://github.com/iovisor/bcc/pull/2208. This bcc change hasn't made up to the distro repositories yet I guess.

If you build bcc from the sources (https://github.com/iovisor/bcc/blob/master/INSTALL.md#ubuntu---source) it will work nicely.

Pryz avatar Nov 17 '19 21:11 Pryz

Had the same issue, like @Pryz already mentioned it seems to be due to the outdated version in distro repos.

If you're using ubuntu like I do (16.04 in my case), you can also try uninstalling all bpfcc packages and use the upstream version if you want to avoid compiling things yourself. That worked for me.

sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 4052245BD4284CDD
echo "deb https://repo.iovisor.org/apt/$(lsb_release -cs) $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/iovisor.list
sudo apt-get update
sudo apt-get install bcc-tools libbcc-examples linux-headers-$(uname -r)

Source: https://github.com/iovisor/bcc/blob/master/INSTALL.md#ubuntu---binary

sauercrowd avatar Jan 21 '20 16:01 sauercrowd

sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 4052245BD4284CDD
echo "deb https://repo.iovisor.org/apt/bionic bionic main" | sudo tee /etc/apt/sources.list.d/iovisor.list
sudo apt-get update
sudo apt-get install bcc-tools libbcc-examples linux-headers-$(uname -r)

bionic is the lasted version in which bcc was supported.

Ghostbaby avatar Dec 27 '20 13:12 Ghostbaby

sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 4052245BD4284CDD
echo "deb https://repo.iovisor.org/apt/bionic bionic main" | sudo tee /etc/apt/sources.list.d/iovisor.list
sudo apt-get update
sudo apt-get install bcc-tools libbcc-examples linux-headers-$(uname -r)

bionic is the lasted version in which bcc was supported.

it works 4 me (ubuntu21.01/k5.12)

hz-kelpie avatar Jun 16 '21 03:06 hz-kelpie

I see that there are examples being provided to add a new repo and install bcc. In my case, that didn't work for me.

$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 20.04.2 LTS
Release:        20.04
Codename:       focal

In the end, I was able to install from source to get going. https://github.com/iovisor/bcc/blob/master/INSTALL.md#ubuntu---source

shadyabhi avatar Jul 10 '21 00:07 shadyabhi

Same issue in CentOS . After install rpm in https://centos.pkgs.org/8/centos-powertools-aarch64/bcc-devel-0.16.0-3.el8.aarch64.rpm.html, problem solved

xiaozhouX avatar Nov 12 '21 09:11 xiaozhouX

Just hit this issue:

$ sudo apt-get install bcc-tools libbcc-examples linux-headers-$(uname -r)
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
E: Unable to locate package bcc-tools
E: Unable to locate package libbcc-examples
$ lsb_release -a
No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 22.10
Release:	22.10
Codename:	kinetic

Was following Ubuntu docs, Nightly way fixed the problem.

Dentrax avatar Dec 03 '22 22:12 Dentrax