Skip to contentSkip to conversation

package/opencv: fix build due to gcc bug 68485

PATCH New Fabrice Fontaine 3 participants 3 messages Jun 1, 2019 – Jun 20, 2019

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 package/opencv: fix build due to gcc bug 68485

With Microblaze Gcc version <= 9.x the build fails due to gcc bug 68485:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68485. The bug show up when building opencv with optimization but not when building with -O0. To work around this, if BR2_TOOLCHAIN_HAS_GCC_BUG_68458=y, we force using -O0.

Fixes:
- http://autobuild.buildroot.org/results/17fff0f312ebd520ba3341976ba56fd8c85ee376

---
 package/opencv/opencv.mk | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)
package/opencv/opencv.mk +9 -2
index ccc2d820da..4c15075fe0 100644
@@ -10,6 +10,7 @@ OPENCV_INSTALL_STAGING = YES
 OPENCV_LICENSE = BSD-3-Clause
 OPENCV_LICENSE_FILES = LICENSE
 OPENCV_SUPPORTS_IN_SOURCE_BUILD = NO
+OPENCV_CXXFLAGS = $(TARGET_CXXFLAGS)
 
 # OpenCV component options
 OPENCV_CONF_OPTS += \
@@ -166,6 +167,10 @@ OPENCV_CONF_OPTS += \
 
 OPENCV_DEPENDENCIES += zlib
 
+ifeq ($(BR2_TOOLCHAIN_HAS_GCC_BUG_68485),y)
+OPENCV_CXXFLAGS += -O0
+endif
+
 ifeq ($(BR2_PACKAGE_OPENCV_WITH_FFMPEG),y)
 OPENCV_CONF_OPTS += -DWITH_FFMPEG=ON
 OPENCV_DEPENDENCIES += ffmpeg bzip2
@@ -195,8 +200,8 @@ OPENCV_CONF_OPTS += -DWITH_GTK=OFF
 endif
 
 ifeq ($(BR2_PACKAGE_OPENCV_WITH_JASPER),y)
-OPENCV_CONF_OPTS += -DWITH_JASPER=ON \
-	-DCMAKE_CXX_FLAGS="$(TARGET_CXXFLAGS) -D__STDC_LIMIT_MACROS"
+OPENCV_CONF_OPTS += -DWITH_JASPER=ON
+OPENCV_CXXFLAGS += -D__STDC_LIMIT_MACROS
 OPENCV_DEPENDENCIES += jasper
 else
 OPENCV_CONF_OPTS += -DWITH_JASPER=OFF
@@ -232,6 +237,8 @@ else
 OPENCV_CONF_OPTS += -DWITH_V4L=OFF -DWITH_LIBV4L=OFF
 endif
 
+OPENCV_CONF_OPTS += -DCMAKE_CXX_FLAGS="$(OPENCV_CXXFLAGS)"
+
 # Installation hooks:
 define OPENCV_CLEAN_INSTALL_DOC
 	$(RM) -fr $(TARGET_DIR)/usr/share/OpenCV/doc
Signature · 1 line
2.20.1
#1 lore raw

PATCH 1/1 package/opencv: fix build due to gcc bug 68485

Hello,

Il 01/06/2019 12:20, Fabrice Fontaine ha scritto:

Quoted 10 lines

With Microblaze Gcc version <= 9.x the build fails due to gcc bug 68485:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68485. The bug show up when building opencv with optimization but not when building with -O0. To work around this, if BR2_TOOLCHAIN_HAS_GCC_BUG_68458=y, we force using -O0.

Fixes:
- http://autobuild.buildroot.org/results/17fff0f312ebd520ba3341976ba56fd8c85ee376

Quoted 48 lines
---
  package/opencv/opencv.mk | 11 +++++++++--
  1 file changed, 9 insertions(+), 2 deletions(-)
package/opencv/opencv.mk +9 -2
index ccc2d820da..4c15075fe0 100644
@@ -10,6 +10,7 @@ OPENCV_INSTALL_STAGING = YES
  OPENCV_LICENSE = BSD-3-Clause
  OPENCV_LICENSE_FILES = LICENSE
  OPENCV_SUPPORTS_IN_SOURCE_BUILD = NO
+OPENCV_CXXFLAGS = $(TARGET_CXXFLAGS)
 
  # OpenCV component options
  OPENCV_CONF_OPTS += \
@@ -166,6 +167,10 @@ OPENCV_CONF_OPTS += \
 
  OPENCV_DEPENDENCIES += zlib
 
+ifeq ($(BR2_TOOLCHAIN_HAS_GCC_BUG_68485),y)
+OPENCV_CXXFLAGS += -O0
+endif
+
  ifeq ($(BR2_PACKAGE_OPENCV_WITH_FFMPEG),y)
  OPENCV_CONF_OPTS += -DWITH_FFMPEG=ON
  OPENCV_DEPENDENCIES += ffmpeg bzip2
@@ -195,8 +200,8 @@ OPENCV_CONF_OPTS += -DWITH_GTK=OFF
  endif
 
  ifeq ($(BR2_PACKAGE_OPENCV_WITH_JASPER),y)
-OPENCV_CONF_OPTS += -DWITH_JASPER=ON \
-	-DCMAKE_CXX_FLAGS="$(TARGET_CXXFLAGS) -D__STDC_LIMIT_MACROS"
+OPENCV_CONF_OPTS += -DWITH_JASPER=ON
+OPENCV_CXXFLAGS += -D__STDC_LIMIT_MACROS
  OPENCV_DEPENDENCIES += jasper
  else
  OPENCV_CONF_OPTS += -DWITH_JASPER=OFF
@@ -232,6 +237,8 @@ else
  OPENCV_CONF_OPTS += -DWITH_V4L=OFF -DWITH_LIBV4L=OFF
  endif
 
+OPENCV_CONF_OPTS += -DCMAKE_CXX_FLAGS="$(OPENCV_CXXFLAGS)"
+
  # Installation hooks:
  define OPENCV_CLEAN_INSTALL_DOC
  	$(RM) -fr $(TARGET_DIR)/usr/share/OpenCV/doc
Signature · 10 lines
Giulio Benetti
CTO

MICRONOVA SRL
Sede: Via A. Niedda 3 - 35010 Vigonza (PD)
Tel. 049/8931563 - Fax 049/8931346
Cod.Fiscale - P.IVA 02663420285
Capitale Sociale ? 26.000 i.v.
Iscritta al Reg. Imprese di Padova N. 02663420285
Numero R.E.A. 258642
#2 lore raw

PATCH 1/1 package/opencv: fix build due to gcc bug 68485

In reply to Fabrice Fontaine
Quoted 6 lines · On Sat, 1 Jun 2019 12:20:32 +0200 Fabrice Fontaine…

With Microblaze Gcc version <= 9.x the build fails due to gcc bug 68485:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68485. The bug show up when building opencv with optimization but not when building with -O0. To work around this, if BR2_TOOLCHAIN_HAS_GCC_BUG_68458=y, we force using -O0.

Quoted 7 lines

Fixes:
- http://autobuild.buildroot.org/results/17fff0f312ebd520ba3341976ba56fd8c85ee376

---
 package/opencv/opencv.mk | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

Applied to master, thanks.

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com