Skip to contentSkip to conversation

package/opencv3: use BR2_TOOLCHAIN_HAS_LIBATOMIC

PATCH New Bernd Kuhls 3 participants 7 messages Sep 5, 2016 – Sep 6, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 package/opencv3: use BR2_TOOLCHAIN_HAS_LIBATOMIC

It uses __atomic_fetch_add_4 so libatomic must be pulled in if necessary. Fixes
http://autobuild.buildroot.net/results/652/6521223b426c3cb4dfefab27bc6021900db6910e/

---
 package/opencv3/Config.in  | 2 ++
 package/opencv3/opencv3.mk | 5 +++++
 2 files changed, 7 insertions(+)
package/opencv3/Config.in +2 -0
index 2f4aa7a..4c00bf1 100644
@@ -1,6 +1,7 @@
 menuconfig BR2_PACKAGE_OPENCV3
 	bool "opencv3"
 	select BR2_PACKAGE_ZLIB
+	depends on BR2_TOOLCHAIN_HAS_ATOMIC
 	depends on BR2_TOOLCHAIN_HAS_THREADS_NPTL
 	depends on BR2_INSTALL_LIBSTDCPP
 	depends on BR2_USE_WCHAR
@@ -335,6 +336,7 @@ config BR2_PACKAGE_OPENCV3_INSTALL_DATA
 endif # BR2_PACKAGE_OPENCV3
 
 comment "opencv3 needs a toolchain w/ C++, NPTL, wchar, dynamic library"
+	depends on BR2_TOOLCHAIN_HAS_ATOMIC
 	depends on !BR2_INSTALL_LIBSTDCPP || \
 		!BR2_USE_WCHAR || \
 		!BR2_TOOLCHAIN_HAS_THREADS_NPTL || \
package/opencv3/opencv3.mk +5 -0
index 91cdfe6..2529de9 100644
@@ -10,6 +10,11 @@ OPENCV3_INSTALL_STAGING = YES
 OPENCV3_LICENSE = BSD-3c
 OPENCV3_LICENSE_FILES = LICENSE
 
+# Uses __atomic_fetch_add_4
+ifeq ($(BR2_TOOLCHAIN_HAS_LIBATOMIC),y)
+OPENCV3_CONF_OPTS += -DCMAKE_CXX_FLAGS="-latomic"
+endif
+
 # OpenCV component options
 OPENCV3_CONF_OPTS += \
 	-DBUILD_DOCS=OFF \
Signature · 1 line
2.9.3
#1 lore raw

PATCH 1/1 package/opencv3: use BR2_TOOLCHAIN_HAS_LIBATOMIC

Hi Bernd, all,

Quoted 35 lines · Bernd Kuhls

It uses __atomic_fetch_add_4 so libatomic must be pulled in if necessary. Fixes
http://autobuild.buildroot.net/results/652/6521223b426c3cb4dfefab27bc6021900db6910e/

---
 package/opencv3/Config.in  | 2 ++
 package/opencv3/opencv3.mk | 5 +++++
 2 files changed, 7 insertions(+)
package/opencv3/Config.in +2 -0
index 2f4aa7a..4c00bf1 100644
@@ -1,6 +1,7 @@
 menuconfig BR2_PACKAGE_OPENCV3
        bool "opencv3"
        select BR2_PACKAGE_ZLIB
+       depends on BR2_TOOLCHAIN_HAS_ATOMIC
        depends on BR2_TOOLCHAIN_HAS_THREADS_NPTL
        depends on BR2_INSTALL_LIBSTDCPP
        depends on BR2_USE_WCHAR
@@ -335,6 +336,7 @@ config BR2_PACKAGE_OPENCV3_INSTALL_DATA
 endif # BR2_PACKAGE_OPENCV3
 
 comment "opencv3 needs a toolchain w/ C++, NPTL, wchar, dynamic library"
+       depends on BR2_TOOLCHAIN_HAS_ATOMIC
        depends on !BR2_INSTALL_LIBSTDCPP || \
                !BR2_USE_WCHAR || \
                !BR2_TOOLCHAIN_HAS_THREADS_NPTL || \
package/opencv3/opencv3.mk +0 -0
index 91cdfe6..2529de9 100644

package/opencv3/opencv3.mk OPENCV3_INSTALL_STAGING = YES · line 16

Quoted 7 lines
package/opencv3/opencv3.mk +4 -0
@@ -10,6 +10,11 @@ OPENCV3_INSTALL_STAGING = YES
 OPENCV3_LICENSE = BSD-3c
 OPENCV3_LICENSE_FILES = LICENSE
 
+# Uses __atomic_fetch_add_4
+ifeq ($(BR2_TOOLCHAIN_HAS_LIBATOMIC),y)
+OPENCV3_CONF_OPTS += -DCMAKE_CXX_FLAGS="-latomic"
+endif

Since you add the dependency on BR2_TOOLCHAIN_HAS_ATOMIC in the Config.in, I wonder whether nested conf. opts. update in a if-block that will always be true is really necessary...

Quoted 11 lines
package/opencv3/opencv3.mk +1 -1
+
 # OpenCV component options
 OPENCV3_CONF_OPTS += \
        -DBUILD_DOCS=OFF \
--

2.9.3

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

Regards,

Signature · 1 line
Samuel
#2 lore raw

PATCH 1/1 package/opencv3: use BR2_TOOLCHAIN_HAS_LIBATOMIC

Hello,

Quoted 8 lines · Samuel Martin

package/opencv3/opencv3.mk OPENCV3_INSTALL_STAGING = YES · line 16

Quoted 4 lines
package/opencv3/opencv3.mk +4 -0
+# Uses __atomic_fetch_add_4
+ifeq ($(BR2_TOOLCHAIN_HAS_LIBATOMIC),y)
+OPENCV3_CONF_OPTS += -DCMAKE_CXX_FLAGS="-latomic"
+endif  

Since you add the dependency on BR2_TOOLCHAIN_HAS_ATOMIC in the Config.in, I wonder whether nested conf. opts. update in a if-block that will always be true is really necessary...

You're confusing BR2_TOOLCHAIN_HAS_ATOMIC with BR2_TOOLCHAIN_HAS_LIBATOMIC. There's a subtle difference :)

Thomas

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

PATCH 1/1 package/opencv3: use BR2_TOOLCHAIN_HAS_LIBATOMIC

Quoted 13 lines · Thomas Petazzoni

Hello,

Quoted 8 lines · Samuel Martin

package/opencv3/opencv3.mk OPENCV3_INSTALL_STAGING = YES · line 16

Quoted 4 lines
package/opencv3/opencv3.mk +4 -0
+# Uses __atomic_fetch_add_4
+ifeq ($(BR2_TOOLCHAIN_HAS_LIBATOMIC),y)
+OPENCV3_CONF_OPTS += -DCMAKE_CXX_FLAGS="-latomic"
+endif

Since you add the dependency on BR2_TOOLCHAIN_HAS_ATOMIC in the Config.in, I wonder whether nested conf. opts. update in a if-block that will always be true is really necessary...

Quoted 3 lines

You're confusing BR2_TOOLCHAIN_HAS_ATOMIC with BR2_TOOLCHAIN_HAS_LIBATOMIC. There's a subtle difference :)

gah! Right :-/

Quoted 5 lines

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

Signature · 1 line
Samuel
#4 lore raw

PATCH 1/1 package/opencv3: use BR2_TOOLCHAIN_HAS_LIBATOMIC

In reply to Bernd Kuhls

Hello,

package/opencv3/opencv3.mk OPENCV3_INSTALL_STAGING = YES · line 16

Quoted 4 lines · Bernd Kuhls
package/opencv3/opencv3.mk +4 -0
+# Uses __atomic_fetch_add_4
+ifeq ($(BR2_TOOLCHAIN_HAS_LIBATOMIC),y)
+OPENCV3_CONF_OPTS += -DCMAKE_CXX_FLAGS="-latomic"
+endif

Isn't this overriding the flags already passed? Shouldn't it be:

	-DCMAKE_CXX_FLAGS="${CMAKE_CXX_FLAGS} -latomic"

or something like that?

Samuel?

Thanks,

Thomas

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

PATCH 1/1 package/opencv3: use BR2_TOOLCHAIN_HAS_LIBATOMIC

Quoted 11 lines · Thomas Petazzoni

Hello,

package/opencv3/opencv3.mk OPENCV3_INSTALL_STAGING = YES · line 16

Quoted 4 lines · Bernd Kuhls
package/opencv3/opencv3.mk +4 -0
+# Uses __atomic_fetch_add_4
+ifeq ($(BR2_TOOLCHAIN_HAS_LIBATOMIC),y)
+OPENCV3_CONF_OPTS += -DCMAKE_CXX_FLAGS="-latomic"
+endif

Isn't this overriding the flags already passed? Shouldn't it be:

Quoted 3 lines
        -DCMAKE_CXX_FLAGS="${CMAKE_CXX_FLAGS} -latomic"

or something like that?

Nope, this is correct because, by default, CMAKE_CXX_FLAGS is not set by Buildroot (except for
host-package), and for the target ones, the toolchainfile.cmake allows defining package specific
CMAKE_CXX_FLAGS (see [1]).

Besides, doing:
-DCMAKE_CXX_FLAGS="${CMAKE_CXX_FLAGS} -latomic"
may allow take into account the CMAKE_CXX_FLAGS variable set in the Buildroot environment; I'm
not sure we want this...

So, the original code from Bernd should behave as expected.

[1] https://github.com/buildroot/buildroot/blob/master/support/misc/toolchainfile.cmake.in#L17

Regards,

Signature · 1 line
Samuel
#6 lore raw

PATCH 1/1 package/opencv3: use BR2_TOOLCHAIN_HAS_LIBATOMIC

In reply to Bernd Kuhls

Hello,

Quoted 9 lines · Bernd Kuhls

It uses __atomic_fetch_add_4 so libatomic must be pulled in if necessary. Fixes
http://autobuild.buildroot.net/results/652/6521223b426c3cb4dfefab27bc6021900db6910e/

---
 package/opencv3/Config.in  | 2 ++
 package/opencv3/opencv3.mk | 5 +++++
 2 files changed, 7 insertions(+)

Applied to master, thanks.

Thomas

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