Skip to content

Commit

Permalink
Added Debian, Raspbian, Ubuntu 22.10 support to install dependencies (o…
Browse files Browse the repository at this point in the history
…penvinotoolkit#14226)

* Added Debian, Raspbian, Ubuntu 22.10 support

* Updated dependencies.cmake

* Fixes in script

* Added RHEL 9.1 support

* Added proper comments

* Compilation of rpm packages for aarch64 is fixed

* Proper generation of requirements.txt files when ENABLE_WHEEL=OFF

* samples build improvements

* Proper name for json library

* Proper condtion in samples
  • Loading branch information
ilya-lavrenov authored Nov 25, 2022
1 parent 4f0b846 commit 8dd8262
Show file tree
Hide file tree
Showing 10 changed files with 124 additions and 64 deletions.
10 changes: 7 additions & 3 deletions cmake/dependencies.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,8 @@ function(ov_download_tbb)
set(IE_PATH_TO_DEPS "${THIRDPARTY_SERVER_PATH}")
endif()

if (NOT DEFINED ENV{TBBROOT} AND (DEFINED ENV{TBB_DIR} OR DEFINED TBB_DIR))
if (DEFINED ENV{TBB_DIR})
if(NOT DEFINED ENV{TBBROOT} AND (DEFINED ENV{TBB_DIR} OR DEFINED TBB_DIR))
if(DEFINED ENV{TBB_DIR})
set(TEMP_ROOT $ENV{TBB_DIR})
elseif (DEFINED TBB_DIR)
set(TEMP_ROOT ${TBB_DIR})
Expand Down Expand Up @@ -260,7 +260,8 @@ if(ENABLE_OPENCV)
CMAKE_CXX_COMPILER_VERSION VERSION_LESS "4.9") AND X86_64)
set(OPENCV_SUFFIX "centos7")
set(OPENCV_HASH "5fa76985c84fe7c64531682ef0b272510c51ac0d0565622514edf1c88b33404a")
elseif(LINUX_OS_NAME MATCHES "CentOS 8" AND X86_64)
elseif((LINUX_OS_NAME MATCHES "CentOS 8" OR
LINUX_OS_NAME MATCHES "CentOS 9") AND X86_64)
set(OPENCV_SUFFIX "centos8")
set(OPENCV_HASH "db087dfd412eedb8161636ec083ada85ff278109948d1d62a06b0f52e1f04202")
elseif(LINUX_OS_NAME STREQUAL "Ubuntu 16.04" AND X86_64)
Expand All @@ -270,8 +271,11 @@ if(ENABLE_OPENCV)
set(OPENCV_SUFFIX "ubuntu18")
set(OPENCV_HASH "db087dfd412eedb8161636ec083ada85ff278109948d1d62a06b0f52e1f04202")
elseif((LINUX_OS_NAME STREQUAL "Ubuntu 20.04" OR
LINUX_OS_NAME STREQUAL "Ubuntu 20.10" OR
LINUX_OS_NAME STREQUAL "Ubuntu 21.04" OR
LINUX_OS_NAME STREQUAL "Ubuntu 21.10" OR
LINUX_OS_NAME STREQUAL "Ubuntu 22.04" OR
LINUX_OS_NAME STREQUAL "Ubuntu 22.10" OR
LINUX_OS_NAME STREQUAL "LinuxMint 20.1") AND X86_64)
set(OPENCV_SUFFIX "ubuntu20")
set(OPENCV_HASH "2fe7bbc40e1186eb8d099822038cae2821abf617ac7a16fadf98f377c723e268")
Expand Down
21 changes: 20 additions & 1 deletion cmake/developer_package/packaging/rpm/rpm.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,15 @@ macro(ov_rpm_cpack_set_dirs)
set(OV_CPACK_NGRAPH_CMAKEDIR ${CMAKE_INSTALL_LIBDIR}/cmake/ngraph${OpenVINO_VERSION})
set(OV_CPACK_OPENVINO_CMAKEDIR ${CMAKE_INSTALL_LIBDIR}/cmake/openvino${OpenVINO_VERSION})
set(OV_CPACK_DOCDIR ${CMAKE_INSTALL_DATADIR}/doc/openvino-${OpenVINO_VERSION})
# set(OV_CPACK_PYTHONDIR lib/python3/dist-packages)

ov_get_pyversion(pyversion)
if(pyversion)
set(OV_CPACK_PYTHONDIR ${CMAKE_INSTALL_LIBDIR}/${pyversion}/site-packages)
endif()

# non-native stuff
set(OV_CPACK_SHAREDIR ${CMAKE_INSTALL_DATADIR}/openvino-${OpenVINO_VERSION}) # internal
set(OV_CPACK_SHAREDIR ${CMAKE_INSTALL_DATADIR}/openvino) # internal
set(OV_CPACK_SAMPLESDIR ${OV_CPACK_SHAREDIR}/samples)
set(OV_CPACK_DEVREQDIR ${OV_CPACK_SHAREDIR})
unset(OV_CPACK_SHAREDIR)
Expand Down Expand Up @@ -104,6 +105,18 @@ macro(ov_rpm_specific_settings)
# set(CPACK_RPM_PACKAGE_RELEASE "1")
# enable this if someday we change the version scheme
# set(CPACK_RPM_PACKAGE_EPOCH "2")

# temporary WA for rpm package architecture for cross-compilation
# proper solution: to force cmake auto-detect this
if(CMAKE_CROSSCOMPILING)
if(AARCH64)
set(CPACK_DEBIAN_PACKAGE_ARCHITECTURE arm64)
elseif(ARM)
set(CPACK_DEBIAN_PACKAGE_ARCHITECTURE armhf)
elseif(x86)
set(CPACK_DEBIAN_PACKAGE_ARCHITECTURE i386)
endif()
endif()
endmacro()

ov_rpm_specific_settings()
Expand Down Expand Up @@ -161,10 +174,16 @@ function(ov_rpm_add_rpmlint_suppression comp)

if(DEFINED CPACK_RPM_${ucomp}_PACKAGE_ARCHITECTURE)
set(arch "${CPACK_RPM_${ucomp}_PACKAGE_ARCHITECTURE}")
elseif(DEFINED CPACK_RPM_PACKAGE_ARCHITECTURE)
set(arch "${CPACK_RPM_PACKAGE_ARCHITECTURE}")
elseif(X86_64)
set(arch "x86_64")
elseif(X86)
set(arch "i686")
elseif(AARCH64)
set(arch "aarch64")
elseif(ARM)
set(arch "armhf")
else()
message(FATAL_ERROR "RPM: Unsupported architecture ${CMAKE_SYSTEM_PROCESSOR}")
endif()
Expand Down
12 changes: 6 additions & 6 deletions cmake/packaging/rpm.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,16 @@ function(_ov_add_plugin comp is_pseudo)

if(is_pseudo)
if(pseudo_plugins_recommends)
set(pseudo_plugins_recommends "${pseudo_plugins_recommends}, ${package_name} (= ${cpack_full_ver})")
set(pseudo_plugins_recommends "${pseudo_plugins_recommends}, ${package_name} = ${cpack_full_ver}")
else()
set(pseudo_plugins_recommends "${package_name} (= ${cpack_full_ver})")
set(pseudo_plugins_recommends "${package_name} = ${cpack_full_ver}")
endif()
endif()

if(all_plugins_suggest)
set(all_plugins_suggest "${all_plugins_suggest}, ${package_name} (= ${cpack_full_ver})")
set(all_plugins_suggest "${all_plugins_suggest}, ${package_name} = ${cpack_full_ver}")
else()
set(all_plugins_suggest "${package_name} (= ${cpack_full_ver})")
set(all_plugins_suggest "${package_name} = ${cpack_full_ver}")
endif()

list(APPEND installed_plugins ${comp})
Expand Down Expand Up @@ -297,7 +297,7 @@ macro(ov_cpack_settings)

# TODO: provide different packages in two lines below
set(samples_build_deps "cmake3, gcc-c++, gcc, glibc-devel, make")
set(samples_build_deps_suggest "opencv-devel (>= 3.0)")
set(samples_build_deps_suggest "opencv-devel >= 3.0")

# c_samples / cpp_samples
set(CPACK_COMPONENT_SAMPLES_DESCRIPTION "Intel(R) Distribution of OpenVINO(TM) Toolkit C / C++ Samples")
Expand All @@ -306,7 +306,7 @@ macro(ov_cpack_settings)
# SUGGESTS may be unsupported, it's part of RPM 4.12.0 (Sep 16th 2014) only
# see https://rpm.org/timeline.html
set(CPACK_RPM_SAMPLES_PACKAGE_SUGGESTS "${samples_build_deps_suggest}, ${all_plugins_suggest}")
set(CPACK_RPM_SAMPLES_PACKAGE_REQUIRES "gflags-devel, zlib-devel")
set(CPACK_RPM_SAMPLES_PACKAGE_REQUIRES "gflags-devel, json-devel, zlib-devel")
set(CPACK_RPM_SAMPLES_PACKAGE_ARCHITECTURE "noarch")

ov_rpm_add_rpmlint_suppression("${OV_CPACK_COMP_CPP_SAMPLES}"
Expand Down
14 changes: 9 additions & 5 deletions samples/cpp/benchmark_app/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,15 @@ if(NOT TARGET nlohmann_json::nlohmann_json)
endif()
endif()

if(NOT nlohmann_json_FOUND AND EXISTS "${Samples_SOURCE_DIR}/thirdparty/nlohmann_json")
# suppress shadowing names warning
set(JSON_SystemInclude ON CACHE BOOL "" FORCE)
add_subdirectory("${Samples_SOURCE_DIR}/thirdparty/nlohmann_json"
"${Samples_BINARY_DIR}/thirdparty/nlohmann_json" EXCLUDE_FROM_ALL)
if(NOT nlohmann_json_FOUND)
if(EXISTS "${Samples_SOURCE_DIR}/thirdparty/nlohmann_json")
# suppress shadowing names warning
set(JSON_SystemInclude ON CACHE BOOL "" FORCE)
add_subdirectory("${Samples_SOURCE_DIR}/thirdparty/nlohmann_json"
"${Samples_BINARY_DIR}/thirdparty/nlohmann_json" EXCLUDE_FROM_ALL)
else()
message(FATAL_ERROR "Failed to find / build nlohmann_json library")
endif()
endif()
endif()

Expand Down
69 changes: 51 additions & 18 deletions scripts/install_dependencies/install_openvino_dependencies.sh
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,11 @@ if [ "$os" == "auto" ] ; then
os="rhel8"
fi
case $os in
rhel8|ubuntu18.04|ubuntu20.04|ubuntu21.10|ubuntu22.04) [ -z "$print" ] && echo "Detected OS: ${os}" ;;
rhel8|rhel9.1|\
raspbian9|debian9|ubuntu18.04|\
raspbian10|debian10|ubuntu20.04|ubuntu20.10|ubuntu21.04|\
raspbian11|debian11|ubuntu21.10|ubuntu22.04|\
raspbian12|debian12|ubuntu22.10) [ -z "$print" ] && echo "Detected OS: ${os}" ;;
*) echo "Unsupported OS: ${os:-detection failed}" >&2 ; exit 1 ;;
esac
fi
Expand All @@ -97,12 +101,25 @@ fi

extra_repos=()

if [ "$os" == "ubuntu18.04" ] ; then
if [ "$os" == "raspbian9" ] || [ "$os" == "debian9" ] ; then

# proper versions of cmake and python should be installed separately, because the defaults are:
# - python version is 3.5
# - cmake version is 3.7.2
# which are not supported by OpenVINO

pkgs_core=()
pkgs_python=()
pkgs_dev=(pkg-config g++ gcc libc6-dev libgflags-dev zlib1g-dev nlohmann-json-dev make curl sudo)
pkgs_myriad=(libusb-1.0-0)
pkgs_cl_compiler=()

elif [ "$os" == "ubuntu18.04" ] ; then

pkgs_core=(libtbb2 libpugixml1v5)
pkgs_opencv_req=(libgtk-3-0 libgl1)
pkgs_python=(python3 libpython3.6 python3-venv python3-pip)
pkgs_dev=(cmake pkg-config libgflags-dev zlib1g-dev nlohmann-json-dev g++ gcc libc6-dev make curl sudo)
pkgs_dev=(cmake pkg-config g++ gcc libc6-dev libgflags-dev zlib1g-dev nlohmann-json-dev make curl sudo)
pkgs_myriad=(libusb-1.0-0)
pkgs_cl_compiler=(libtinfo5)
pkgs_opencv_opt=(
Expand All @@ -119,9 +136,11 @@ if [ "$os" == "ubuntu18.04" ] ; then
libswscale4
)

elif [ "$os" == "ubuntu20.04" ] || [ "$os" == "ubuntu21.10" ] || [ "$os" == "ubuntu22.04" ] ; then
elif [ "$os" == "ubuntu20.04" ] || [ "$os" == "debian10" ] || [ "$os" == "raspbian10" ] ||
[ "$os" == "ubuntu21.10" ] || [ "$os" == "ubuntu22.04" ] || [ "$os" == "debian11" ] || [ "$os" == "raspbian11" ] ||
[ "$os" == "ubuntu22.10" ] || [ "$os" == "debian12" ] || [ "$os" == "raspbian12" ]; then

pkgs_core=(libtbb2 libpugixml1v5)
pkgs_core=(libpugixml1v5)
pkgs_opencv_req=(libgtk-3-0 libgl1)
pkgs_python=(python3 python3-venv python3-pip)
pkgs_dev=(cmake pkg-config g++ gcc libc6-dev libgflags-dev zlib1g-dev nlohmann-json3-dev make curl sudo)
Expand All @@ -140,23 +159,36 @@ elif [ "$os" == "ubuntu20.04" ] || [ "$os" == "ubuntu21.10" ] || [ "$os" == "ubu
libswscale5
)

if [ "$os" == "ubuntu20.04" ] ; then
if [ "$os" == "debian10" ] || [ "$os" == "raspbian10" ] ; then
pkgs_core=(${pkgs_core[@]} libtbb2)
pkgs_python=(${pkgs_python[@]} libpython3.7)
elif [ "$os" == "ubuntu20.04" ] || [ "$os" == "ubuntu20.10" ] || [ "$os" == "ubuntu21.04" ] ; then
pkgs_core=(${pkgs_core[@]} libtbb2)
pkgs_python=(${pkgs_python[@]} libpython3.8)
pkgs_opencv_opt=(${pkgs_opencv_opt[@]} libavresample4)
elif [ "$os" == "ubuntu21.10" ] ; then
elif [ "$os" == "ubuntu21.10" ] ||
[ "$os" == "debian11" ] || [ "$os" == "raspbian11" ] ; then
pkgs_core=(${pkgs_core[@]} libtbb2)
pkgs_python=(${pkgs_python[@]} libpython3.9)
elif [ "$os" == "ubuntu22.04" ] ; then
elif [ "$os" == "ubuntu22.04" ] || [ "$os" == "ubuntu22.10" ] ||
[ "$os" == "debian12" ] || [ "$os" == "raspbian12" ] ; then
pkgs_core=(${pkgs_core[@]} libtbb12)
pkgs_python=(${pkgs_python[@]} libpython3.10)
fi

elif [ "$os" == "rhel8" ] ; then
elif [ "$os" == "rhel8" ] || [ "$os" == "rhel9.1" ] ; then

if [ "$os" == "rhel9.1" ] ; then
pkgs_python=(python39 python3-pip)
elif [ "$os" == "rhel8" ] ; then
pkgs_python=(python38 python38-pip)
fi

pkgs_core=(libtbb2 libpugixml1v5)
pkgs_opencv_req=(gtk3)
pkgs_python=(python38 python38-pip)
pkgs_dev=(
gcc gcc-c++ make glibc libstdc++ libgcc cmake pkg-config zlib-devel.i686 curl sudo
https://vault.centos.org/centos/8/PowerTools/x86_64/os/Packages/gflags-2.1.2-6.el8.x86_64.rpm
gcc gcc-c++ make glibc libstdc++ libgcc cmake pkg-config zlib-devel curl sudo
https://vault.centos.org/centos/8/PowerTools/x86_64/os/Packages/gflags-2.1.2-6.el8.x86_64.rpm
)
pkgs_myriad=()
pkgs_opencv_opt=(
Expand Down Expand Up @@ -197,7 +229,7 @@ elif [ "$os" == "rhel8" ] ; then
extra_repos+=(https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm)

else
echo "Internal script error: invalid OS after check (package selection)" >&2
echo "Internal script error: invalid OS (${os}) after check (package selection)" >&2
exit 3
fi

Expand Down Expand Up @@ -236,16 +268,18 @@ fi

iopt=

if [ "$os" == "ubuntu18.04" ] || [ "$os" == "ubuntu20.04" ] || \
[ "$os" == "ubuntu21.10" ] || [ "$os" == "ubuntu22.04" ] ; then
if [ "$os" == "debian9" ] || [ "$os" == "raspbian9" ] || [ "$os" == "ubuntu18.04" ] ||
[ "$os" == "debian10" ] || [ "$os" == "raspbian10" ] || [ "$os" == "ubuntu20.04" ] || [ "$os" == "ubuntu20.10" ] || [ "$os" == "ubuntu21.04" ] ||
[ "$os" == "debian11" ] || [ "$os" == "raspbian11" ] || [ "$os" == "ubuntu21.10" ] || [ "$os" == "ubuntu22.04" ] ||
[ "$os" == "debian12" ] || [ "$os" == "raspbian12" ] || [ "$os" == "ubuntu22.10" ] ; then

[ -z "$interactive" ] && iopt="-y"
[ -n "$dry" ] && iopt="--dry-run"
[ -n "$keepcache" ] && rm -f /etc/apt/apt.conf.d/docker-clean

apt-get update && apt-get install -y --no-install-recommends $iopt ${pkgs[@]}

elif [ "$os" == "rhel8" ] ; then
elif [ "$os" == "rhel8" ] || [ "$os" == "rhel9.1" ] ; then

[ -z "$interactive" ] && iopt="--assumeyes"
[ -n "$dry" ] && iopt="--downloadonly"
Expand All @@ -255,9 +289,8 @@ elif [ "$os" == "rhel8" ] ; then
yum install $iopt ${pkgs[@]}

else
echo "Internal script error: invalid OS after check (package installation)" >&2
echo "Internal script error: invalid OS (${os}) after check (package installation)" >&2
exit 3
fi

exit 0

2 changes: 1 addition & 1 deletion src/cmake/ie_parallel.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ macro(ov_find_package_tbb)

# WA for oneTBB: it does not define TBB_IMPORTED_TARGETS
if(TBB_FOUND AND NOT TBB_IMPORTED_TARGETS)
foreach(target TBB::tbb TBB::tbbmalloc)
foreach(target TBB::tbb TBB::tbbmalloc TBB::tbbbind_2_5)
if(TARGET ${target})
list(APPEND TBB_IMPORTED_TARGETS ${target})
endif()
Expand Down
4 changes: 1 addition & 3 deletions src/cmake/install_tbb.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,6 @@ if(THREADING MATCHES "^(TBB|TBB_AUTO)$" AND
endif()

if(ENABLE_SYSTEM_TBB)
# TODO: what's about tbbbind for cases U22 with >= TBB 20221
# it seems that oneTBB from U22 distro does not contains tbbbind library

# for system libraries we still need to install TBB libraries
# so, need to take locations of actual libraries and install them
foreach(tbb_target IN LISTS TBB_IMPORTED_TARGETS)
Expand All @@ -118,6 +115,7 @@ if(THREADING MATCHES "^(TBB|TBB_AUTO)$" AND
# to ignore from IRC / apt / yum distribution;
# but they will be present in .wheel
foreach(tbb_file IN LISTS tbb_files)
# TODO: check by what name TBB loads the libraries
ov_install_with_name("${tbb_file}" tbb)
endforeach()
endforeach()
Expand Down
29 changes: 2 additions & 27 deletions tools/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,29 +26,6 @@ install(DIRECTORY deployment_manager
COMPONENT ${OV_CPACK_COMP_DEPLOYMENT_MANAGER}
USE_SOURCE_PERMISSIONS)

# outbound requirements.txt files for openvino-dev package

ie_cpack_add_component(${OV_CPACK_COMP_DEV_REQ_FILES} HIDDEN)

set(REQUIREMENTS_IN "${CMAKE_CURRENT_SOURCE_DIR}/requirements_dev.in")
set(EXTRAS_LIST _ caffe kaldi mxnet onnx pytorch tensorflow tensorflow2)

foreach(EXTRAS IN LISTS EXTRAS_LIST)
if(EXTRAS STREQUAL "_")
set(REQUIREMENTS_OUT "requirements.txt")
set(EXTRAS "")
else()
set(REQUIREMENTS_OUT "requirements_${EXTRAS}.txt")
set(EXTRAS "[${EXTRAS}]")
endif()
configure_file(${REQUIREMENTS_IN} ${REQUIREMENTS_OUT})

install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${REQUIREMENTS_OUT}
DESTINATION ${OV_CPACK_DEVREQDIR}
COMPONENT ${OV_CPACK_COMP_DEV_REQ_FILES}
EXCLUDE_FROM_ALL)
endforeach()

# MO

add_subdirectory(mo)
Expand All @@ -58,8 +35,6 @@ add_subdirectory(mo)
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/pot/openvino/tools/pot/version.txt.in"
"${CMAKE_CURRENT_SOURCE_DIR}/pot/openvino/tools/pot/version.txt" @ONLY)

# build and install openvino-dev wheel
# wheel openvino-dev

if(ENABLE_WHEEL)
add_subdirectory(openvino_dev)
endif()
add_subdirectory(openvino_dev)
27 changes: 27 additions & 0 deletions tools/openvino_dev/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,35 @@ else()
endif()
set(WHEEL_BUILD "${OpenVINO_VERSION_BUILD}" CACHE STRING "Build number of this release" FORCE)

# outbound requirements.txt files for openvino-dev package

ie_cpack_add_component(${OV_CPACK_COMP_DEV_REQ_FILES} HIDDEN)

set(REQUIREMENTS_IN "${CMAKE_CURRENT_SOURCE_DIR}/requirements_dev.in")
set(EXTRAS_LIST _ caffe kaldi mxnet onnx pytorch tensorflow tensorflow2)

foreach(EXTRAS IN LISTS EXTRAS_LIST)
if(EXTRAS STREQUAL "_")
set(REQUIREMENTS_OUT "requirements.txt")
set(EXTRAS "")
else()
set(REQUIREMENTS_OUT "requirements_${EXTRAS}.txt")
set(EXTRAS "[${EXTRAS}]")
endif()
configure_file(${REQUIREMENTS_IN} ${REQUIREMENTS_OUT})

install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${REQUIREMENTS_OUT}
DESTINATION ${OV_CPACK_DEVREQDIR}
COMPONENT ${OV_CPACK_COMP_DEV_REQ_FILES}
EXCLUDE_FROM_ALL)
endforeach()

# openvino_dev build

if(NOT ENABLE_WHEEL)
return()
endif()

set(SETUP_PY "${CMAKE_CURRENT_SOURCE_DIR}/setup.py")

set(openvino_wheel_name "openvino_dev-${WHEEL_VERSION}-${WHEEL_BUILD}-py3-none-any.whl")
Expand Down
File renamed without changes.

0 comments on commit 8dd8262

Please sign in to comment.