Skip to contentSkip to conversation

opencv: Fix build with clang

PATCH New Khem Raj 1 participant 2 messages Sep 12, 2018

lore
Share & tools
lore

Khem Raj

author
#0 lore raw

PATCH 1/2 opencv: Fix build with clang

---
 ...Check-for-clang-before-using-isystem.patch | 32 +++++++++++++++++++
 .../opencv/opencv/0001-Dont-use-isystem.patch | 30 +++++++++++++++++
 .../recipes-support/opencv/opencv_3.4.3.bb    |  2 ++
 3 files changed, 64 insertions(+)
 create mode 100644 meta-oe/recipes-support/opencv/opencv/0001-Check-for-clang-before-using-isystem.patch
 create mode 100644 meta-oe/recipes-support/opencv/opencv/0001-Dont-use-isystem.patch
meta-oe/recipes-support/opencv/opencv/0001-Check-for-clang-before-using-isystem.patch new file +32 -0
new file mode 100644
index 0000000000..319071a311
@@ -0,0 +1,32 @@
+From fa76d8646bb2b9b514728eeef41afed7c43a36f2 Mon Sep 17 00:00:00 2001
+From: Khem Raj <[email protected]>
+Date: Tue, 11 Sep 2018 18:18:33 -0700
+Subject: [PATCH] Check for clang before using -isystem
+
+When cross compiling with clang, the internal C++ headers are not found
+when adding sysroot to -isystem, that is redundant anyway because it
+will look for headers insider --sysroot path with same quality as it
+would do with -isystem otherwise
+
+Upstream-Status: Submitted [https://github.com/opencv/opencv/pull/12504]
+Signed-off-by: Khem Raj <[email protected]>
+---
+ cmake/OpenCVUtils.cmake | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/cmake/OpenCVUtils.cmake b/cmake/OpenCVUtils.cmake
+index fae91c165f..60c20192dc 100644
+--- a/cmake/OpenCVUtils.cmake
++++ b/cmake/OpenCVUtils.cmake
+@@ -259,7 +259,7 @@ function(ocv_include_directories)
+     ocv_is_opencv_directory(__is_opencv_dir "${dir}")
+     if(__is_opencv_dir)
+       list(APPEND __add_before "${dir}")
+-    elseif(CV_GCC AND NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS "6.0" AND
++    elseif(((CV_GCC AND NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS "6.0") OR CV_CLANG) AND
+            dir MATCHES "/usr/include$")
+       # workaround for GCC 6.x bug
+     else()
+-- 
+2.18.0
+
meta-oe/recipes-support/opencv/opencv/0001-Dont-use-isystem.patch new file +30 -0
new file mode 100644
index 0000000000..bf0b80a30b
@@ -0,0 +1,30 @@
+From 7144c44ec70dee73a628463b99ffeed74b1a8ef6 Mon Sep 17 00:00:00 2001
+From: Khem Raj <[email protected]>
+Date: Tue, 11 Sep 2018 00:21:18 -0700
+Subject: [PATCH] Dont use isystem
+
+clang really does not like it
+
+Upstream-Status: Pending
+
+Signed-off-by: Khem Raj <[email protected]>
+---
+ cmake/OpenCVPCHSupport.cmake | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/cmake/OpenCVPCHSupport.cmake b/cmake/OpenCVPCHSupport.cmake
+index f9b1b48b65..fe27a136f5 100644
+--- a/cmake/OpenCVPCHSupport.cmake
++++ b/cmake/OpenCVPCHSupport.cmake
+@@ -18,6 +18,8 @@ IF(CV_GCC)
+         SET(PCHSupport_FOUND TRUE)
+     ENDIF()
+ 
++    SET(CMAKE_INCLUDE_SYSTEM_FLAG_C "-I")
++    SET(CMAKE_INCLUDE_SYSTEM_FLAG_CXX "-I")
+     SET(_PCH_include_prefix "-I")
+     SET(_PCH_isystem_prefix "-isystem")
+     SET(_PCH_define_prefix "-D")
+-- 
+2.18.0
+
meta-oe/recipes-support/opencv/opencv_3.4.3.bb +2 -0
index 403146e7cd..0a99700b4a 100644
@@ -51,6 +51,8 @@ SRC_URI = "git://github.com/opencv/opencv.git;name=opencv \
     file://0003-To-fix-errors-as-following.patch \
     file://fixpkgconfig.patch \
     file://0001-Temporarliy-work-around-deprecated-ffmpeg-RAW-functi.patch \
+    file://0001-Dont-use-isystem.patch \
+    file://0001-Check-for-clang-before-using-isystem.patch \
 "
 PV = "3.4.3+git${SRCPV}"
 
Signature · 1 line
2.19.0
author
#1 lore raw

PATCH 2/2 lcdproc: Update to master tip

* Do not build on musl/arm since it does not build due to musl not implementing ioperm() function on ARM

Drop 0001-include-asm-ioctl.h-explicitly.patch its fixed differently upstream already

---
 .../0001-include-asm-ioctl.h-explicitly.patch | 43 -------------------
 .../recipes-extended/lcdproc/lcdproc_git.bb   |  7 +--
 2 files changed, 4 insertions(+), 46 deletions(-)
 delete mode 100644 meta-oe/recipes-extended/lcdproc/lcdproc/0001-include-asm-ioctl.h-explicitly.patch
meta-oe/recipes-extended/lcdproc/lcdproc/0001-include-asm-ioctl.h-explicitly.patch deleted +0 -43
deleted file mode 100644
index abdedad5d6..0000000000
@@ -1,43 +0,0 @@
-From b5ca64c7398d516e9845d849e8306df7ac024bc4 Mon Sep 17 00:00:00 2001
-From: Khem Raj <[email protected]>
-Date: Tue, 11 Apr 2017 13:59:34 -0700
-Subject: [PATCH] include asm/ioctl.h explicitly
-
-Needed for _IOC* defines
-
-helps compiling with musl where this file is
-not included indirectly
-
-Signed-off-by: Khem Raj <[email protected]>
----
- server/drivers/hd44780-pifacecad.c | 1 +
- server/drivers/hd44780-spi.c       | 1 +
- 2 files changed, 2 insertions(+)
-
-diff --git a/server/drivers/hd44780-pifacecad.c b/server/drivers/hd44780-pifacecad.c
-index 43db19c..e2798ad 100644
---- a/server/drivers/hd44780-pifacecad.c
-+++ b/server/drivers/hd44780-pifacecad.c
-@@ -54,6 +54,7 @@
- #include <unistd.h>
- #include <fcntl.h>
- #include <sys/ioctl.h>
-+#include <asm/ioctl.h>
- #include <stdint.h>
- #include <linux/spi/spidev.h>
- 
-diff --git a/server/drivers/hd44780-spi.c b/server/drivers/hd44780-spi.c
-index 5f94333..8a4015b 100644
---- a/server/drivers/hd44780-spi.c
-+++ b/server/drivers/hd44780-spi.c
-@@ -29,6 +29,7 @@
- #include <unistd.h>
- #include <fcntl.h>
- #include <sys/ioctl.h>
-+#include <asm/ioctl.h>
- #include <stdint.h>
- #include <linux/spi/spidev.h>
- 
--- 
-2.12.2
-
meta-oe/recipes-extended/lcdproc/lcdproc_git.bb +4 -3
index fad1d616c3..93a09f28a0 100644
@@ -11,15 +11,16 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=18810669f13b87348459e611d31ab760 \
 
 BASEPV = "0.5.9"
 PV = "${BASEPV}+git${SRCPV}"
-SRCREV = "79fa538647c3e09a87ecc86aae1abbb82e0a25c5"
-SRC_URI = "git://github.com/lcdproc/lcdproc;branch=lcdproc-${BASEPV} \
-           file://0001-include-asm-ioctl.h-explicitly.patch \
+SRCREV = "a4b5a7e058fdd0d914a61138748b589c0128b45b"
+SRC_URI = "git://github.com/lcdproc/lcdproc \
            "
 
 S = "${WORKDIR}/git"
 
 inherit autotools pkgconfig update-rc.d
 
+COMPATIBLE_HOST_arm_libc-musl = "null"
+
 LCD_DRIVERS ?= "all,!irman,!svga"
 LCD_DEFAULT_DRIVER ?= "curses"
 
Signature · 1 line
2.19.0