Open ymolists opened 4 years ago
It looks like you're using llvm-6 and clang-6. Try updating to clang-10 and retrying the build. I built just yesterday with no problems.
@rtkaratekid I actually tried that as well :-)
Here is how i compile the code and pass llvm-10
cmake .. \
-DLLVM_DIR=${LLVM_DIR} \
-DCMAKE_INSTALL_PREFIX="${bcc_src_dir}-dist"
I also made sure llvm-10 is in the path before making that cmake build above. Here is the error i am getting.
-- Latest recognized Git tag is v0.14.0
-- Git HEAD is f4302f345a13cc68a866bcf9a4cad58cdbd31586
-- Revision is 0.14.0-f4302f34
-- Found LLVM: /opt/llvm/llvm-10.x-dist-Release/include 10.0.1
-- Using static-libstdc++
-- Could NOT find LuaJIT (missing: LUAJIT_LIBRARIES LUAJIT_INCLUDE_DIR)
CMake Warning at tests/python/CMakeLists.txt:10 (message):
Recommended test program 'netperf' not found
CMake Warning at tests/python/CMakeLists.txt:16 (message):
Recommended test program 'iperf' or 'iperf3' not found
-- Configuring done
-- Generating done
-- Build files have been written to: /src/ebpf/bcc-master/build
Scanning dependencies of target clang_frontend
[ 1%] Building CXX object src/cc/frontends/clang/CMakeFiles/clang_frontend.dir/b_frontend_action.cc.o
In file included from /opt/llvm/llvm-10.x-dist-Release/include/clang/AST/RecursiveASTVisitor.h:23:0,
from /src/ebpf/bcc-master/src/cc/frontends/clang/b_frontend_action.h:23,
from /src/ebpf/bcc-master/src/cc/frontends/clang/b_frontend_action.cc:31:
/opt/llvm/llvm-10.x-dist-Release/include/clang/AST/DeclOpenMP.h:97:1: warning: multi-line comment [-Wcomment]
/// #pragma omp declare reduction (foo : int,float : omp_out += omp_in) \
^
In file included from /opt/llvm/llvm-10.x-dist-Release/include/clang/AST/RecursiveASTVisitor.h:16:0,
from /src/ebpf/bcc-master/src/cc/frontends/clang/b_frontend_action.h:23,
from /src/ebpf/bcc-master/src/cc/frontends/clang/b_frontend_action.cc:31:
/opt/llvm/llvm-10.x-dist-Release/include/clang/AST/Attr.h: In static member function ‘static clang::ParamIdx clang::ParamIdx::deserialize(clang::ParamIdx::SerialType)’:
/opt/llvm/llvm-10.x-dist-Release/include/clang/AST/Attr.h:261:48: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
ParamIdx P(*reinterpret_cast<ParamIdx *>(&S));
^
/opt/llvm/llvm-10.x-dist-Release/include/clang/AST/Attr.h:261:49: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
ParamIdx P(*reinterpret_cast<ParamIdx *>(&S));
^
/src/ebpf/bcc-master/src/cc/frontends/clang/b_frontend_action.cc: In member function ‘bool ebpf::BTypeVisitor::VisitVarDecl(clang::VarDecl*)’:
/src/ebpf/bcc-master/src/cc/frontends/clang/b_frontend_action.cc:1338:18: error: ‘BPF_MAP_TYPE_SK_STORAGE’ was not declared in this scope
map_type = BPF_MAP_TYPE_SK_STORAGE;
^~~~~~~~~~~~~~~~~~~~~~~
/src/ebpf/bcc-master/src/cc/frontends/clang/b_frontend_action.cc:1338:18: note: suggested alternative: ‘BPF_MAP_TYPE_CGROUP_STORAGE’
map_type = BPF_MAP_TYPE_SK_STORAGE;
^~~~~~~~~~~~~~~~~~~~~~~
BPF_MAP_TYPE_CGROUP_STORAGE
src/cc/frontends/clang/CMakeFiles/clang_frontend.dir/build.make:95: recipe for target 'src/cc/frontends/clang/CMakeFiles/clang_frontend.dir/b_frontend_action.cc.o' failed
make[2]: *** [src/cc/frontends/clang/CMakeFiles/clang_frontend.dir/b_frontend_action.cc.o] Error 1
CMakeFiles/Makefile2:1001: recipe for target 'src/cc/frontends/clang/CMakeFiles/clang_frontend.dir/all' failed
make[1]: *** [src/cc/frontends/clang/CMakeFiles/clang_frontend.dir/all] Error 2
Makefile:160: recipe for target 'all' failed
make: *** [all] Error 2
I also tried commenting that line (i know its desperate) but i am still getting other undefined variables. I was thinking this is maybe because i don't have the latest kernel headers. but i see the enums are defined in the code somewhere.
@ymolists since I'm not really sure what the error is, let me share my build script with you and you can take what you will from it. This has worked on a fresh install of Ubuntu 18.04 consistently. I believe I lifted it directly from here.
#!/bin/bash
apt-get update
apt-get upgrade
apt-get -y install bison build-essential cmake flex git libedit-dev \
libllvm6.0 llvm-6.0-dev libclang-6.0-dev python zlib1g-dev libelf-dev \
make python3-pip python3-distutils
git clone https://github.com/iovisor/bcc.git
mkdir bcc/build; cd bcc/build
cmake ..
make
sudo make install
cmake -DPYTHON_CMD=python3 .. # build python3 binding
pushd src/python/
make
sudo make install
popd
@rtkaratekid I am actually also following the same steps. I linked that same page in my first comment above. Thank you so much for your help and for taking the time.
I hope one of the devs can make sense of the error
enum bpf_map_type
is defined in src/cc/libbpf/
, which is an external repo https://github.com/libbpf/libbpf/. Pulling the latest changes from the repo might work. I think the recommended way is to build one from the release page.
Ref: https://github.com/iovisor/bcc/blob/master/INSTALL.md#libbpf-submodule
@tjarlama that was right on the call ! I am not sure how other people are able to build from master based on the installation steps provided above. The install does not make it super clear that you need to build from a released source (instead of git).
Thank you !!!
I am running into this compile error. I tried initially with git clone https://github.com/iovisor/bcc.git and ran into this issue. I had clang-6 installed then.
I upgraded to clang-10, but now I also get cmake errors about not finding clang. I tried downloading source tar.gz from releases but running into the same issues.
The whole install from the INSTALL.md instructions had worked on another Ubuntu18.04-bionic machine recently, but the same steps are not working on this new one now.
Can you please outline the steps needed to install bcc from source on Ubuntu18.04-bionic ? Thanks
Hello Team
I am trying to follow the docs found here
My current environment is :
I checked out the latest branch on master and i am getting this compile error: