conan-io / conan-center-index

Recipes for the ConanCenter repository
https://conan.io/center
MIT License
949 stars 1.74k forks source link

[package] OPENCV/4.5.x: OPENCV is being built with Werror GCC12 #16354

Open MattBelanger321 opened 1 year ago

MattBelanger321 commented 1 year ago

Description

There is a function in the library that has an Assert(false) instead of a return value but conan forces OpenCV to be built with -Werror=return-type so this is treated as an error.

src/modules/gapi/src/compiler/gislandmodel.cpp:124:1: error: control reaches end of non-void function [-Werror=return-type] 124 | }

I saw that warning was corrected in the opencv issues so maybe this can be a simple as adding the fix to conan

Package and Environment Details

Conan profile

[settings] os=Linux os_build=Linux arch=x86_64 arch_build=x86_64 compiler=gcc compiler.version=12 compiler.libcxx=libstdc++11 build_type=Release [options] [build_requires] [env] [conf] tools.system.package_manager:mode=install

Steps to reproduce

conan install .. -s build_type=Debug --build missing

with conanfile.txt:

` [requires]

zlib/1.2.13

eigen/3.4.0 gtest/1.10.0

opencv/4.3.0@conan/stable

opencv/4.5.5 spdlog/1.11.0

spdlog/1.8.2

fmt/9.1.0

nlohmann_json/3.9.1

nlohmann_json/3.10.5 rapidjson/1.1.0 ixwebsocket/11.4.3 glm/0.9.9.8 redis-plus-plus/1.3.3

protobuf/3.21.4

lib usb to list usb devices

libusb/1.0.26

This is required for serial port communication

serial/1.2.1

fourier transform for signal processing

fftw/3.3.9 zlib/1.2.13 json-schema-validator/2.1.0

[generators] cmake_paths

cmake_find_package CMakeDeps

[options]

opencv:shared=True

opencv:with_cuda=False

opencv:contrib=True

opencv:contrionfigure made a mistake, make sure you are using the latestb_freetype=False

the following libraries depende on webp, which depends on libvpr which is not supporting vs17 yet(libvpr-11.0)!

opencv:with_webp=False

opencv:with_tiff=False

opencv:with_ffmpeg=False

[imports] bin, .dll -> ./bin # Copies all dll files from packages bin folder to my local "bin" folder lib, .dylib* -> ./bin # Copies all dylib files from packages lib folder to my local "bin" folder

./res/bindings, imgui_impl_glfw.cpp -> ./bindings ./res/bindings, imgui_impl_opengl3.cpp -> ./bindings ./res/bindings, imgui_impl_glfw.h -> ./bindings ./res/bindings, imgui_impl_opengl3_loader.h -> ./bindings ./res/bindings, imgui_impl_opengl3.h -> ./bindings

., license* -> ./licenses @ folder=True, ignore_case=True `

Logs

Click to expand log ``` -- Conan: Target declared 'vulkan-headers::vulkan-headers' -- Allocator metrics storage type: 'long long' -- Registering hook 'INIT_MODULE_SOURCES_opencv_dnn': /root/.conan/data/opencv/4.5.5/_/_/build/0cdf0e505083b7936c10c8382552d563d196c28c/src/modules/dnn/cmake/hooks/INIT_MODULE_SOURCES_opencv_dnn.cmake -- Performing Test HAVE_CXX_WNO_DEPRECATED -- Performing Test HAVE_CXX_WNO_DEPRECATED - Success -- Performing Test HAVE_CXX_WNO_MISSING_PROTOTYPES -- Performing Test HAVE_CXX_WNO_MISSING_PROTOTYPES - Failed -- Performing Test HAVE_CXX_WNO_MISSING_DECLARATIONS -- Performing Test HAVE_CXX_WNO_MISSING_DECLARATIONS - Success -- Performing Test HAVE_CXX_WNO_SHADOW -- Performing Test HAVE_CXX_WNO_SHADOW - Success -- Performing Test HAVE_CXX_WNO_UNUSED_PARAMETER -- Performing Test HAVE_CXX_WNO_UNUSED_PARAMETER - Success -- Performing Test HAVE_CXX_WNO_SIGN_COMPARE -- Performing Test HAVE_CXX_WNO_SIGN_COMPARE - Success -- Performing Test HAVE_CXX_WNO_INVALID_OFFSETOF -- Performing Test HAVE_CXX_WNO_INVALID_OFFSETOF - Success -- Performing Test HAVE_CXX_WNO_SUGGEST_OVERRIDE -- Performing Test HAVE_CXX_WNO_SUGGEST_OVERRIDE - Success -- Performing Test HAVE_CXX_WNO_ARRAY_BOUNDS -- Performing Test HAVE_CXX_WNO_ARRAY_BOUNDS - Success -- opencv_dnn: filter out ocl4dnn source code -- opencv_dnn: filter out cuda4dnn source code -- Excluding from source files list: /modules/dnn/layers/layers_common.rvv.cpp -- imgcodecs: Jasper codec is disabled in runtime. Details: https://github.com/opencv/opencv/issues/14058 -- Performing Test HAVE_CXX_WNO_DEPRECATED_DECLARATIONS -- Performing Test HAVE_CXX_WNO_DEPRECATED_DECLARATIONS - Success -- highgui: using builtin backend: GTK2 -- Conan: Target declared 'quirc::quirc' -- Found 'misc' Python modules from /root/.conan/data/opencv/4.5.5/_/_/build/0cdf0e505083b7936c10c8382552d563d196c28c/src/modules/python/package/extra_modules -- Found 'mat_wrapper;utils' Python modules from /root/.conan/data/opencv/4.5.5/_/_/build/0cdf0e505083b7936c10c8382552d563d196c28c/src/modules/core/misc/python/package -- Found 'gapi' Python modules from /root/.conan/data/opencv/4.5.5/_/_/build/0cdf0e505083b7936c10c8382552d563d196c28c/src/modules/gapi/misc/python/package -- -- General configuration for OpenCV 4.5.5 ===================================== -- Version control: unknown -- -- Platform: -- Timestamp: 2023-03-02T20:50:12Z -- Host: Linux 5.19.0-35-generic x86_64 -- CMake: 3.24.2 -- CMake generator: Unix Makefiles -- CMake build tool: /usr/bin/gmake -- Configuration: Debug -- -- CPU/HW features: -- Baseline: SSE SSE2 SSE3 -- requested: SSE3 -- Dispatched code generation: SSE4_1 SSE4_2 FP16 AVX AVX2 AVX512_SKX -- requested: SSE4_1 SSE4_2 AVX FP16 AVX2 AVX512_SKX -- SSE4_1 (16 files): + SSSE3 SSE4_1 -- SSE4_2 (1 files): + SSSE3 SSE4_1 POPCNT SSE4_2 -- FP16 (0 files): + SSSE3 SSE4_1 POPCNT SSE4_2 FP16 AVX -- AVX (4 files): + SSSE3 SSE4_1 POPCNT SSE4_2 AVX -- AVX2 (31 files): + SSSE3 SSE4_1 POPCNT SSE4_2 FP16 FMA3 AVX AVX2 -- AVX512_SKX (5 files): + SSSE3 SSE4_1 POPCNT SSE4_2 FP16 FMA3 AVX AVX2 AVX_512F AVX512_COMMON AVX512_SKX -- -- C/C++: -- Built as dynamic libs?: NO -- C++ standard: 11 -- C++ Compiler: /usr/bin/c++ (ver 12.2.0) -- C++ flags (Release): -m64 -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wuninitialized -Wsuggest-override -Wno-delete-non-virtual-dtor -Wno-comment -Wimplicit-fallthrough=3 -Wno-strict-overflow -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections -msse -msse2 -msse3 -fvisibility=hidden -fvisibility-inlines-hidden -O3 -DNDEBUG -DNDEBUG -- C++ flags (Debug): -m64 -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wuninitialized -Wsuggest-override -Wno-delete-non-virtual-dtor -Wno-comment -Wimplicit-fallthrough=3 -Wno-strict-overflow -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections -msse -msse2 -msse3 -fvisibility=hidden -fvisibility-inlines-hidden -g -O0 -DDEBUG -D_DEBUG -- C Compiler: /usr/bin/cc -- C flags (Release): -m64 -fsigned-char -W -Wall -Werror=return-type -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wuninitialized -Wno-comment -Wimplicit-fallthrough=3 -Wno-strict-overflow -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections -msse -msse2 -msse3 -fvisibility=hidden -O3 -DNDEBUG -DNDEBUG -- C flags (Debug): -m64 -fsigned-char -W -Wall -Werror=return-type -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wuninitialized -Wno-comment -Wimplicit-fallthrough=3 -Wno-strict-overflow -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections -msse -msse2 -msse3 -fvisibility=hidden -g -O0 -DDEBUG -D_DEBUG -- Linker flags (Release): -m64 -Wl,--gc-sections -Wl,--as-needed -- Linker flags (Debug): -m64 -Wl,--gc-sections -Wl,--as-needed -- ccache: NO -- Precompiled headers: NO -- Extra dependencies: /root/.conan/data/libwebp/1.2.4/_/_/package/3454cb80dacb69d4c43767b23f3a486be4fc6918/lib/libwebp.a quirc::quirc dl m pthread rt -- 3rdparty dependencies: -- -- OpenCV modules: -- To be built: calib3d core dnn features2d flann gapi highgui imgcodecs imgproc ml objdetect photo stitching video videoio -- Disabled: python_tests world -- Disabled by dependency: - -- Unavailable: java python2 python3 ts -- Applications: - -- Documentation: NO -- Non-free algorithms: NO -- -- GUI: GTK2 -- GTK+: YES (ver 2.24.33) -- GThread : YES (ver 2.74.3) -- GtkGlExt: NO -- -- Media I/O: -- ZLib: ZLIB::ZLIB (ver 1.2.13) -- JPEG: (ver 90) -- WEBP: /root/.conan/data/libwebp/1.2.4/_/_/package/3454cb80dacb69d4c43767b23f3a486be4fc6918/lib/libwebp.a (ver encoder: 0x020f) -- PNG: (ver ..) -- TIFF: (ver 42 / 4.4.0) -- JPEG 2000: (ver 4.0.0) -- OpenEXR: OpenEXR::OpenEXR (ver 3.1.5) -- HDR: NO -- SUNRASTER: NO -- PXM: NO -- PFM: NO -- -- Video I/O: -- FFMPEG: YES (find_package) -- avcodec: YES (58.134.100) -- avformat: YES (58.76.100) -- avutil: YES (56.70.100) -- swscale: YES (5.9.100) -- avresample: YES (4.4) -- -- Parallel framework: pthreads -- -- Trace: YES (built-in) -- -- Other third-party libraries: -- Eigen: YES (ver ..) -- Custom HAL: NO -- Protobuf: protobuf::libprotobuf (3.17.1) -- -- Python (for build): NO -- -- Install to: /root/.conan/data/opencv/4.5.5/_/_/package/0cdf0e505083b7936c10c8382552d563d196c28c -- ----------------------------------------------------------------- -- -- Configuring done -- Generating done ```
Valetron commented 1 year ago

Have you solved this error?

MattBelanger321 commented 1 year ago

ybe this can be a simple as adding the fix to conan

Package and Environment Details

not yet

matheusgomes28 commented 1 year ago

I am slso getting "error: control reaches end of non-void function [-Werror=return-type]" when building the gapi file: ~/.conan/data/opencv/4.5.5///build/2d1073e04ab069672479e5d847b9070b3b0cca28/src/modules/gapi/src/compiler/gislandmodel.cpp:

I'm trying to manually set -Wno-error -Wno-return-type manually via CXX, CMAKE_CXX_FLAGS environment variables but the build seems to ignore those. Really painful as I cannot build OpenCV through conan on gcc121

Has anyone figured how to build this yet?

Valetron commented 1 year ago

I think, this is not conan error. I tried to build OpenCV 4.5.2, 4.6.0 from official repo manually and met the same error. I used next flags:

cmake -D CMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=./install -DWITH_CUDA=OFF -DOPENCV_EXTRA_MODULES_PATH=../../opencv_contrib/modules  -DWITH_QUIRC=OFF -DBUILD_JAVA=OFF ..

The version 4.7.0 was the only successful to build.

MattBelanger321 commented 1 year ago

Its not conan but OpenCV corrected this error already. Do they need need to upload to cinan again or something?

MattBelanger321 commented 1 year ago

did you build version 4.7.0 using conan? I do not see 4.7.0 here: https://conan.io/center/opencv , I am curious to how you accomplished this. I am using conan version 1 as an FYI