From cc10bd5777af492b786c7d6c7fc917b855c6b7d8 Mon Sep 17 00:00:00 2001 From: Fabrice Fontaine Date: Wed, 20 Apr 2022 19:28:16 +0200 Subject: [PATCH] package/opencv4: fix uclibc build Add BR2_PACKAGE_OPENCV4_LIB_DNN to fix the following uclibc build failure raised since bump to version 4.5.5 in commit b6922313937712a89841b58d3b355edd53754bca and https://github.com/opencv/opencv/commit/1feb3838b51c0b27b0f3e64f02358ff5ef3111b8: /home/giuliobenetti/autobuild/run/instance-3/output-1/build/opencv4-4.5.5/modules/dnn/src/layers/elementwise_layers.cpp: In member function 'float cv::dnn::RoundFunctor::calculate(float) const': /home/giuliobenetti/autobuild/run/instance-3/output-1/build/opencv4-4.5.5/modules/dnn/src/layers/elementwise_layers.cpp:1260:43: error: 'fegetround' is not a member of 'std' 1260 | int old_rounding_direction = std::fegetround(); | ^~~~~~~~~~ /home/peko/autobuild/instance-0/output-1/build/opencv4-4.5.5/modules/dnn/src/layers/elementwise_layers.cpp:1261:14: error: 'fesetround' is not a member of 'std' 1261 | std::fesetround(FE_TONEAREST); | ^~~~~~~~~~ /home/peko/autobuild/instance-0/output-1/build/opencv4-4.5.5/modules/dnn/src/layers/elementwise_layers.cpp:1261:25: error: 'FE_TONEAREST' was not declared in this scope 1261 | std::fesetround(FE_TONEAREST); | ^~~~~~~~~~~~ Indeed, uclibc pretends to implement fenv but it raises build failures on numerous architectures (or1k, sh4, xtensa, mipsel, arm, arc, riscv64, etc.) Fixes: - http://autobuild.buildroot.org/results/a6dd3c10acfbf6bc1af867d770cf0ce926c6ce84 Signed-off-by: Fabrice Fontaine Signed-off-by: Arnout Vandecappelle (Essensium/Mind) --- package/opencv4/Config.in | 11 +++++++++++ package/opencv4/opencv4.mk | 1 + 2 files changed, 12 insertions(+) diff --git a/package/opencv4/Config.in b/package/opencv4/Config.in index 23d34a9d22..a61a106952 100644 --- a/package/opencv4/Config.in +++ b/package/opencv4/Config.in @@ -30,6 +30,17 @@ config BR2_PACKAGE_OPENCV4_LIB_CALIB3D Include opencv_calib3d (camera calibration and 3d reconstruction) module into the OpenCV build. +config BR2_PACKAGE_OPENCV4_LIB_DNN + bool "dnn" + # dnn needs fenv.h which is not provided by uclibc + depends on !BR2_TOOLCHAIN_USES_UCLIBC + help + Include opencv_dnn (Deep Neural Networks) module into the + OpenCV build. + +comment "dnn needs a glibc or musl toolchain" + depends on BR2_TOOLCHAIN_USES_UCLIBC + config BR2_PACKAGE_OPENCV4_LIB_FEATURES2D bool "features2d" select BR2_PACKAGE_OPENCV4_LIB_FLANN diff --git a/package/opencv4/opencv4.mk b/package/opencv4/opencv4.mk index 0563026b18..84e0487dc4 100644 --- a/package/opencv4/opencv4.mk +++ b/package/opencv4/opencv4.mk @@ -92,6 +92,7 @@ OPENCV4_CONF_OPTS += \ -DBUILD_opencv_apps=OFF \ -DBUILD_opencv_calib3d=$(if $(BR2_PACKAGE_OPENCV4_LIB_CALIB3D),ON,OFF) \ -DBUILD_opencv_core=ON \ + -DBUILD_opencv_dnn=$(if $(BR2_PACKAGE_OPENCV4_LIB_DNN),ON,OFF) \ -DBUILD_opencv_features2d=$(if $(BR2_PACKAGE_OPENCV4_LIB_FEATURES2D),ON,OFF) \ -DBUILD_opencv_flann=$(if $(BR2_PACKAGE_OPENCV4_LIB_FLANN),ON,OFF) \ -DBUILD_opencv_highgui=$(if $(BR2_PACKAGE_OPENCV4_LIB_HIGHGUI),ON,OFF) \