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
b692231393 and
1feb3838b5:

/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 <fontaine.fabrice@gmail.com>
Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
This commit is contained in:
Fabrice Fontaine 2022-04-20 19:28:16 +02:00 committed by Arnout Vandecappelle (Essensium/Mind)
parent 26470f6410
commit cc10bd5777
2 changed files with 12 additions and 0 deletions

View File

@ -30,6 +30,17 @@ config BR2_PACKAGE_OPENCV4_LIB_CALIB3D
Include opencv_calib3d (camera calibration and 3d Include opencv_calib3d (camera calibration and 3d
reconstruction) module into the OpenCV build. 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 config BR2_PACKAGE_OPENCV4_LIB_FEATURES2D
bool "features2d" bool "features2d"
select BR2_PACKAGE_OPENCV4_LIB_FLANN select BR2_PACKAGE_OPENCV4_LIB_FLANN

View File

@ -92,6 +92,7 @@ OPENCV4_CONF_OPTS += \
-DBUILD_opencv_apps=OFF \ -DBUILD_opencv_apps=OFF \
-DBUILD_opencv_calib3d=$(if $(BR2_PACKAGE_OPENCV4_LIB_CALIB3D),ON,OFF) \ -DBUILD_opencv_calib3d=$(if $(BR2_PACKAGE_OPENCV4_LIB_CALIB3D),ON,OFF) \
-DBUILD_opencv_core=ON \ -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_features2d=$(if $(BR2_PACKAGE_OPENCV4_LIB_FEATURES2D),ON,OFF) \
-DBUILD_opencv_flann=$(if $(BR2_PACKAGE_OPENCV4_LIB_FLANN),ON,OFF) \ -DBUILD_opencv_flann=$(if $(BR2_PACKAGE_OPENCV4_LIB_FLANN),ON,OFF) \
-DBUILD_opencv_highgui=$(if $(BR2_PACKAGE_OPENCV4_LIB_HIGHGUI),ON,OFF) \ -DBUILD_opencv_highgui=$(if $(BR2_PACKAGE_OPENCV4_LIB_HIGHGUI),ON,OFF) \