polycube icon indicating copy to clipboard operation
polycube copied to clipboard

[Question] How to Build in CentOS7?

Open andywu106 opened this issue 4 years ago • 4 comments

Describe the bug

I try to build polycube In CentOS7,but get following error:

Scanning dependencies of target b_frontend [ 21%] Building CXX object src/libs/bcc/src/cc/frontends/b/CMakeFiles/b_frontend.dir/loader.cc.o [ 21%] Building CXX object src/libs/bcc/src/cc/frontends/b/CMakeFiles/b_frontend.dir/codegen_llvm.cc.o /cache1/code_hub/polycube/src/libs/bcc/src/cc/frontends/b/codegen_llvm.cc: In member function ‘ebpf::StatusTuple ebpf::cc::CodegenLLVM::emit_atomic_add(ebpf::cc::MethodCallExprNode*)’: /cache1/code_hub/polycube/src/libs/bcc/src/cc/frontends/b/codegen_llvm.cc:722:45: error: no matching function for call to ‘llvm::IRBuilder<>::CreateAtomicRMW(llvm::AtomicRMWInst::BinOp, llvm::Value*&, llvm::Value*&, llvm::Align, llvm::AtomicOrdering)’ AtomicOrdering::SequentiallyConsistent); ^ In file included from /cache1/code_hub/polycube/src/libs/bcc/src/cc/frontends/b/codegen_llvm.cc:31: /usr/local/include/llvm/IR/IRBuilder.h:1716:18: note: candidate: ‘llvm::AtomicRMWInst* llvm::IRBuilderBase::CreateAtomicRMW(llvm::AtomicRMWInst::BinOp, llvm::Value*, llvm::Value*, llvm::AtomicOrdering, llvm::SyncScope::ID)’ AtomicRMWInst *CreateAtomicRMW(AtomicRMWInst::BinOp Op, Value *Ptr, Value *Val, ^~~~~~~~~~~~~~~ /usr/local/include/llvm/IR/IRBuilder.h:1716:18: note: no known conversion for argument 4 from ‘llvm::Align’ to ‘llvm::AtomicOrdering’ make[2]: *** [src/libs/bcc/src/cc/frontends/b/CMakeFiles/b_frontend.dir/build.make:107: src/libs/bcc/src/cc/frontends/b/CMakeFiles/b_frontend.dir/codegen_llvm.cc.o] Error 1 make[1]: *** [CMakeFiles/Makefile2:2365: src/libs/bcc/src/cc/frontends/b/CMakeFiles/b_frontend.dir/all] Error 2 make[1]: *** Waiting for unfinished jobs.... [ 23%] Building CXX object src/libs/bcc/src/cc/frontends/clang/CMakeFiles/clang_frontend.dir/tp_frontend_action.cc.o [ 23%] Building CXX object src/libs/bcc/src/cc/frontends/clang/CMakeFiles/clang_frontend.dir/kbuild_helper.cc.o /cache1/code_hub/polycube/src/libs/bcc/src/cc/frontends/clang/kbuild_helper.cc:80:3: warning: multi-line comment [-Wcomment] // USERINCLUDE :=
^ /cache1/code_hub/polycube/src/libs/bcc/src/cc/frontends/clang/kbuild_helper.cc:89:3: warning: multi-line comment [-Wcomment] // LINUXINCLUDE :=
^ [ 23%] Building CXX object src/libs/bcc/src/cc/frontends/clang/CMakeFiles/clang_frontend.dir///common.cc.o [ 23%] Linking CXX static library libclang_frontend.a [ 23%] Built target clang_frontend make: *** [Makefile:150: all] Error 2

Please tell us about your environment:

  1. OS details: CentOS Linux release 7.8.2003
  2. Kernel details: 4.18.0
  3. LLVM version: 13.0.0git

Additional context

Is possible to build and run in CentOS7?

andywu106 avatar Jun 18 '21 03:06 andywu106

Hi @andywu106, it seems a problem related to BCC and in particular to LLVM, could you try downgrading the version to v9 and see if it compiles correctly?

FedeParola avatar Jun 21 '21 07:06 FedeParola

@andywu106 I have the same problem. Would you like to solve your problem below?

leguandemomotou avatar Aug 12 '21 06:08 leguandemomotou

Hi All,

I manage to install the Polycube from source code and no error pops out when compiling.

However, I cannot start the service. After checking the status, it said "/usr/local/bin/polycubed: error while loading shared libraries: libpistache.so.0: cannot open shared object file: No such file or directory but this library is installed.

sudo find / -name libpistache.so.0 /root/pistache/build/src/libpistache.so.0 /usr/local/lib64/libpistache.so.0

I tried to export the path to the LD_LIBRARY_PATH but it did not work.

echo $LD_LIBRARY_PATH /opt/rh/llvm-toolset-7/root/usr/lib64:/opt/rh/devtoolset-8/root/usr/lib64:/opt/rh/devtoolset-8/root/usr/lib:/opt/rh/devtoolset-8/root/usr/lib64/dyninst:/opt/rh/devtoolset-8/root/usr/lib/dyninst:/opt/rh/devtoolset-8/root/usr/lib64:/opt/rh/devtoolset-8/root/usr/lib:/usr/local/lib64

My environment

OS details: CentOS Linux release 7.6 Kernel details: 5.4.226-1.el7.elrepo.x86_64 LLVM version: 5.0.1 GCC version: 8.3.1 cmake version: 3.25

This is how I install.

#Dependencies

yum groupinstall -y "Development Tools" yum install -y epel-release yum install -y git bison flex bash-completion openssl-devel jq libpcap-devel libnl3-devel elfutils-libelf-devel wget vim uuid uuid-devel libuuid libuuid-devel pcre2-devel ncurses-devel

#Install llvm+clang

yum install -y centos-release-scl yum-utils yum-config-manager --enable rhel-server-rhscl-7-rpms yum install -y devtoolset-8 llvm-toolset-7 llvm-toolset-7-llvm-devel llvm-toolset-7-llvm-static llvm-toolset-7-clang-devel devtoolset-8-gcc-c++ source scl_source enable devtoolset-8 llvm-toolset-7

#Update CMake #Latest pistache require CMake version 3.6

git clone https://github.com/Kitware/CMake.git cd CMake ./bootstrap && make && sudo make install export PATH=$PATH:/root/CMake/bin cd ~

#Install libyang-dev #latest version would pop error when make the polycube

wget https://github.com/CESNET/libyang/archive/refs/tags/v0.16-r3.tar.gz tar xvf v0.16-r3.tar.gz cd libyang-0.16-r3/ mkdir build; cd build cmake .. make make install cd ~

#Install pistache

git clone https://github.com/oktal/pistache.git cd pistache git checkout 117db02eda9d63935193ad98be813987f6c32b33 git submodule update --init mkdir build && cd build cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release -DPISTACHE_USE_SSL=ON .. make -j $(getconf _NPROCESSORS_ONLN) sudo make install cd ~

#Install libtins

git clone --branch v3.5 https://github.com/mfontanini/libtins.git cd libtins mkdir build && cd build cmake -DLIBTINS_ENABLE_CXX11=ON -DLIBTINS_BUILD_EXAMPLES=OFF
-DLIBTINS_BUILD_TESTS=OFF -DLIBTINS_ENABLE_DOT11=OFF
-DLIBTINS_ENABLE_PCAP=OFF -DLIBTINS_ENABLE_WPA2=OFF
-DLIBTINS_ENABLE_WPA2_CALLBACKS=OFF .. make -j $(getconf _NPROCESSORS_ONLN) sudo make install export CMAKE_PREFIX_PATH=/usr/local/ sudo ldconfig cd ~

#LuaJIT

wget http://luajit.org/download/LuaJIT-2.0.2.tar.gz tar -zxvf LuaJIT-2.0.2.tar.gz cd LuaJIT-2.0.2 make && make install

#Install Prometheus-cpp #Error would pop when make the polycube without this

git clone https://github.com/jupp0r/prometheus-cpp.git cd prometheus-cpp git submodule init git submodule update source scl_source enable devtoolset-8 llvm-toolset-7 mkdir build && cd build cmake .. -DBUILD_SHARED_LIBS=ON -DENABLE_PUSH=OFF -DENABLE_COMPRESSION=OFF cmake --build . --parallel 4 ctest -V cmake --install .

cd ~

#Polycube

git clone https://github.com/polycube-network/polycube cd polycube git submodule update --init --recursive mkdir build && cd build cmake .. make -j $(getconf _NPROCESSORS_ONLN) sudo make install cd ~ `

JamesTuMarines avatar Dec 13 '22 09:12 JamesTuMarines

Hi All,

I figure it out.

I edit the /etc/ld.so.conf file and put the following directory into it.

echo /usr/local/lib64 echo /usr/local/lib echo /opt/rh/llvm-toolset-7/root/usr/lib64/ echo /opt/rh/llvm-toolset-7/root/usr/lib/ ldconfig

Now, I got this error when starting Polycubed.

Dec 14 04:25:00 localhost.localdomain polycubed[3866]: [2022-12-14 04:25:00.969] [polycubed] [info] loading configuration from /etc/polycube/polycubed.conf Dec 14 04:25:00 localhost.localdomain polycubed[3866]: [2022-12-14 04:25:00.971] [polycubed] [info] configuration parameters: Dec 14 04:25:00 localhost.localdomain polycubed[3866]: [2022-12-14 04:25:00.971] [polycubed] [info] loglevel: info Dec 14 04:25:00 localhost.localdomain polycubed[3866]: [2022-12-14 04:25:00.971] [polycubed] [info] daemon: false Dec 14 04:25:00 localhost.localdomain polycubed[3866]: [2022-12-14 04:25:00.971] [polycubed] [info] pidfile: /var/run/polycube.pid Dec 14 04:25:00 localhost.localdomain polycubed[3866]: [2022-12-14 04:25:00.971] [polycubed] [info] port: 9000 Dec 14 04:25:00 localhost.localdomain polycubed[3866]: [2022-12-14 04:25:00.971] [polycubed] [info] addr: localhost Dec 14 04:25:00 localhost.localdomain polycubed[3866]: [2022-12-14 04:25:00.971] [polycubed] [info] logfile: /var/log/polycube/polycubed.log Dec 14 04:25:00 localhost.localdomain polycubed[3866]: [2022-12-14 04:25:00.971] [polycubed] [info] cubes-dump-file: /etc/polycube/cubes.yaml Dec 14 04:25:00 localhost.localdomain polycubed[3866]: [2022-12-14 04:25:00.971] [polycubed] [info] cubes-dump-clean-init: false Dec 14 04:25:00 localhost.localdomain polycubed[3866]: [2022-12-14 04:25:00.971] [polycubed] [info] cubes-dump-enable: false Dec 14 04:25:00 localhost.localdomain polycubed[3866]: [2022-12-14 04:25:00.971] [polycubed] [info] polycubed starting... Dec 14 04:25:00 localhost.localdomain polycubed[3866]: [2022-12-14 04:25:00.971] [polycubed] [info] version v0.9.0+ [git: (branch/commit): master/a143e3c0] **Dec 14 04:25:00 localhost.localdomain polycubed[3866]: *** Error in `/usr/local/bin/polycubed': free(): invalid pointer: 0x00007ff4df76dd00 *****

Don't know how to google this.

JamesTuMarines avatar Dec 14 '22 09:12 JamesTuMarines