iovisor / bcc

BCC - Tools for BPF-based Linux IO analysis, networking, monitoring, and more
Apache License 2.0
20.56k stars 3.88k forks source link

BCC v.0.24.0 is failing to compile on CentOS7 #4274

Open ruchirtr opened 2 years ago

ruchirtr commented 2 years ago

I have been trying to compile BCC (v.0.24.0) source on CentOS 7 and hitting following build errors.

[ 73%] Building CXX object src/cc/CMakeFiles/bcc-static.dir/bcc_btf.cc.o

/home/localadmin/bcc/src/cc/bcc_btf.cc:73:25: error: use of undeclared identifier 'EINVAL'

            return -EINVAL;

                    ^

/home/localadmin/bcc/src/cc/bcc_btf.cc:82:25: error: use of undeclared identifier 'EINVAL'

            return -EINVAL;

                    ^

/home/localadmin/bcc/src/cc/bcc_btf.cc:88:25: error: use of undeclared identifier 'EINVAL'

            return -EINVAL;

                    ^

/home/localadmin/bcc/src/cc/bcc_btf.cc:97:25: error: use of undeclared identifier 'EINVAL'

            return -EINVAL;

                    ^

/home/localadmin/bcc/src/cc/bcc_btf.cc:106:25: error: use of undeclared identifier 'EINVAL'

            return -EINVAL;

In order to get past this issue I had to make following changes into the source.

My assumption was that source is buildable.

Can you please advise if I am supposed to make such change into the source or is this something already identified?

diff --git a/src/cc/bcc_btf.cc b/src/cc/bcc_btf.cc

index 7f551ae..088eadd 100644

--- a/src/cc/bcc_btf.cc

+++ b/src/cc/bcc_btf.cc

@@ -17,6 +17,7 @@

include "bcc_btf.h"

include

include

+#include

include "linux/btf.h"

include "libbpf.h"

include "bcc_libbpf_inc.h"

chenhengqi commented 2 years ago

Please help with a PR. Thanks.

ruchirtr commented 2 years ago

Sure.