Open god14fei opened 6 years ago
Building on CentOS 7 is tricky because some of its packages (such as gcc) are too old. Luckily, it provides developer toolsets that can be used in such situations. We've managed to compile BESS for CentOS and RHEL using the following commands (I'm pulling these out of a set of build scripts so let me know if you run into any issues):
Install dependencies with Yum:
yum -y install epel-release centos-release-scl
yum -y install libpcap-devel zlib-devel c-ares-devel openssl-devel \
libunwind-devel numactl-devel glog-devel cmake kernel-headers kernel-devel \
rpm-build devtoolset-4-gcc devtoolset-4-gcc-c++ git19
Install Python dependencies
pip install grpcio==1.11.0 scapy==2.4.0
Enable software collections:
scl enable devtoolset-4 git19 bash
Build dependencies from source:
# Clone gRPC
git clone https://github.com/google/grpc
pushd grpc git checkout tags/v1.3.2 # Use version 1.3.2 git submodule update --init # Download dependencies make -j$(nproc) HAS_SYSTEM_PROTOBUF=false sudo make install popd
pushd grpc/third_party/protobuf sudo make install popd
pushd grpc/third_party/benchmark cmake . sudo make install popd
pushd grpc/third_party/googletest mkdir build cd build cmake .. make -j$(nproc) sudo make install popd
pushd grpc/third_party/gflags mkdir build cd build cmake -DGFLAGS_NAMESPACE=google .. make -j$(nproc) sudo make install popd
3. Build BESS:
git clone https://github.com/NetSys/bess.git cd bess git checkout $BESS_COMMIT_ID # We use 811ef1ce6317cb9557b0270a1f2e908861f8921b
sed -i 's@GTEST_DIR := /usr/src/gtest@GTEST_DIR := /opt/grpc/third_party/googletest/googletest@g' core/Makefile
mkdir -p /lib/modules/$(uname -r) ln -s /usr/src/kernels/$(rpm -qa | grep kernel-headers | sed -e 's/kernel-headers-//')/ /lib/modules/$(uname -r)/build
BESS_LINK_DYNAMIC=1 python build.py
Let me have a try first, thanks very much since this really helps me a lot! If I run into any issues, I will present them later.
@etremblay18 An error 'Unable to open /etc/scl/prefixes/devtoolset-4!' occurs after I execute the software collection command 'scl enable devtoolset-4 git19 bash'. I open the directory 'etc/scl/prefixes' and find that it is an empty directory. What's wrong with it? How can I install the devtoolset-4? and git19?
devtoolset-4-gcc, devtoolset-4-gcc-c++ and git19 are part of the yum packages in step 1. devtoolset-4-runtime will be installed as a dependency for devtoolset-4-gcc and devtoolset-4-gcc-c++.
@etremblay18 When I execute the last commond 'BESS_LINK_DYNAMIC=1 python build.py', it reports errors for installing more packages, such as "https://github.com/google/benchmark" package
[root@node8 bess]# BESS_LINK_DYNAMIC=1 python build.py
Error - #include <benchmark/benchmark.h> failed. Did you install "https://github.com/google/benchmark" package?
I have installed all the dependencies you list, why does it still report such errors? Any hints will be appreciated.
After building and installing libbenchmark, you should have /usr/local/include/benchmark/benchmark.h
. Is this the case? Also, you might have to do the following so that the libraries in /usr/local/lib can be found by the linker:
echo "/usr/local/lib" > /etc/ld.so.conf.d/bess.conf
sudo ldconfig
Really appreciate your patience in helping me! I did as what you said, however it still failed.
[root@node8 feishen]# cd /usr/local/include/benchmark/
[root@node8 benchmark]# ls
benchmark_api.h benchmark.h macros.h reporter.h
[root@node8 benchmark]# echo "/usr/local/lib" > /etc/ld.so.conf.d/bess.conf
[root@node8 benchmark]# ldconfig
[root@node8 benchmark]# cd /home/feishen/bess
[root@node8 bess]# BESS_LINK_DYNAMIC=1 python build.py
Error - #include <benchmark/benchmark.h> failed. Did you install "https://github.com/google/benchmark" package?
I then try to install benchmark manually. This time, I run into other issues when I build benchmark. Here's the output:
[root@node8 benchmark]# ls
appveyor.yml build cmake CONTRIBUTING.md docs include mingw.py releasing.md test WORKSPACE
AUTHORS BUILD.bazel CMakeLists.txt CONTRIBUTORS googletest LICENSE README.md src tools
[root@node8 benchmark]# cd build
[root@node8 build]# cmake .. -DCMAKE_BUILD_TYPE=RELEASE
-- The C compiler identification is GNU 4.4.7
-- The CXX compiler identification is GNU 4.4.7
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Failed to find LLVM FileCheck
-- Found Git: /usr/local/bin/git (found version "2.13.1")
-- git Version: v1.4.0-151ead62
-- Version: 1.4.0
-- Performing Test HAVE_CXX_FLAG_STD_CXX11
-- Performing Test HAVE_CXX_FLAG_STD_CXX11 - Failed
-- Performing Test HAVE_CXX_FLAG_STD_CXX0X
-- Performing Test HAVE_CXX_FLAG_STD_CXX0X - Success
-- Performing Test HAVE_CXX_FLAG_WALL
-- Performing Test HAVE_CXX_FLAG_WALL - Success
-- Performing Test HAVE_CXX_FLAG_WEXTRA
-- Performing Test HAVE_CXX_FLAG_WEXTRA - Success
-- Performing Test HAVE_CXX_FLAG_WSHADOW
-- Performing Test HAVE_CXX_FLAG_WSHADOW - Success
-- Performing Test HAVE_CXX_FLAG_WERROR
-- Performing Test HAVE_CXX_FLAG_WERROR - Success
-- Performing Test HAVE_CXX_FLAG_PEDANTIC
-- Performing Test HAVE_CXX_FLAG_PEDANTIC - Success
-- Performing Test HAVE_CXX_FLAG_PEDANTIC_ERRORS
-- Performing Test HAVE_CXX_FLAG_PEDANTIC_ERRORS - Success
-- Performing Test HAVE_CXX_FLAG_WSHORTEN_64_TO_32
-- Performing Test HAVE_CXX_FLAG_WSHORTEN_64_TO_32 - Failed
-- Performing Test HAVE_CXX_FLAG_WFLOAT_EQUAL
-- Performing Test HAVE_CXX_FLAG_WFLOAT_EQUAL - Success
-- Performing Test HAVE_CXX_FLAG_FSTRICT_ALIASING
-- Performing Test HAVE_CXX_FLAG_FSTRICT_ALIASING - Success
-- Performing Test HAVE_CXX_FLAG_WNO_DEPRECATED_DECLARATIONS
-- Performing Test HAVE_CXX_FLAG_WNO_DEPRECATED_DECLARATIONS - Success
-- Performing Test HAVE_CXX_FLAG_WNO_DEPRECATED
-- Performing Test HAVE_CXX_FLAG_WNO_DEPRECATED - Success
-- Performing Test HAVE_CXX_FLAG_WSTRICT_ALIASING
-- Performing Test HAVE_CXX_FLAG_WSTRICT_ALIASING - Success
-- Performing Test HAVE_CXX_FLAG_WD654
-- Performing Test HAVE_CXX_FLAG_WD654 - Failed
-- Performing Test HAVE_CXX_FLAG_WTHREAD_SAFETY
-- Performing Test HAVE_CXX_FLAG_WTHREAD_SAFETY - Failed
-- Performing Test HAVE_CXX_FLAG_COVERAGE
-- Performing Test HAVE_CXX_FLAG_COVERAGE - Success
-- Performing Test HAVE_STD_REGEX
-- Performing Test HAVE_STD_REGEX
-- Performing Test HAVE_STD_REGEX -- failed to compile
-- Performing Test HAVE_GNU_POSIX_REGEX
-- Performing Test HAVE_GNU_POSIX_REGEX
-- Performing Test HAVE_GNU_POSIX_REGEX -- failed to compile
-- Performing Test HAVE_POSIX_REGEX
-- Performing Test HAVE_POSIX_REGEX
-- Performing Test HAVE_POSIX_REGEX -- failed to compile
CMake Error at CMakeLists.txt:235 (message):
Failed to determine the source files for the regular expression backend
-- Configuring incomplete, errors occurred!
See also "/tools/benchmark/build/CMakeFiles/CMakeOutput.log".
See also "/tools/benchmark/build/CMakeFiles/CMakeError.log".
I tried a variety of ways but failed to find a solution.
Only a Ubuntu installation tutorial is given, but my machine OS is Centos 7, I try to install BESS on it but failed with the following errors after the ansible-playbook command.
SUDO password: [DEPRECATION WARNING]: 'include' for playbook includes. You should use 'import_playbook' instead. This feature will be removed in version 2.8. Deprecation warnings can be disabled by setting deprecation_warnings=False in ansible.cfg.
PLAY [all] ****
TASK [Gathering Facts] **** ok: [localhost]
TASK [apt_repository] ***** An exception occurred during task execution. To see the full traceback, use -vvv. The error was: NameError: global name 'aptsources_distro' is not defined fatal: [localhost]: FAILED! => {"changed": false, "module_stderr": "Traceback (most recent call last):\n File \"/tmp/ansible_2s10fg/ansible_module_apt_repository.py\", line 551, in\n main()\n File \"/tmp/ansible_2s10fg/ansible_module_apt_repository.py\", line 510, in main\n if isinstance(distro, aptsources_distro.Distribution):\nNameError: global name 'aptsources_distro' is not defined\n", "module_stdout": "", "msg": "MODULE FAILURE", "rc": 1}
to retry, use: --limit @/home/feishen/bess/env/bess.retry
PLAY RECAP **** localhost : ok=1 changed=0 unreachable=0 failed=1
How can I install BESS on a CentOS 7 host?