[Dist/Debian] Remove dependency on libtbb packages 32/250932/1
authorWook Song <wook16.song@samsung.com>
Tue, 5 Jan 2021 10:53:58 +0000 (19:53 +0900)
committerWook Song <wook16.song@samsung.com>
Wed, 6 Jan 2021 01:09:18 +0000 (10:09 +0900)
This patch removes build dependencies on libtbb packages by adding a
local patch that generates libbtbb.a before dh_auto_configure and links
the OpenVino libraries to this static library. According to those
changes, debian packaging files are also revised.

Change-Id: I9e4390c5c11b51deafd0895461e725e72c125461
Signed-off-by: Wook Song <wook16.song@samsung.com>
debian/changelog
debian/control
debian/patches/0005-CMake-Add-an-option-to-use-libtbb-in-the-given-direc.patch [new file with mode: 0644]
debian/patches/series
debian/rules
debian/tbb_patches/0001-Local-Makefile-Skip-test-to-speed-up-the-build-time.patch [new file with mode: 0644]
packaging/tbb_2019~U9.tar.gz [new file with mode: 0644]

index 97727b5..de83b5f 100644 (file)
@@ -1,3 +1,11 @@
+openvino (2019R3-6) unstable; urgency=low
+
+  * Dependency on libtbb packages is fully removed by adding a local patch that
+    generates libtbb.a before dh_auto_configure and links the OpenVino libraries
+    to this static library.
+
+ -- Wook Song <wook16.song@samsung.com>  Thu, 5 Jan 2021 18:24:34 +0900
+
 openvino (2019R3-5) unstable; urgency=low
 
   * This version of InferenceEngine requires a specific version of the Intel
index dde9443..246301b 100644 (file)
@@ -6,7 +6,7 @@ Build-Depends: debhelper (>= 9.0.0), quilt,
  cmake, pkg-config,
  gcc-9 | gcc-8 | gcc-7 | gcc-6 | gcc-5,
  g++-9 | g++-8 | g++-7 | g++-6 | g++-5,
- libtbb-devel, libusb-1.0-0-dev
+ libusb-1.0-0-dev
 Standards-Version: 4.1.4
 Vcs-Git: git://git.tizen.org/platform/upstream/dldt
 Vcs-Browser: https://git.tizen.org/cgit/platform/upstream/dldt
diff --git a/debian/patches/0005-CMake-Add-an-option-to-use-libtbb-in-the-given-direc.patch b/debian/patches/0005-CMake-Add-an-option-to-use-libtbb-in-the-given-direc.patch
new file mode 100644 (file)
index 0000000..dfc2c8e
--- /dev/null
@@ -0,0 +1,61 @@
+From 6281e27c4bd716dcf6a8d91488bcfe9e00baa233 Mon Sep 17 00:00:00 2001
+From: Wook Song <wook16.song@samsung.com>
+Date: Tue, 5 Jan 2021 19:02:14 +0900
+Subject: [PATCH 1/1] [CMake] Add an option to use libtbb in the given
+ directory
+
+This patch adds an option to use header and static library files in the
+given directory.
+
+Change-Id: I2fa0149f7e9f0fddea187632f7163d502f2a1a15
+Signed-off-by: Wook Song <wook16.song@samsung.com>
+---
+ inference-engine/cmake/dependencies.cmake | 6 ++++--
+ inference-engine/cmake/ie_parallel.cmake  | 5 +++++
+ 2 files changed, 9 insertions(+), 2 deletions(-)
+
+diff --git a/inference-engine/cmake/dependencies.cmake b/inference-engine/cmake/dependencies.cmake
+index faf2122f..c7356429 100644
+--- a/inference-engine/cmake/dependencies.cmake
++++ b/inference-engine/cmake/dependencies.cmake
+@@ -88,6 +88,8 @@ if (THREADING STREQUAL "TBB" OR THREADING STREQUAL "TBB_AUTO")
+     elseif(LINUX)
+         if (USE_TBB_SYSTEM_DEPS)
+             pkg_search_module(TBB REQUIRED libtbb)
++        elseif (USE_TBB_IN_HOUSE_STATIC_BUILD)
++            message("Use libtbb.a in ${USE_TBB_IN_HOUSE_STATIC_BUILD}/lib")
+         else(USE_TBB_SYSTEM_DEPS)
+             RESOLVE_DEPENDENCY(TBB
+                     ARCHIVE_LIN "tbb2019_20181010_lin.tgz"
+@@ -101,10 +103,10 @@ if (THREADING STREQUAL "TBB" OR THREADING STREQUAL "TBB_AUTO")
+                 ENVIRONMENT "TBBROOT"
+                 VERSION_REGEX ".*_([a-z]*_([a-z0-9]+\\.)*[0-9]+).*")
+     endif()
+-    if (NOT USE_TBB_SYSTEM_DEPS)
++    if (NOT (USE_TBB_SYSTEM_DEPS OR USE_TBB_IN_HOUSE_STATIC_BUILD))
+         log_rpath_from_dir(TBB "${TBB}/lib")
+         debug_message(STATUS "tbb=" ${TBB})
+-    endif (NOT USE_TBB_SYSTEM_DEPS)
++    endif (NOT (USE_TBB_SYSTEM_DEPS OR USE_TBB_IN_HOUSE_STATIC_BUILD))
+ endif ()
+ if (ENABLE_OPENCV)
+diff --git a/inference-engine/cmake/ie_parallel.cmake b/inference-engine/cmake/ie_parallel.cmake
+index f8151a87..66b35dc7 100644
+--- a/inference-engine/cmake/ie_parallel.cmake
++++ b/inference-engine/cmake/ie_parallel.cmake
+@@ -40,6 +40,11 @@ function(set_ie_threading_interface_for TARGET_NAME)
+                     pkg_search_module(SYSTEM_TBB REQUIRED libtbb)
+                     set(incl_path ${SYSTEM_TBB_INCLUDE_DIRS})
+                     set(TBB_LIBRARIES_RELEASE ${SYSTEM_TBB_LIBRARIES})
++                elseif (USE_TBB_IN_HOUSE_STATIC_BUILD)
++                    message("USE_TBB_IN_HOUSE_STATIC_BUILD")
++                    message("IE_MAIN_SOURCE_DIR ${IE_MAIN_SOURCE_DIR}")
++                    find_path(TBB_INCLUDE_DIRS tbb/tbb.h ${USE_TBB_IN_HOUSE_STATIC_BUILD}/include NO_DEFAULT_PATH)
++                    find_library(TBB_LIBRARIES_RELEASE libtbb.a PATHS ${USE_TBB_IN_HOUSE_STATIC_BUILD}/lib NO_DEFAULT_PATH)
+                 else ()
+                     find_path(TBB_INCLUDE_DIRS tbb/tbb.h ${incl_path} NO_DEFAULT_PATH)
+                     find_library(TBB_LIBRARIES_RELEASE tbb ${lib_rel_path} NO_DEFAULT_PATH)
+-- 
+2.17.1
+
index 20c9319..59f3976 100644 (file)
@@ -2,3 +2,4 @@
 0002-CMake-Add-a-variable-to-resolve-dependency-on-TBB-us.patch
 0003-VPU-CMake-Add-a-cmake-option-to-skip-downloading-MVN.patch
 0004-IE-CMake-Disable-Werror-as-a-workaround.patch
+0005-CMake-Add-an-option-to-use-libtbb-in-the-given-direc.patch
index 1a6e456..1bf16f1 100755 (executable)
@@ -9,6 +9,10 @@ export DH_VERBOSE = 1
 
 EXTERNAL_ADE_ARCHIVE   := ade-cbe2db61a659c2cc304c3837406f95c39dfa938e
 EXTERNAL_NGRAPH_ARCHIVE :=  ngraph-0.22.0-rc.2
+EXTERNAL_TBB_ARCHIVE   := tbb_2019~U9
+EXTERNAL_TBB_SRC_ROOT  := $(SRC_ROOT)/inference-engine/temp/tbb
+EXTERNAL_TBB_SRC_PATCH0        := 0001-Local-Makefile-Skip-test-to-speed-up-the-build-time.patch
+EXTERNAL_DEVKIT_ROOT   := $(SRC_ROOT)/inference-engine/temp/out
 PREFIX :=      /usr
 LIBDIR :=      lib/${DEB_HOST_MULTIARCH}
 INCDIR :=      include
@@ -28,7 +32,23 @@ endif
 %:
        dh $@ --with quilt --parallel
 
-override_dh_auto_configure:
+prepare_tbb:
+       echo "Preparing tbb_2019~U9......"
+       rm -rf $(SRC_ROOT)/inference-engine/temp && mkdir -p $(SRC_ROOT)/inference-engine/temp
+       cp $(SRC_ROOT)/packaging/$(EXTERNAL_TBB_ARCHIVE).tar.gz $(SRC_ROOT)/inference-engine/temp
+       cd $(SRC_ROOT)/inference-engine/temp && tar zxvf $(EXTERNAL_TBB_ARCHIVE).tar.gz && rm -f *.tar.gz
+       cp $(SRC_ROOT)/debian/tbb_patches/*.patch $(EXTERNAL_TBB_SRC_ROOT)
+       patch -d $(EXTERNAL_TBB_SRC_ROOT) -p1 < $(EXTERNAL_TBB_SRC_ROOT)/$(EXTERNAL_TBB_SRC_PATCH0)
+       cd $(EXTERNAL_TBB_SRC_ROOT) && LDFLAGS="" $(MAKE) tbb_build_prefix=ubuntu_$(DEB_HOST_ARCH) extra_inc=big_iron.inc -j$(nproc)
+       mkdir -p $(EXTERNAL_DEVKIT_ROOT)
+       mkdir -p $(EXTERNAL_DEVKIT_ROOT)/include
+       mkdir -p $(EXTERNAL_DEVKIT_ROOT)/lib
+       cd $(SRC_ROOT)/inference-engine/temp/tbb/build/ubuntu_$(DEB_HOST_ARCH)_release && \
+               install -m 644 *.a $(EXTERNAL_DEVKIT_ROOT)/lib
+       cp -rf $(SRC_ROOT)/inference-engine/temp/tbb/include/tbb $(EXTERNAL_DEVKIT_ROOT)/include
+       echo "Done!"
+
+override_dh_auto_configure: prepare_tbb
        cp $(SRC_ROOT)/packaging/$(EXTERNAL_ADE_ARCHIVE).tar.gz $(SRC_ROOT)/inference-engine/thirdparty
        cp $(SRC_ROOT)/packaging/$(EXTERNAL_NGRAPH_ARCHIVE).tar.gz $(SRC_ROOT)/inference-engine/thirdparty
        cd $(SRC_ROOT)/inference-engine/thirdparty && \
@@ -48,7 +68,7 @@ override_dh_auto_configure:
                        -DLIB_INSTALL_DIR:PATH=$(LIBDIR) -DSYSCONF_INSTALL_DIR:PATH=$(SYSCONFDIR) \
                        -DSHARE_INSTALL_PREFIX:PATH=$(DATADIR) \
                        -DBUILD_SHARED_LIBS:BOOL=OFF -DENABLE_ALTERNATIVE_TEMP=OFF \
-                       -DUSE_TBB_SYSTEM_DEPS=ON -DUSE_MYRIAD_SYSTEM_DEPS=ON \
+                       -DUSE_TBB_IN_HOUSE_STATIC_BUILD:PATH=$(EXTERNAL_DEVKIT_ROOT) -DUSE_MYRIAD_SYSTEM_DEPS=ON \
                        -DENABLE_VPU=ON -DENABLE_MYRIAD=ON -DENABLE_MYRIAD_MVNC_TESTS=OFF -DENABLE_MYRIAD_NO_BOOT=OFF \
                        -DENABLE_MKL_DNN=$(ENABLE_MKL_DNN) -DENABLE_SSE42=$(ENABLE_SSE42) -DENABLE_GNA=OFF \
                        -DBUILD_ADE_DOCUMENTATION=OFF -DBUILD_ADE_TUTORIAL=OFF \
diff --git a/debian/tbb_patches/0001-Local-Makefile-Skip-test-to-speed-up-the-build-time.patch b/debian/tbb_patches/0001-Local-Makefile-Skip-test-to-speed-up-the-build-time.patch
new file mode 100644 (file)
index 0000000..f94757b
--- /dev/null
@@ -0,0 +1,59 @@
+From b19e0526ca977af625cf441ef489a887101de1cf Mon Sep 17 00:00:00 2001
+From: Wook Song <wook16.song@samsung.com>
+Date: Tue, 5 Jan 2021 13:20:15 +0900
+Subject: [PATCH 1/1] [Local/Makefile] Skip test to speed up the build time
+
+To speed up the build time, this patch modifies Makefile to skip the
+test cases.
+
+Change-Id: I4a8438e380a5cb3f039a117cb484043dea026bbf
+Signed-off-by: Wook Song <wook16.song@samsung.com>
+---
+ Makefile | 12 +++---------
+ 1 file changed, 3 insertions(+), 9 deletions(-)
+
+diff --git a/Makefile b/Makefile
+index 3603007..73ad8fc 100644
+--- a/Makefile
++++ b/Makefile
+@@ -14,7 +14,7 @@
+ tbb_root?=.
+ include $(tbb_root)/build/common.inc
+-.PHONY: default all tbb tbbmalloc tbbproxy test examples
++.PHONY: default all tbb tbbmalloc tbbproxy examples
+ #workaround for non-depend targets tbb and tbbmalloc which both depend on version_string.ver
+ #According to documentation, recursively invoked make commands can process their targets in parallel
+@@ -22,7 +22,7 @@ include $(tbb_root)/build/common.inc
+ default: tbb tbbmalloc $(if $(use_proxy),tbbproxy)
+-all: tbb tbbmalloc tbbproxy test examples
++all: tbb tbbmalloc tbbproxy examples
+ tbb: mkdir
+       $(MAKE) -C "$(work_dir)_debug"  -r -f $(tbb_root)/build/Makefile.tbb cfg=debug
+@@ -36,18 +36,12 @@ tbbproxy: mkdir
+       $(MAKE) -C "$(work_dir)_debug"  -r -f $(tbb_root)/build/Makefile.tbbproxy cfg=debug tbbproxy
+       $(MAKE) -C "$(work_dir)_release"  -r -f $(tbb_root)/build/Makefile.tbbproxy cfg=release tbbproxy
+-test: tbb tbbmalloc $(if $(use_proxy),tbbproxy)
+-      -$(MAKE) -C "$(work_dir)_debug"  -r -f $(tbb_root)/build/Makefile.tbbmalloc cfg=debug malloc_test
+-      -$(MAKE) -C "$(work_dir)_debug"  -r -f $(tbb_root)/build/Makefile.test cfg=debug
+-      -$(MAKE) -C "$(work_dir)_release"  -r -f $(tbb_root)/build/Makefile.tbbmalloc cfg=release malloc_test
+-      -$(MAKE) -C "$(work_dir)_release"  -r -f $(tbb_root)/build/Makefile.test cfg=release
+-
+ rml: mkdir
+       $(MAKE) -C "$(work_dir)_debug"  -r -f $(tbb_root)/build/Makefile.rml cfg=debug
+       $(MAKE) -C "$(work_dir)_release"  -r -f $(tbb_root)/build/Makefile.rml cfg=release
+ examples: tbb tbbmalloc
+-      $(MAKE) -C examples -r -f Makefile tbb_root=.. release test
++      $(MAKE) -C examples -r -f Makefile tbb_root=.. release
+ python: tbb
+       $(MAKE) -C "$(work_dir)_release" -rf $(tbb_root)/python/Makefile install
+-- 
+2.17.1
+
diff --git a/packaging/tbb_2019~U9.tar.gz b/packaging/tbb_2019~U9.tar.gz
new file mode 100644 (file)
index 0000000..bde4d95
Binary files /dev/null and b/packaging/tbb_2019~U9.tar.gz differ