Open
Description
I'm attempting bcc install for first time on Ubuntu 17.04 Zesty.
$ sudo apt-get install bpfcc-tools
$ sudo apt-get install linux-headers-$(uname -r)
$ uname -a
Linux unbuntu-vm 4.10.0-28-generic #32-Ubuntu SMP Fri Jun 30 05:32:18 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
$ grep _BPF /boot/config-$(uname -r)
CONFIG_CGROUP_BPF=y
CONFIG_BPF=y
CONFIG_BPF_SYSCALL=y
CONFIG_NETFILTER_XT_MATCH_BPF=m
CONFIG_NET_CLS_BPF=m
CONFIG_NET_ACT_BPF=m
CONFIG_BPF_JIT=y
CONFIG_LWTUNNEL_BPF=y
CONFIG_BPF_EVENTS=y
CONFIG_TEST_BPF=m
I had to make some symlinks:
$ sudo ln -s /lib/modules/linux-headers-4.10.0-28-generic/kernel /lib/modules/linux-headers-4.10.0-28-generic/source
$ sudo ln -s /usr/src/linux-headers-4.10.0-28-generic /lib/modules/linux-headers-4.10.0-28-generic/kernel/include
..and then I seemed to get the HelloWorld to work:
$ cd /usr/share/doc/bpfcc-tools/examples
$ sudo python ./hello_world.py
bamfdaemon-1539 [000] d... 13637.914022: : Hello, World!
gpg-agent-2064 [000] d... 13658.198167: : Hello, World!
gpg-agent-2064 [000] d... 13658.198301: : Hello, World!
bamfdaemon-1539 [000] d... 13721.087705: : Hello, World!
But i'm not having any joy with execsnoop:
$ sudo /usr/sbin/execsnoop-bpfcc
In file included from /virtual/main.c:3:
In file included from /lib/modules/4.10.0-28-generic/build/include/linux/sched.h:61:
In file included from /lib/modules/4.10.0-28-generic/build/include/linux/cgroup-defs.h:19:
/lib/modules/4.10.0-28-generic/build/include/linux/bpf-cgroup.h:22:24: error: use
of undeclared identifier 'MAX_BPF_ATTACH_TYPE'
struct bpf_prog *prog[MAX_BPF_ATTACH_TYPE];
^
/lib/modules/4.10.0-28-generic/build/include/linux/bpf-cgroup.h:23:35: error: use
of undeclared identifier 'MAX_BPF_ATTACH_TYPE'
struct bpf_prog __rcu *effective[MAX_BPF_ATTACH_TYPE];
^
/lib/modules/4.10.0-28-generic/build/include/linux/bpf-cgroup.h:24:25: error: use
of undeclared identifier 'MAX_BPF_ATTACH_TYPE'
bool disallow_override[MAX_BPF_ATTACH_TYPE];
^
/lib/modules/4.10.0-28-generic/build/include/linux/bpf-cgroup.h:31:32: warning:
declaration of 'enum bpf_attach_type' will not be visible outside of this
function [-Wvisibility]
struct bpf_prog *prog, enum bpf_attach_type type,
^
/lib/modules/4.10.0-28-generic/build/include/linux/bpf-cgroup.h:36:14: warning:
declaration of 'enum bpf_attach_type' will not be visible outside of this
function [-Wvisibility]
enum bpf_attach_type type, bool overridable);
^
/lib/modules/4.10.0-28-generic/build/include/linux/bpf-cgroup.h:40:10: warning:
declaration of 'enum bpf_attach_type' will not be visible outside of this
function [-Wvisibility]
enum bpf_attach_type type);
^
/lib/modules/4.10.0-28-generic/build/include/linux/bpf-cgroup.h:43:16: warning:
declaration of 'enum bpf_attach_type' will not be visible outside of this
function [-Wvisibility]
enum bpf_attach_type type);
^
In file included from /virtual/main.c:4:
/lib/modules/4.10.0-28-generic/build/include/linux/fs.h:2659:9: warning:
comparison of unsigned enum expression < 0 is always false
[-Wtautological-compare]
if (id < 0 || id >= READING_MAX_ID)
~~ ^ ~
5 warnings and 3 errors generated.
Traceback (most recent call last):
File "/usr/sbin/execsnoop-bpfcc", line 143, in <module>
b = BPF(text=bpf_text)
File "/usr/lib/python2.7/dist-packages/bcc/__init__.py", line 197, in __init__
raise Exception("Failed to compile BPF module %s" % src_file)
Exception: Failed to compile BPF module
Metadata
Metadata
Assignees
Labels
No labels
Activity
smithnigelw commentedon Aug 2, 2017
The version of bpfcc that Ubuntu 17.04 Zesty installs, is v0.2.0 which is not the latest release.
https://github.com/iovisor/bcc/releases
Unfortunatly v0.3.0 does not seem to be available for Zesty.
But there is a v0.3.0 package for the current development version of Ubuntu 17.10 Artful.
https://packages.ubuntu.com/search?keywords=bpfcc-tools&searchon=names
So I tried downloading the source for the v0.3.0 package and building it on Zesty:
mmm, so still no joy :(
I tried running with gdb, and got the following stack trace:
smithnigelw commentedon Aug 2, 2017
As I'm not having much joy with Ubuntu 17.04 Zesty,
I decided to try with Fedora 26.
This looked more promising as the version of bcc was already at v0.3.0
Unfortunately, Fedora do not include the 'hello_world.py', so i had to create that myself.
https://github.com/iovisor/bcc/blob/v0.3.0/examples/hello_world.py
So again no joy :(
I tried running with gdb, and got the following stack trace, which looks similar to what I'm seeing with Ubuntu, but this Fedora trace shows more detail:
smithnigelw commentedon Aug 2, 2017
Just realised I was using python2:
So, i wondered if that was the caused of the problem.
So i tried with Python3, but still no joy.
mcaleavya commentedon Aug 2, 2017
smithnigelw commentedon Aug 2, 2017
Maybe I'm seeing the same problem as whats reported here:
"Segmentation fault (core dumped) when running btrfsslower.py #1221"
yonghong-song commentedon Aug 3, 2017
As @mcaleavya suggested, the workaround is to build latest llvm trunk and bcc manually.
mcaleavya commentedon Aug 7, 2017
Tested fresh build on 17.04
Linux henky 4.10.0-19-generic #21-Ubuntu SMP Thu Apr 6 17:04:57 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
henky:/var/tmp/bcc/tools$ cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=17.04
DISTRIB_CODENAME=zesty
DISTRIB_DESCRIPTION="Ubuntu 17.04"
henky:/var/tmp/bcc/tools$ sudo ./execsnoop.py
In file included from /virtual/main.c:5:
include/linux/fs.h:2659:9: warning: comparison of unsigned enum expression < 0 is always false [-Wtautological-compare]
if (id < 0 || id >= READING_MAX_ID)
~~ ^ ~
1 warning generated.
PCOMM PID PPID RET ARGS
ps 31815 1382 0 /bin/ps -ef
df 31816 1382 0 /bin/df
ls 31817 1382 0 /bin/ls --color=auto
find 31818 1382 0 /usr/bin/find .
All looks ok to me.
bcc: fix relocation bug downgrading to llvm 3.9
bcc: fix relocation bug downgrading to llvm 3.9
pruthvistony commentedon Oct 4, 2017
HI,
Running Ubuntu 16.04
I still get these errors when I run # biolatency
root@ubuntu:/usr/share/bcc/tools# ./biolatency
In file included from /virtual/main.c:3:
In file included from include/linux/blkdev.h:4:
In file included from include/linux/sched.h:61:
In file included from include/linux/cgroup-defs.h:19:
include/linux/bpf-cgroup.h:22:24: error: use of undeclared identifier
'MAX_BPF_ATTACH_TYPE'
struct bpf_prog *prog[MAX_BPF_ATTACH_TYPE];
^
include/linux/bpf-cgroup.h:23:35: error: use of undeclared identifier
'MAX_BPF_ATTACH_TYPE'
struct bpf_prog __rcu *effective[MAX_BPF_ATTACH_TYPE];
^
include/linux/bpf-cgroup.h:24:25: error: use of undeclared identifier
'MAX_BPF_ATTACH_TYPE'
bool disallow_override[MAX_BPF_ATTACH_TYPE];
^
include/linux/bpf-cgroup.h:31:32: warning: declaration of 'enum bpf_attach_type'
will not be visible outside of this function [-Wvisibility]
struct bpf_prog *prog, enum bpf_attach_type type,