-
Notifications
You must be signed in to change notification settings - Fork 0
Building OpenVINO on CentOS 7 Guide
CentOS 7 as one of the most popular Linux distributions, is widely adopted by developers for software development and deployment.
However, CentOS 7 default GCC 4.8.5 and CMake 2.8.12 does not meet the OpenVINO software requirement for building on Linux system.
In this guide, we will show how to build OpenVINO on CentOS 7.6 (64 bit) using custom GCC 8.3.1, CMake 3.23.2, and Python 3.7.
User may choose other GCC, CMake, and Python version that meets software requirement for building OpenVINO on Linux system.
Install GCC 8.3.1 via devtoolset-8
sudo yum update -y && sudo yum install -y centos-release-scl epel-release
sudo yum install -y devtoolset-8 git patchelf
Enable devtoolset-8 and check current gcc version
source /opt/rh/devtoolset-8/enable
gcc -v
Download and extract pre-built CMake 3.23.2
wget https://cmake.org/files/v3.23/cmake-3.23.2-linux-x86_64.tar.gz
tar -xvf cmake-3.23.2-linux-x86_64.tar.gz
Add cmake path to the PATH environment variable and check current cmake version
export PATH=$PWD/cmake-3.23.2-linux-x86_64/bin:$PATH
cmake --version
Download and install miniconda3
wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh
sudo chmod +x Miniconda3-latest-Linux-x86_64.sh
./Miniconda3-latest-Linux-x86_64.sh
Create and enable python virtual environment via miniconda3
conda create -n ov_py37 python=3.7 -y
conda activate ov_py37
Clone openvino and update submodule
git clone https://github.com/openvinotoolkit/openvino.git
cd openvino && git submodule update --init --recursive
Install python dependency for building python wheels
python3 -m pip install -U pip
python3 -m pip install -r ./src/bindings/python/src/compatibility/openvino/requirements-dev.txt
python3 -m pip install -r ./src/bindings/python/wheel/requirements-dev.txt
Create build and openvino_dist directory
mkdir build && mkdir openvino_dist && cd build
Build OpenVINO with CMake
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=../openvino_dist \
-DENABLE_OPENCV=OFF -DENABLE_INTEL_GNA=OFF -DENABLE_INTEL_MYRIAD_COMMON=OFF \
-DTREAT_WARNING_AS_ERROR=OFF -DENABLE_PYTHON=ON -DENABLE_WHEEL=ON \
-DPYTHON_EXECUTABLE=`which python3.7` \
-DPYTHON_LIBRARY=~/miniconda3/envs/ov_py37/lib/libpython3.7m.so \
-DPYTHON_INCLUDE_DIR=~/miniconda3/envs/ov_py37/include/python3.7m ..
make --jobs=$(nproc --all)
make install
** Please double check the name of your python library and header folder, if has m
suffix or not. The m
flag has been removed from the suffix of dynamic library filenames since Python3.8.
Install built python wheel for OpenVINO runtime and OpenVINO-dev tools
python3 -m pip install openvino-dev --find-links <openvino_repo>/openvino_dist/tools
Create model directory and install model optimizer dependency
mkdir ~/ov_models
pip install onnx==1.11.0 protobuf==3.19.4 openvino-dev[pytorch]
Download resnet50 pytorch model via omz_downloader
omz_downloader --name resnet-50-pytorch -o ~/ov_models/
Convert resnet50 pytorch model to OpenVINO FP32 IR via omz_converter
omz_converter --name resnet-50-pytorch -o ~/ov_models/ -d ~/ov_models/
Run benchmark app with resnet50 FP32 IR model on CPU
benchmark_app -m ~/ov_models/public/resnet-50-pytorch/FP32/resnet-50-pytorch.xml -d CPU
For general troubleshooting steps and issues, see Troubleshooting Guide for OpenVINO Installation. The following provide explanations to error messages during building OpenVINO on LINUX platforms.
/usr/local/lib/libgflags_nothreads.a(gflags.cc.o): relocation R_X86_64_32 against '.bss' can not be used when making a PIE object; recompile with -fPIC
/usr/local/lib/libgflags_nothreads.a(gflags reporting.cc.o): relocation R_X86_64_32 against symbol '__pthread key create@@GLIBC 2.2.5' can not be used when making a PIE object; recompile with -fPIC
/usr/local/lib/libgflags_nothreads.a(gflags completions.cc.o0): relocation R_X86 64 32S against symbol '__ZNSs4 Rep20 S empty _rep_storageE@@GLIBCXX_3.4' can not be used when making a PIE object; recompile with -fPIC
- This issue may appear in OpenVINO 2022.1 and 2022.2 versions. OpenVINO requires third-party's libraries built with -fPIC option, which generates position-independent code (PIC) to be used in a shared library. For more detailed PIC usage and limitation, please refer to user guide of GCC compiler.
- User will not have this issue in master branch that OpenVINO allows to use system-installed gflags in Fedora and CentOS.
To solve the above issue:
- Make sure you use OpenVINO submodule to download third-party's libraries to compile and generate local static libs for linking.
- Use
gflags
as an example, OpenVINO will use sources inopenvino/thirdparty/gflags/
to build new static lib to use.
- Remove CentOS 7 system installed
gflags
by runningyum remove gflags-devel
and any other installation ofgflags
. - Make sure there's no system installed gflags lib, verify that
gflags
was removed as follow:
echo "$(ldconfig -p | grep libgflags.so | tr ' ' '\n' | grep /)"
rpm -ql gflags-devel
- Build OpenVINO package
Run CMake to set OpenVINO build configuration. The package will build gflags in thridparty
folder and set -Dgflags_DIR variable to the locally installed lib in OpenVINO package. Expected configuration log as below:
The name gflags is an ALIAS for gflags_nothreads_static. It will be exported to the OpenVINODeveloperPackage with the original name.
- Then continue to compile and install the OpenVINO.
- Install
gflags
in system by runningyum install gflags-devel
. Two dynamic librarylibgflags.so
andlibgflags_nothreads.so
will be installed in/usr/lib64/
. - Build OpenVINO package
Run CMake to set OpenVINO build configuration and build. The package will use system-installed gflags lib. Expected configuration log as below:
gflags (2.1.1) is found at /usr/lib64/cmake/gflags
- Then continue to compile and install the OpenVINO.
ERROR: Could not find a version that satisfies the requirement wheel>=0.38.1
- This issue may happens when the user downloading python dependencies with an internal python source which may still not update. OpenVINO requires the wheel>=0.38.1 due to the API of wheel.vendored.packaging.tags has been changed since 0.38.1.
To solve the above issue:
- Please download wheel>=0.38.1 package from pypi, and install manually:
python3 -m pip install -r ./src/bindings/python/wheel/requirements-dev.txt
python3 -m pip install <pkg_path>/wheel-<0.38.*>-py3-none-any.whl
© Copyright 2018-2022, OpenVINO team
- Home
- General resources
- How to build
-
Developer documentation
- Inference Engine architecture
- OpenVINO Python API
- CPU plugin
- GPU plugin
- HETERO plugin architecture
- Snippets
- Sample for IE C++/C/Python API
- Proxy plugin (Concept)
- Tests