Skip to contentSkip to conversation

TBB and OpenCV3

PATCH New Bradford Barr 3 participants 9 messages Sep 28, 2017 – Oct 12, 2017

lore
Share & tools
lore
#0 lore raw

v2 cover TBB and OpenCV3

From: bradford barr <[email protected]>

Updated patches for tbb and tbb support in opencv3. The tbb build system isn't very friendly to cross compiling. The `arch=$(BR2_ARCH)' is mostly used by the build system to generate a build directory.

I pulled in the 0001-cross-compile.patch from yocto and added a signed-off by. I hope that's right.

Running test-pkg against tbb helped me figure out that pretty much everything that uses glibc will compile cleanly.

The tbb package only supplies dynamic libraries, no static libraries. It also does not create symlinks for the its libraries, those had to be generated manually.

The `0001-tbb-debug.patch' for opencv3 has been submitted upstream. and can be found here[1].

I hope I didn't miss anything this time around.

[1]: https://github.com/opencv/opencv/pull/9743

bradford barr (2):
tbb: new package
opencv3: add support for tbb

 package/Config.in                    |  1 +
 package/opencv3/0001-tbb-debug.patch | 27 +++++++++++++++++++
 package/opencv3/Config.in            |  6 +++++
 package/opencv3/opencv3.mk           | 12 +++++++--
 package/tbb/0001-cross-compile.patch | 41 +++++++++++++++++++++++++++++
 package/tbb/Config.in                | 16 ++++++++++++
 package/tbb/tbb.hash                 |  2 ++
 package/tbb/tbb.mk                   | 50 ++++++++++++++++++++++++++++++++++++
 8 files changed, 153 insertions(+), 2 deletions(-)
 create mode 100644 package/opencv3/0001-tbb-debug.patch
 create mode 100644 package/tbb/0001-cross-compile.patch
 create mode 100644 package/tbb/Config.in
 create mode 100644 package/tbb/tbb.hash
 create mode 100644 package/tbb/tbb.mk
Signature · 1 line
2.9.3
#1 lore raw

PATCH v2 1/2 tbb: new package

From: bradford barr <[email protected]>

Intel Threading Building Blocks (TBB), is a C++ library to help developers write highly parallelized applications. OpenCV uses it to accelerate some of it's more heavy weight procedures.

---
 package/Config.in                    |  1 +
 package/tbb/0001-cross-compile.patch | 41 +++++++++++++++++++++++++++++
 package/tbb/Config.in                | 16 ++++++++++++
 package/tbb/tbb.hash                 |  2 ++
 package/tbb/tbb.mk                   | 50 ++++++++++++++++++++++++++++++++++++
 5 files changed, 110 insertions(+)
 create mode 100644 package/tbb/0001-cross-compile.patch
 create mode 100644 package/tbb/Config.in
 create mode 100644 package/tbb/tbb.hash
 create mode 100644 package/tbb/tbb.mk
package/Config.in +1 -0
index 1580a9e..7ea362e 100644
@@ -1504,6 +1504,7 @@ endif
 	source "package/skalibs/Config.in"
 	source "package/sphinxbase/Config.in"
 	source "package/startup-notification/Config.in"
+	source "package/tbb/Config.in"
 	source "package/tinycbor/Config.in"
 	source "package/tz/Config.in"
 	source "package/tzdata/Config.in"
package/tbb/0001-cross-compile.patch new file +41 -0

41 lines not on this page · raw message

package/tbb/Config.in new file +16 -0
new file mode 100644
index 0000000..eda1f09
@@ -0,0 +1,16 @@
+config BR2_PACKAGE_TBB
+	bool "tbb"
+	depends on !BR2_STATIC_LIBS
+	depends on BR2_INSTALL_LIBSTDCPP
+	depends on BR2_TOOLCHAIN_HAS_THREADS
+	depends on BR2_TOOLCHAIN_USES_GLIBC
+	help
+	  Intel(R) Threading Building Blocks (Intel(R) TBB) lets you
+	  easily write parallel C++ programs that take full advantage
+	  of multicore performance, that are portable, composable and
+	  have future-proof scalability.
+
+	  https://www.threadingbuildingblocks.org/
+
+comment "tbb needs a toolchain w/ threads"
+	depends on !BR2_TOOLCHAIN_HAS_THREADS
package/tbb/tbb.hash new file +2 -0
new file mode 100644
index 0000000..2a3cd6e
@@ -0,0 +1,2 @@
+# Locally calculated
+sha256  c6462217d4ecef2b44fce63cfdf31f9db4f6ff493869899d497a5aef68b05fc5  tbb-2018_U1.tar.gz
package/tbb/tbb.mk new file +50 -0

50 lines not on this page · raw message

Signature · 1 line
2.9.3
#2 lore raw

PATCH v2 1/2 tbb: new package

Hi Bradford,

Quoted 6 lines · Bradford Barr

From: bradford barr <[email protected]>

Intel Threading Building Blocks (TBB), is a C++ library to help developers write highly parallelized applications. OpenCV uses it to accelerate some of it's more heavy weight procedures.

Quoted 7 lines
---
 package/Config.in                    |  1 +
 package/tbb/0001-cross-compile.patch | 41 +++++++++++++++++++++++++++++
 package/tbb/Config.in                | 16 ++++++++++++
 package/tbb/tbb.hash                 |  2 ++
 package/tbb/tbb.mk                   | 50 ++++++++++++++++++++++++++++++++++++

DEVELOPERS file entry missing.

Yegor

Quoted 158 lines
 5 files changed, 110 insertions(+)
 create mode 100644 package/tbb/0001-cross-compile.patch
 create mode 100644 package/tbb/Config.in
 create mode 100644 package/tbb/tbb.hash
 create mode 100644 package/tbb/tbb.mk
package/Config.in +1 -0
index 1580a9e..7ea362e 100644
@@ -1504,6 +1504,7 @@ endif
        source "package/skalibs/Config.in"
        source "package/sphinxbase/Config.in"
        source "package/startup-notification/Config.in"
+       source "package/tbb/Config.in"
        source "package/tinycbor/Config.in"
        source "package/tz/Config.in"
        source "package/tzdata/Config.in"
package/tbb/0001-cross-compile.patch new file +41 -0
new file mode 100644
index 0000000..7c57603
@@ -0,0 +1,41 @@
+Author: Marcin Juszkiewicz <[email protected]>
+
+Upstream-Status: unsuitable
+
+Signed-off-by: bradford barr <[email protected]>
+---
+ build/linux.gcc.inc |    5 +++--
+ 1 file changed, 3 insertions(+), 2 deletions(-)
+
+Index: tbb2017_20170118oss/build/linux.gcc.inc
+===================================================================
+--- tbb2017_20170118oss.orig/build/linux.gcc.inc
++++ tbb2017_20170118oss/build/linux.gcc.inc
+@@ -32,8 +32,9 @@ DYLIB_KEY = -shared
+ EXPORT_KEY = -Wl,--version-script,
+ LIBDL = -ldl
+
+-CPLUS = g++
+-CONLY = gcc
++CPLUS = $(CXX)
++CONLY = $(CC)
++CPLUS_FLAGS = $(CXXFLAGS)
+ LIB_LINK_FLAGS = $(DYLIB_KEY) -Wl,-soname=$(BUILDING_LIBRARY)
+ LIBS += -lpthread -lrt
+ LINK_FLAGS = -Wl,-rpath-link=. -rdynamic
+Index: tbb2017_20170118oss/build/linux.clang.inc
+===================================================================
+--- tbb2017_20170118oss.orig/build/linux.clang.inc
++++ tbb2017_20170118oss/build/linux.clang.inc
+@@ -31,8 +31,9 @@ DYLIB_KEY = -shared
+ EXPORT_KEY = -Wl,--version-script,
+ LIBDL = -ldl
+
+-CPLUS = clang++
+-CONLY = clang
++CPLUS = $(CXX)
++CONLY = $(CC)
++CPLUS_FLAGS = $(CXXFLAGS)
+ LIB_LINK_FLAGS = $(DYLIB_KEY) -Wl,-soname=$(BUILDING_LIBRARY)
+ LIBS += -lpthread -lrt
+ LINK_FLAGS = -Wl,-rpath-link=. -rdynamic
package/tbb/Config.in new file +16 -0
new file mode 100644
index 0000000..eda1f09
@@ -0,0 +1,16 @@
+config BR2_PACKAGE_TBB
+       bool "tbb"
+       depends on !BR2_STATIC_LIBS
+       depends on BR2_INSTALL_LIBSTDCPP
+       depends on BR2_TOOLCHAIN_HAS_THREADS
+       depends on BR2_TOOLCHAIN_USES_GLIBC
+       help
+         Intel(R) Threading Building Blocks (Intel(R) TBB) lets you
+         easily write parallel C++ programs that take full advantage
+         of multicore performance, that are portable, composable and
+         have future-proof scalability.
+
+         https://www.threadingbuildingblocks.org/
+
+comment "tbb needs a toolchain w/ threads"
+       depends on !BR2_TOOLCHAIN_HAS_THREADS
package/tbb/tbb.hash new file +2 -0
new file mode 100644
index 0000000..2a3cd6e
@@ -0,0 +1,2 @@
+# Locally calculated
+sha256  c6462217d4ecef2b44fce63cfdf31f9db4f6ff493869899d497a5aef68b05fc5  tbb-2018_U1.tar.gz
package/tbb/tbb.mk new file +50 -1
new file mode 100644
index 0000000..ad94a27
@@ -0,0 +1,50 @@
+################################################################################
+#
+# tbb
+#
+################################################################################
+
+TBB_VERSION = 2018_U1
+TBB_SITE = $(call github,01org,tbb,$(TBB_VERSION))
+TBB_INSTALL_STAGING = YES
+TBB_LICENSE = Apache-2.0
+TBB_LICENSE_FILES = LICENSE
+
+TBB_SO_VERSION = 2
+TBB_LIBS = libtbb libtbbmalloc libtbbmalloc_proxy
+
+ifeq ($(BR2_ENABLE_DEBUG),y)
+TBB_BIN_PATH = $(@D)/build/linux_*_debug
+else
+TBB_BIN_PATH = $(@D)/build/linux_*_release
+endif
+
+define TBB_BUILD_CMDS
+       $(MAKE) $(TARGET_CONFIGURE_OPTS) arch=$(BR2_ARCH) -C $(@D)
+endef
+
+define TBB_INSTALL_LIBS
+       $(foreach lib,$(TBB_LIBS),
+               $(if $(BR2_ENABLE_DEBUG),
+                       $(INSTALL) -D -m 0755 $(TBB_BIN_PATH)/$(lib)_debug.so.$(TBB_SO_VERSION) \
+                               $(1)/usr/lib/$(lib)_debug.so.$(TBB_SO_VERSION) ;
+                       ln -sf $(lib)_debug.so.$(TBB_SO_VERSION) $(1)/usr/lib/$(lib)_debug.so
+               ,
+                       $(INSTALL) -D -m 0755 $(TBB_BIN_PATH)/$(lib).so.$(TBB_SO_VERSION) \
+                               $(1)/usr/lib/$(lib).so.$(TBB_SO_VERSION) ;
+                       ln -sf $(lib).so.$(TBB_SO_VERSION) $(1)/usr/lib/$(lib).so
+               )
+       )
+endef
+
+define TBB_INSTALL_STAGING_CMDS
+       mkdir -p $(STAGING_DIR)/usr/include/tbb
+       cp -a $(@D)/include/* $(STAGING_DIR)/usr/include/tbb
+       $(call TBB_INSTALL_LIBS,$(STAGING_DIR))
+endef
+
+define TBB_INSTALL_TARGET_CMDS
+       $(call TBB_INSTALL_LIBS,$(TARGET_DIR))
+endef
+
+$(eval $(generic-package))
--

2.9.3

_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot

#3 lore raw

PATCH v2 1/2 tbb: new package

In reply to Bradford Barr

Hello,

package/tbb/0001-cross-compile.patch line 1

Quoted 7 lines · Bradford Barr
package/tbb/0001-cross-compile.patch new file +1 -0
new file mode 100644
index 0000000..7c57603
@@ -0,0 +1,41 @@
+Author: Marcin Juszkiewicz <[email protected]>

This patch should be Git formatted and have a proper commit title and description.

Quoted 12 lines
package/tbb/Config.in new file +6 -0
new file mode 100644
index 0000000..eda1f09
@@ -0,0 +1,16 @@
+config BR2_PACKAGE_TBB
+	bool "tbb"
+	depends on !BR2_STATIC_LIBS
+	depends on BR2_INSTALL_LIBSTDCPP
+	depends on BR2_TOOLCHAIN_HAS_THREADS
+	depends on BR2_TOOLCHAIN_USES_GLIBC

package/tbb/Config.in line 16

Quoted 10 lines
package/tbb/Config.in new file +10 -0
+	help
+	  Intel(R) Threading Building Blocks (Intel(R) TBB) lets you
+	  easily write parallel C++ programs that take full advantage
+	  of multicore performance, that are portable, composable and
+	  have future-proof scalability.
+
+	  https://www.threadingbuildingblocks.org/
+
+comment "tbb needs a toolchain w/ threads"
+	depends on !BR2_TOOLCHAIN_HAS_THREADS

This comment is not in sync with the dependencies of the package: C++, dynamic library, glibc.

package/tbb/Config.in

Quoted 8 lines
package/tbb/Config.in new file +8 -0
+TBB_SO_VERSION = 2
+TBB_LIBS = libtbb libtbbmalloc libtbbmalloc_proxy
+
+ifeq ($(BR2_ENABLE_DEBUG),y)
+TBB_BIN_PATH = $(@D)/build/linux_*_debug
+else
+TBB_BIN_PATH = $(@D)/build/linux_*_release
+endif

What is the difference between the debug and release builds? In general, we don't want to special case BR2_ENABLE_DEBUG in packages, as we only want this to enable building with debugging symbols, and nothing else. We used to handle BR2_ENABLE_DEBUG in lots of packages and got rid of that a while ago, so I don't want to get back to this.

package/tbb/Config.in

Quoted 6 lines
package/tbb/Config.in new file +6 -0
+define TBB_INSTALL_LIBS
+	$(foreach lib,$(TBB_LIBS),
+		$(if $(BR2_ENABLE_DEBUG),
+			$(INSTALL) -D -m 0755 $(TBB_BIN_PATH)/$(lib)_debug.so.$(TBB_SO_VERSION) \
+				$(1)/usr/lib/$(lib)_debug.so.$(TBB_SO_VERSION) ;
+			ln -sf $(lib)_debug.so.$(TBB_SO_VERSION) $(1)/usr/lib/$(lib)_debug.so

And this looks particularly painful here because the library doesn't even have the same name on the filesystem depending on whether you're doing a debug or a normal build. Clearly not good.

package/tbb/Config.in

Quoted 7 lines
package/tbb/Config.in new file +7 -0
+		,
+			$(INSTALL) -D -m 0755 $(TBB_BIN_PATH)/$(lib).so.$(TBB_SO_VERSION) \
+				$(1)/usr/lib/$(lib).so.$(TBB_SO_VERSION) ;
+			ln -sf $(lib).so.$(TBB_SO_VERSION) $(1)/usr/lib/$(lib).so
+		)
+	)
+endef

So unless you need it, I'd say drop the support for BR2_ENABLE_DEBUG altogether.

Thanks!

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
#4 lore raw

PATCH v2 1/2 tbb: new package

Thanks for your comments.

Quoted 4 lines · Thomas Petazzoni

Hello,

On Thu, 28 Sep 2017 19:50:42 -0400, Bradford Barr wrote:

Quoted 11 lines

package/tbb/0001-cross-compile.patch line 1

Quoted 7 lines
package/tbb/0001-cross-compile.patch new file +1 -0
new file mode 100644
index 0000000..7c57603
@@ -0,0 +1,41 @@
+Author: Marcin Juszkiewicz <[email protected]>

This patch should be Git formatted and have a proper commit title and description.

As I lifted that patch from Yocto I thought it would be alright. I'll reformat and change the commit title and message.

Quoted 18 lines
Quoted 18 lines
package/tbb/Config.in new file +11 -0
new file mode 100644
index 0000000..eda1f09
@@ -0,0 +1,16 @@
+config BR2_PACKAGE_TBB
+     bool "tbb"
+     depends on !BR2_STATIC_LIBS
+     depends on BR2_INSTALL_LIBSTDCPP
+     depends on BR2_TOOLCHAIN_HAS_THREADS
+     depends on BR2_TOOLCHAIN_USES_GLIBC
+     help
+       Intel(R) Threading Building Blocks (Intel(R) TBB) lets you
+       easily write parallel C++ programs that take full advantage
+       of multicore performance, that are portable, composable and
+       have future-proof scalability.
Quoted 9 lines

package/tbb/Config.in line 16

Quoted 5 lines
package/tbb/Config.in new file +5 -0
+
+       https://www.threadingbuildingblocks.org/
+
+comment "tbb needs a toolchain w/ threads"
+     depends on !BR2_TOOLCHAIN_HAS_THREADS

This comment is not in sync with the dependencies of the package: C++, dynamic library, glibc.

Would it be better if I added all the depends from above as part of this comment?
Or should I just remove the comment altogether?

Quoted 15 lines

package/tbb/Config.in

Quoted 9 lines
package/tbb/Config.in new file +8 -0
+TBB_SO_VERSION = 2
+TBB_LIBS = libtbb libtbbmalloc libtbbmalloc_proxy
+
+ifeq ($(BR2_ENABLE_DEBUG),y)
+TBB_BIN_PATH = $(@D)/build/linux_*_debug
+else
+TBB_BIN_PATH = $(@D)/build/linux_*_release
+endif

What is the difference between the debug and release builds? In general, we don't want to special case BR2_ENABLE_DEBUG in packages, as we only want this to enable building with debugging symbols, and nothing else. We used to handle BR2_ENABLE_DEBUG in lots of packages and got rid of that a while ago, so I don't want to get back to this.

Makes sense.

Quoted 20 lines

package/tbb/Config.in

Quoted 7 lines
package/tbb/Config.in new file +6 -0
+define TBB_INSTALL_LIBS
+     $(foreach lib,$(TBB_LIBS),
+             $(if $(BR2_ENABLE_DEBUG),
+                     $(INSTALL) -D -m 0755 $(TBB_BIN_PATH)/$(lib)_debug.so.$(TBB_SO_VERSION) \
+                             $(1)/usr/lib/$(lib)_debug.so.$(TBB_SO_VERSION) ;
+                     ln -sf $(lib)_debug.so.$(TBB_SO_VERSION) $(1)/usr/lib/$(lib)_debug.so

And this looks particularly painful here because the library doesn't even have the same name on the filesystem depending on whether you're doing a debug or a normal build. Clearly not good.

package/tbb/Config.in

Quoted 7 lines
package/tbb/Config.in new file +7 -0
+             ,
+                     $(INSTALL) -D -m 0755 $(TBB_BIN_PATH)/$(lib).so.$(TBB_SO_VERSION) \
+                             $(1)/usr/lib/$(lib).so.$(TBB_SO_VERSION) ;
+                     ln -sf $(lib).so.$(TBB_SO_VERSION) $(1)/usr/lib/$(lib).so
+             )
+     )
+endef
Quoted 2 lines

So unless you need it, I'd say drop the support for BR2_ENABLE_DEBUG altogether.

I kept the BR2_ENABLE_DEBUG support because when opencv3 is build with BR2_ENABLE_DEBUG
it looks for libtbb_debug.so, and not libtbb.so; I'm not sure that's a good enough reason to keep it.

I could patch opencv3 to look for libtbb.so even when it's compiling with debug. Thoughts?

Quoted 8 lines

Thanks!

Thomas
--
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com

#5 lore raw

PATCH v2 1/2 tbb: new package

Quoted 96 lines · Bradford Barr

Thanks for your comments.

Quoted 4 lines · Thomas Petazzoni

Hello,

On Thu, 28 Sep 2017 19:50:42 -0400, Bradford Barr wrote:

Quoted 11 lines

package/tbb/0001-cross-compile.patch line 1

Quoted 7 lines
package/tbb/0001-cross-compile.patch new file +1 -0
new file mode 100644
index 0000000..7c57603
@@ -0,0 +1,41 @@
+Author: Marcin Juszkiewicz <[email protected]>

This patch should be Git formatted and have a proper commit title and description.

As I lifted that patch from Yocto I thought it would be alright. I'll reformat and change the commit title and message.

Quoted 18 lines
Quoted 18 lines
package/tbb/Config.in new file +11 -0
new file mode 100644
index 0000000..eda1f09
@@ -0,0 +1,16 @@
+config BR2_PACKAGE_TBB
+     bool "tbb"
+     depends on !BR2_STATIC_LIBS
+     depends on BR2_INSTALL_LIBSTDCPP
+     depends on BR2_TOOLCHAIN_HAS_THREADS
+     depends on BR2_TOOLCHAIN_USES_GLIBC
+     help
+       Intel(R) Threading Building Blocks (Intel(R) TBB) lets you
+       easily write parallel C++ programs that take full advantage
+       of multicore performance, that are portable, composable and
+       have future-proof scalability.
Quoted 9 lines

package/tbb/Config.in line 16

Quoted 5 lines
package/tbb/Config.in new file +5 -0
+
+       https://www.threadingbuildingblocks.org/
+
+comment "tbb needs a toolchain w/ threads"
+     depends on !BR2_TOOLCHAIN_HAS_THREADS

This comment is not in sync with the dependencies of the package: C++, dynamic library, glibc.

Would it be better if I added all the depends from above as part of this comment?
Or should I just remove the comment altogether?

Quoted 15 lines

package/tbb/Config.in

Quoted 9 lines
package/tbb/Config.in new file +8 -0
+TBB_SO_VERSION = 2
+TBB_LIBS = libtbb libtbbmalloc libtbbmalloc_proxy
+
+ifeq ($(BR2_ENABLE_DEBUG),y)
+TBB_BIN_PATH = $(@D)/build/linux_*_debug
+else
+TBB_BIN_PATH = $(@D)/build/linux_*_release
+endif

What is the difference between the debug and release builds? In general, we don't want to special case BR2_ENABLE_DEBUG in packages, as we only want this to enable building with debugging symbols, and nothing else. We used to handle BR2_ENABLE_DEBUG in lots of packages and got rid of that a while ago, so I don't want to get back to this.

Makes sense.

Quoted 20 lines

package/tbb/Config.in

Quoted 7 lines
package/tbb/Config.in new file +6 -0
+define TBB_INSTALL_LIBS
+     $(foreach lib,$(TBB_LIBS),
+             $(if $(BR2_ENABLE_DEBUG),
+                     $(INSTALL) -D -m 0755 $(TBB_BIN_PATH)/$(lib)_debug.so.$(TBB_SO_VERSION) \
+                             $(1)/usr/lib/$(lib)_debug.so.$(TBB_SO_VERSION) ;
+                     ln -sf $(lib)_debug.so.$(TBB_SO_VERSION) $(1)/usr/lib/$(lib)_debug.so

And this looks particularly painful here because the library doesn't even have the same name on the filesystem depending on whether you're doing a debug or a normal build. Clearly not good.

package/tbb/Config.in

Quoted 7 lines
package/tbb/Config.in new file +7 -0
+             ,
+                     $(INSTALL) -D -m 0755 $(TBB_BIN_PATH)/$(lib).so.$(TBB_SO_VERSION) \
+                             $(1)/usr/lib/$(lib).so.$(TBB_SO_VERSION) ;
+                     ln -sf $(lib).so.$(TBB_SO_VERSION) $(1)/usr/lib/$(lib).so
+             )
+     )
+endef
Quoted 2 lines

So unless you need it, I'd say drop the support for BR2_ENABLE_DEBUG altogether.

Quoted 7 lines

I kept the BR2_ENABLE_DEBUG support because when opencv3 is build with BR2_ENABLE_DEBUG
it looks for libtbb_debug.so, and not libtbb.so; I'm not sure that's a good enough reason to keep it.

I could patch opencv3 to look for libtbb.so even when it's compiling with debug. Thoughts?

Bah, I misremembered why I did this. I'll remove the BR2_ENABLE_DEBUG stuff and resubmit.

Quoted 8 lines
Quoted 8 lines

Thanks!

Thomas
--
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com

#6 lore raw

PATCH v2 1/2 tbb: new package

In reply to Bradford Barr

Hello,

Quoted 5 lines · Bradford Barr
Quoted 2 lines

This patch should be Git formatted and have a proper commit title and description.

As I lifted that patch from Yocto I thought it would be alright. I'll reformat and change the commit title and message.

We have stricter requirements than Yocto :)

Quoted 6 lines
Quoted 3 lines

This comment is not in sync with the dependencies of the package: C++, dynamic library, glibc.

Would it be better if I added all the depends from above as part of this comment?

You must document all the dependencies in the Config.in comment. See the Buildroot manual about this.

Best regards,

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
#7 lore raw

PATCH v2 2/2 opencv3: add support for tbb

In reply to Bradford Barr

From: bradford barr <[email protected]>

This patchset adds support for tbb optimizations in opencv3.

---
 package/opencv3/0001-tbb-debug.patch | 27 +++++++++++++++++++++++++++
 package/opencv3/Config.in            |  6 ++++++
 package/opencv3/opencv3.mk           | 12 ++++++++++--
 3 files changed, 43 insertions(+), 2 deletions(-)
 create mode 100644 package/opencv3/0001-tbb-debug.patch
package/opencv3/0001-tbb-debug.patch new file +27 -0
new file mode 100644
index 0000000..808483d
@@ -0,0 +1,27 @@
+From a56d7592f0f2f63a84e2159171a784026cc99986 Mon Sep 17 00:00:00 2001
+From: bradford barr <[email protected]>
+Date: Thu, 28 Sep 2017 17:31:41 -0400
+Subject: [PATCH] TBB Debug Release
+
+OpenCV fails to detect tbb on a debug build if the platform has only installed
+debug libraries.  This PR adds an additional check to the tbb detect logic for
+systems that only install tbb debug and not both tbb debug and release.
+
+Signed-off-by: bradford barr <[email protected]>
+---
+ cmake/OpenCVDetectTBB.cmake | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/cmake/OpenCVDetectTBB.cmake b/cmake/OpenCVDetectTBB.cmake
+index 426487a88cc..9417a53dd98 100644
+--- a/cmake/OpenCVDetectTBB.cmake
++++ b/cmake/OpenCVDetectTBB.cmake
+@@ -45,7 +45,7 @@ function(ocv_tbb_env_guess _found)
+   find_library(TBB_ENV_LIB NAMES "tbb")
+   find_library(TBB_ENV_LIB_DEBUG NAMES "tbb_debug" PATHS ENV LIBRARY_PATH ENV LD_LIBRARY_PATH NO_DEFAULT_PATH)
+   find_library(TBB_ENV_LIB_DEBUG NAMES "tbb_debug")
+-  if (TBB_ENV_INCLUDE AND TBB_ENV_LIB)
++  if (TBB_ENV_INCLUDE AND (TBB_ENV_LIB OR TBB_ENV_LIB_DEBUG))
+     ocv_tbb_verify()
+     ocv_tbb_read_version("${TBB_ENV_INCLUDE}")
+     add_library(tbb UNKNOWN IMPORTED)
package/opencv3/Config.in +6 -0
index 2214ee8..07613e8 100644
@@ -307,6 +307,12 @@ config BR2_PACKAGE_OPENCV3_WITH_PNG
 	help
 	  Use shared libpng from the target system.
 
+config BR2_PACKAGE_OPENCV3_WITH_TBB
+	bool "tbb support"
+	select BR2_PACKAGE_TBB
+	help
+	  Use build libtbb from OpenCV3.
+
 config BR2_PACKAGE_OPENCV3_WITH_TIFF
 	bool "tiff support"
 	select BR2_PACKAGE_TIFF
package/opencv3/opencv3.mk +10 -2
index 3a7c3f4..1b3de46 100644
@@ -133,8 +133,7 @@ OPENCV3_CONF_OPTS += \
 	-DBUILD_WITH_DYNAMIC_IPP=OFF \
 	-DWITH_INTELPERC=OFF \
 	-DWITH_IPP=OFF \
-	-DWITH_IPP_A=OFF \
-	-DWITH_TBB=OFF
+	-DWITH_IPP_A=OFF
 
 # Smartek stuff
 OPENCV3_CONF_OPTS += -DWITH_GIGEAPI=OFF
@@ -288,6 +287,15 @@ OPENCV3_CONF_OPTS += -DWITH_QT=5
 OPENCV3_DEPENDENCIES += qt5base
 endif
 
+ifeq ($(BR2_PACKAGE_OPENCV3_WITH_TBB),y)
+OPENCV3_CONF_OPTS += \
+	-DWITH_TBB=ON \
+	-DTBB_ENV_INCLUDE=$(STAGING_DIR)/usr/include/tbb
+OPENCV3_DEPENDENCIES += tbb
+else
+OPENCV3_CONF_OPTS += -DWITH_TBB=OFF
+endif
+
 ifeq ($(BR2_PACKAGE_OPENCV3_WITH_TIFF),y)
 OPENCV3_CONF_OPTS += -DWITH_TIFF=ON
 OPENCV3_DEPENDENCIES += tiff
Signature · 1 line
2.9.3
#8 lore raw

PATCH v2 2/2 opencv3: add support for tbb

Hello,

Quoted 6 lines · Bradford Barr
package/opencv3/0001-tbb-debug.patch new file +0 -0
new file mode 100644
index 0000000..808483d

package/opencv3/0001-tbb-debug.patch line 8

Quoted 8 lines
package/opencv3/0001-tbb-debug.patch new file +8 -0
@@ -0,0 +1,27 @@
+From a56d7592f0f2f63a84e2159171a784026cc99986 Mon Sep 17 00:00:00 2001
+From: bradford barr <[email protected]>
+Date: Thu, 28 Sep 2017 17:31:41 -0400
+Subject: [PATCH] TBB Debug Release
+
+OpenCV fails to detect tbb on a debug build if the platform has only installed
+debug libraries.  This PR adds an additional check to the tbb detect logic for
+systems that only install tbb debug and not both tbb debug and release.

This would be unnecessary if you drop the "debug" support in the tbb package.

package/opencv3/0001-tbb-debug.patch line 11

Quoted 3 lines
package/opencv3/0001-tbb-debug.patch new file +3 -0
+config BR2_PACKAGE_OPENCV3_WITH_TBB
+	bool "tbb support"
+	select BR2_PACKAGE_TBB

You forgot to propagate the dependencies of tbb here (and don't forget to add the corresponding Config.in comment).

Otherwise, looks good to me.

Thanks!

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com