Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Question] How to Build in CentOS7? #381

Open
andywu106 opened this issue Jun 18, 2021 · 4 comments
Open

[Question] How to Build in CentOS7? #381

andywu106 opened this issue Jun 18, 2021 · 4 comments
Labels
bug Something isn't working

Comments

@andywu106
Copy link

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 andywu106 added the bug Something isn't working label Jun 18, 2021
@FedeParola
Copy link
Collaborator

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?

@leguandemomotou
Copy link

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

@JamesTuMarines
Copy link

JamesTuMarines commented Dec 13, 2022

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
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants