Header file woes after rebuilding Opencv w/ extra contrib modules

This is my first attempt to build Opencv (my project had been using the prebuilt distro). I changed the following options in CMake (for Windows, Opencv v. 4.5.5, VS 2022 build environment) : BUILD_opencv_world: ON, and BUILD_OPENCV_EXTRA_MODULES_PATH=<path to opencv-contrib-4.x location>.

This seemed to build properly, but when reopening my project, I found that no include files had been placed in the build/include directory. I tried referencing from the original source/include directory, but that caused the headers to throw missing file exceptions for opencv_modules.hpp (which was created in the build/cv2 directory). Obviously I’ve done something wrong in the build, but I don’t know what. Any help vastly appreciated.

switch world off for now.

and put an absolute path in the extra modules path. it has to point at opencv_contrib/modules

Thanks for the reply. I had set the absolute path to contrib/modules dir (the forum editor excised it). I’m rebuilding now to test without the world option; is that incompatible with adding contrib modules?

Rebuilt with the build_opencv_world setting off – same thing. I’m attaching a list of what headers are making it into the build dir, and where.

Directory of C:\source\opencv-4.5.5\build

02/17/2022  03:32 PM                76 custom_hal.hpp
02/17/2022  03:32 PM               292 opencv_data_config.hpp
02/17/2022  03:32 PM               124 opencv_tests_config.hpp
02/17/2022  03:33 PM               136 text_config.hpp

 Directory of C:\source\opencv-4.5.5\build\3rdparty\ade\ade-0.1.1f\sources\ade\include\ade

08/07/2019  03:55 AM               853 edge.hpp
08/07/2019  03:55 AM             4,399 graph.hpp
08/07/2019  03:55 AM             1,033 graph_listener.hpp
08/07/2019  03:55 AM             2,383 handle.hpp
08/07/2019  03:55 AM             2,039 node.hpp
08/07/2019  03:55 AM             3,894 passmanager.hpp
08/07/2019  03:55 AM             6,464 typed_graph.hpp
08/07/2019  03:55 AM             5,621 typed_metadata.hpp

 Directory of C:\source\opencv-4.5.5\build\3rdparty\ade\ade-0.1.1f\sources\ade\include\ade\communication

08/07/2019  03:55 AM             6,592 callback_connector.hpp
08/07/2019  03:55 AM             5,939 comm_buffer.hpp
08/07/2019  03:55 AM             2,504 comm_interface.hpp

 Directory of C:\source\opencv-4.5.5\build\3rdparty\ade\ade-0.1.1f\sources\ade\include\ade\execution_engine

08/07/2019  03:55 AM             1,061 backend.hpp
08/07/2019  03:55 AM               581 executable.hpp
08/07/2019  03:55 AM            14,552 execution_engine.hpp

 Directory of C:\source\opencv-4.5.5\build\3rdparty\ade\ade-0.1.1f\sources\ade\include\ade\helpers

08/07/2019  03:55 AM             2,949 search.hpp
08/07/2019  03:55 AM            12,791 subgraphs.hpp

 Directory of C:\source\opencv-4.5.5\build\3rdparty\ade\ade-0.1.1f\sources\ade\include\ade\memory

08/07/2019  03:55 AM               320 alloc.hpp
08/07/2019  03:55 AM             3,322 memory_accessor.hpp
08/07/2019  03:55 AM             2,971 memory_access_listener.hpp
08/07/2019  03:55 AM             2,831 memory_descriptor.hpp
08/07/2019  03:55 AM             3,018 memory_descriptor_ref.hpp
08/07/2019  03:55 AM             6,572 memory_descriptor_view.hpp
08/07/2019  03:55 AM               574 memory_types.hpp

 Directory of C:\source\opencv-4.5.5\build\3rdparty\ade\ade-0.1.1f\sources\ade\include\ade\metatypes

08/07/2019  03:55 AM             3,079 metatypes.hpp

 Directory of C:\source\opencv-4.5.5\build\3rdparty\ade\ade-0.1.1f\sources\ade\include\ade\passes

08/07/2019  03:55 AM               546 check_cycles.hpp
08/07/2019  03:55 AM               972 communications.hpp
08/07/2019  03:55 AM               503 pass_base.hpp
08/07/2019  03:55 AM             1,837 topological_sort.hpp

 Directory of C:\source\opencv-4.5.5\build\3rdparty\ade\ade-0.1.1f\sources\ade\include\ade\util

08/07/2019  03:55 AM             8,120 algorithm.hpp
08/07/2019  03:55 AM             2,786 assert.hpp
08/07/2019  03:55 AM             5,159 chain_range.hpp
08/07/2019  03:55 AM             3,899 checked_cast.hpp
08/07/2019  03:55 AM             1,419 container_helper.hpp
08/07/2019  03:55 AM             2,196 filter_range.hpp
08/07/2019  03:55 AM             1,597 func_ref.hpp
08/07/2019  03:55 AM               599 hash.hpp
08/07/2019  03:55 AM             6,326 intrusive_list.hpp
08/07/2019  03:55 AM             3,812 iota_range.hpp
08/07/2019  03:55 AM             2,416 map_range.hpp
08/07/2019  03:55 AM               717 math.hpp
08/07/2019  03:55 AM               548 md_cast.hpp
08/07/2019  03:55 AM             1,205 md_io.hpp
08/07/2019  03:55 AM             2,489 md_size.hpp
08/07/2019  03:55 AM             5,680 md_span.hpp
08/07/2019  03:55 AM            20,401 md_view.hpp
08/07/2019  03:55 AM             7,209 memory_range.hpp
08/07/2019  03:55 AM             4,053 range.hpp
08/07/2019  03:55 AM             2,010 range_iterator.hpp
08/07/2019  03:55 AM             2,351 tuple.hpp
08/07/2019  03:55 AM             2,021 type_traits.hpp
08/07/2019  03:55 AM             2,446 zip_range.hpp

 Directory of C:\source\opencv-4.5.5\build\3rdparty\ippicv\ippicv_win\iw\include\iw++

10/18/2019  08:14 PM             1,024 iw.hpp
10/18/2019  08:14 PM            16,279 iw_core.hpp
10/18/2019  08:14 PM            58,766 iw_image.hpp
10/18/2019  08:14 PM             5,024 iw_image_color.hpp
10/18/2019  08:14 PM            34,895 iw_image_filter.hpp
10/18/2019  08:14 PM            35,229 iw_image_op.hpp
10/18/2019  08:14 PM            29,530 iw_image_transform.hpp

 Directory of C:\source\opencv-4.5.5\build\modules\calib3d

02/17/2022  03:42 PM               329 opencl_kernels_calib3d.hpp
02/17/2022  03:32 PM               282 undistort.simd_declarations.hpp

 Directory of C:\source\opencv-4.5.5\build\modules\core

02/17/2022  03:32 PM               393 arithm.simd_declarations.hpp
02/17/2022  03:32 PM               277 convert.simd_declarations.hpp
02/17/2022  03:32 PM               283 convert_scale.simd_declarations.hpp
02/17/2022  03:32 PM               284 count_non_zero.simd_declarations.hpp
02/17/2022  03:32 PM               395 mathfuncs_core.simd_declarations.hpp
02/17/2022  03:32 PM               518 matmul.simd_declarations.hpp
02/17/2022  03:32 PM               274 mean.simd_declarations.hpp
02/17/2022  03:32 PM               275 merge.simd_declarations.hpp
02/17/2022  03:40 PM             1,737 opencl_kernels_core.hpp
02/17/2022  03:32 PM               275 split.simd_declarations.hpp
02/17/2022  03:32 PM               391 stat.simd_declarations.hpp
02/17/2022  03:32 PM               273 sum.simd_declarations.hpp

 Directory of C:\source\opencv-4.5.5\build\modules\core\test

02/17/2022  03:32 PM             1,209 test_intrin128.simd_declarations.hpp
02/17/2022  03:32 PM               410 test_intrin256.simd_declarations.hpp
02/17/2022  03:32 PM               297 test_intrin512.simd_declarations.hpp

 Directory of C:\source\opencv-4.5.5\build\modules\dnn

02/17/2022  03:42 PM             1,884 opencl_kernels_dnn.hpp

 Directory of C:\source\opencv-4.5.5\build\modules\dnn\int8layers

02/17/2022  03:32 PM               418 layers_common.simd_declarations.hpp

 Directory of C:\source\opencv-4.5.5\build\modules\dnn\layers

02/17/2022  03:32 PM               636 layers_common.simd_declarations.hpp

 Directory of C:\source\opencv-4.5.5\build\modules\features2d

02/17/2022  03:41 PM               521 opencl_kernels_features2d.hpp
02/17/2022  03:32 PM               522 sift.simd_declarations.hpp

 Directory of C:\source\opencv-4.5.5\build\modules\gapi\backends\fluid

02/17/2022  03:32 PM               417 gfluidcore_func.simd_declarations.hpp
02/17/2022  03:32 PM               420 gfluidimgproc_func.simd_declarations.hpp

 Directory of C:\source\opencv-4.5.5\build\modules\highgui

02/17/2022  03:32 PM                78 opencv_highgui_config.hpp

 Directory of C:\source\opencv-4.5.5\build\modules\imgproc

02/17/2022  03:32 PM               506 accum.simd_declarations.hpp
02/17/2022  03:32 PM               289 bilateral_filter.simd_declarations.hpp
02/17/2022  03:32 PM               400 box_filter.simd_declarations.hpp
02/17/2022  03:32 PM               399 color_hsv.simd_declarations.hpp
02/17/2022  03:32 PM               399 color_rgb.simd_declarations.hpp
02/17/2022  03:32 PM               399 color_yuv.simd_declarations.hpp
02/17/2022  03:32 PM               396 filter.simd_declarations.hpp
02/17/2022  03:32 PM               401 median_blur.simd_declarations.hpp
02/17/2022  03:32 PM               395 morph.simd_declarations.hpp
02/17/2022  03:41 PM             3,310 opencl_kernels_imgproc.hpp
02/17/2022  03:32 PM               396 smooth.simd_declarations.hpp
02/17/2022  03:32 PM               407 sumpixels.simd_declarations.hpp

 Directory of C:\source\opencv-4.5.5\build\modules\objdetect

02/17/2022  03:46 PM               405 opencl_kernels_objdetect.hpp

 Directory of C:\source\opencv-4.5.5\build\modules\optflow

02/17/2022  03:47 PM               488 opencl_kernels_optflow.hpp
  
 Directory of C:\source\opencv-4.5.5\build\modules\photo

02/17/2022  03:41 PM               326 opencl_kernels_photo.hpp

 Directory of C:\source\opencv-4.5.5\build\modules\rgbd

02/17/2022  03:44 PM               583 opencl_kernels_rgbd.hpp
    
 Directory of C:\source\opencv-4.5.5\build\modules\stitching

02/17/2022  03:46 PM               400 opencl_kernels_stitching.hpp

 Directory of C:\source\opencv-4.5.5\build\modules\superres

02/17/2022  03:48 PM               336 opencl_kernels_superres.hpp

 Directory of C:\source\opencv-4.5.5\build\modules\tracking

02/17/2022  03:46 PM               392 opencl_kernels_tracking.hpp


 Directory of C:\source\opencv-4.5.5\build\modules\video

02/17/2022  03:44 PM               595 opencl_kernels_video.hpp


 Directory of C:\source\opencv-4.5.5\build\modules\xfeatures2d

02/17/2022  03:44 PM               329 opencl_kernels_xfeatures2d.hpp


 Directory of C:\source\opencv-4.5.5\build\modules\ximgproc

02/17/2022  03:45 PM               331 opencl_kernels_ximgproc.hpp


 Directory of C:\source\opencv-4.5.5\build\opencv2

02/17/2022  03:33 PM             1,897 opencv_modules.hpp


     Total Files Listed:
             111 File(s)        397,949 bytes

world or not shouldn’t matter, but it’s best to change one thing at a time.

I can’t speculate on what might be going on.

I’d recommend going one step back, and examining the configure and generate steps of cmake.

of course, use cmake-gui because menus are discoverable. there’s a time for magic spells, and this is not it.

disable all the individual modules of contrib, then see if that builds. then activate some (and note which), and see when problems appear.

1 Like

I’m using cmake-gui: rebuilt with no options changed at all. It still isn’t placing opencv.hpp anywhere in the build subtree. Is my understanding at fault here? Shouldn’t this build result in a file structure essentially identical to what I get from simply unpacking the prebuilt distro?

assuming, you built the INSTALL project in VS (did you ?), headers will get copied to build/install/include

2 Likes

Thanks, Berak! Red face here – I was building the entire solution, which I mistakenly assumed was building every subproject. Forcing the INSTALL build gave me a header structure under /build/install/include that matches the distro unpack.

well, you’re not the 1st person to expect, that BUILD_ALL would do this
(well, it doesnt)