[Slackbuilds-users] opencv-legacy issue

Christoph Willing chris.willing at linux.com
Sun Mar 10 22:30:14 UTC 2019

On 11/3/19 12:20 am, Tim Dickson wrote:
> On 10/03/2019 07:32, Christoph Willing wrote:
>> On 8/3/19 10:10 pm, Tim Dickson via SlackBuilds-users wrote:
>>> I think the problem is that opencv version 4 reports itself as opencv4
>>> to pkg-config whereas opencv-legacy reports itself as opencv
>>> copying /usr/lib64/pkgconfig/opencv4 to /usr/lib64/pkgconfig/opencv gets
>>> further and bails at
>>> /usr/include/opencv4/opencv2/core/cvdef.h:109:47: warning: "__cplusplus"
>>> is not defined [-Wundef]
>>>   #  if (defined(__GXX_EXPERIMENTAL_CXX0X__) || __cplusplus >= 201103L)
>>>                                                 ^
>>> In file included from /usr/include/opencv4/opencv2/core/types_c.h:82:0,
>>>                   from /usr/include/opencv4/opencv2/core/core_c.h:48,
>>>                   from video_filter/opencv_wrapper.c:42:
>>> /usr/include/opencv4/opencv2/core/cvdef.h:647:7: warning: "__cplusplus"
>>> is not defined [-Wundef]
>>>   #  if __cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >=
>>> 1800)
>>>         ^
>>> /usr/include/opencv4/opencv2/core/cvdef.h:656:4: error: #error "OpenCV
>>> 4.x+ requires enabled C++11 support"
>>>   #  error "OpenCV 4.x+ requires enabled C++11 support"
>>>      ^
>>> /usr/include/opencv4/opencv2/core/cvdef.h:661:17: fatal error: array: No
>>> such file or directory
>>> compilation terminated.
>>> Makefile:21527: recipe for target
>>> 'video_filter/libopencv_wrapper_plugin_la-opencv_wrapper.lo' failed
>>> make[4]: ***
>>> [video_filter/libopencv_wrapper_plugin_la-opencv_wrapper.lo] Error 1
>>> make[4]: Leaving directory '/tmp/SBo/vlc-3.0.6/modules'
>>> Makefile:26254: recipe for target 'all-recursive' failed
>>> make[3]: *** [all-recursive] Error 1
>>> make[3]: Leaving directory '/tmp/SBo/vlc-3.0.6/modules'
>>> Makefile:11314: recipe for target 'all' failed
>>> make[2]: *** [all] Error 2
>>> make[2]: Leaving directory '/tmp/SBo/vlc-3.0.6/modules'
>>> Makefile:1539: recipe for target 'all-recursive' failed
>>> make[1]: *** [all-recursive] Error 1
>>> make[1]: Leaving directory '/tmp/SBo/vlc-3.0.6'
>>> Makefile:1424: recipe for target 'all' failed
>>> make: *** [all] Error 2
>>> To fix that error I had to modify the slackbuild, specifically the line
>>> calling ./configure see below
>>> CXXFLAGS="$SLKCFLAGS -std=c++11" \
>> Hi Tim,
>> I thought I'd try this out but even with the -std=c++11 added to
>> CXXFLAGS, I still see the same error about missing c++11 suport. Do you
>> recall doing anything else to help the compilation along?
>> chris
> my appologies, when I tested it last, it was from a command prompt so I
> forgot to add the OPENCV=yes WAYLAND=yes before calling the build script.
> I too am getting it complaining about c++11 for opencv despite it being
> added to the CXXFLAGS in configure, and thus in the makefile. It may be
> that opencv is being called as c instead of c++ but I haven't managed to
> find out more yet.
> regards, Tims

I just progressed a little further but am stuck again now - reporting
progress in case you (or anyone else?) have any ideas ...

I renamed opencv_wrapper.c as opencv_wrapper.cpp and changed the
appropriate references in modules/video_filter/Makefile.am and ran:
    CXXFLAGS="-fpermissive" ./configure

which successfully build

The associated example is already c++ (opencv_example.cpp) so no
trickery applied but compilation stopped with:

  CXX      video_filter/libopencv_example_plugin_la-opencv_example.lo
video_filter/opencv_example.cpp: In function 'int
video_filter/opencv_example.cpp:119:76: error: 'cvLoad' was not declared
in this scope
     p_sys->p_cascade = (CvHaarClassifierCascade*)cvLoad( filename, 0,
0, 0 );

video_filter/opencv_example.cpp: In function 'void
video_filter/opencv_example.cpp:135:59: error:
'cvReleaseHaarClassifierCascade' was not declared in this scope
         cvReleaseHaarClassifierCascade( &p_sys->p_cascade );
video_filter/opencv_example.cpp: In function 'picture_t*
Filter(filter_t*, picture_t*)':
video_filter/opencv_example.cpp:178:45: error:
'CV_HAAR_DO_CANNY_PRUNING' was not declared in this scope
video_filter/opencv_example.cpp:179:60: error: 'cvHaarDetectObjects' was
not declared in this scope
                                             cvSize(20, 20) );
video_filter/opencv_example.cpp:204:57: warning: ISO C++ forbids
converting a string constant to 'char*' [-Wwrite-strings]
             p_sys->event_info.p_region[i].p_description = "Face Detected";
Makefile:23518: recipe for target
'video_filter/libopencv_example_plugin_la-opencv_example.lo' failed

I looked around but couldn't find a cvLoad function (the first error
mentioned) in the opencv4 headers - I guess it's from a very early
opencv version.

I'm not sure where to go from here so any help would be appreciated.


More information about the SlackBuilds-users mailing list