[Slackbuilds-users] opencv-legacy issue

Christoph Willing chris.willing at linux.com
Thu Mar 7 07:31:28 UTC 2019

On 7/3/19 6:15 am, Tim Dickson via SlackBuilds-users wrote:
> since updating python to 3.7.2 opencv-legacy fails to build with ..
> [ 85%] Generating pyopencv_generated_include.h,
> pyopencv_generated_funcs.h, pyopencv_generated_types.h,
> pyopencv_generated_type_reg.h, pyopencv_generated_ns_reg.h
> cd /tmp/SBo/opencv-3.1.0/build/modules/python3 && /usr/bin/python3
> /tmp/SBo/opencv-3.1.0/modules/python/python3/..//src2/gen2.py
> /tmp/SBo/opencv-3.1.0/build/modules/python3
> /tmp/SBo/opencv-3.1.0/build/modules/python3/headers.txt
> Note: Class l has more than 1 base class (not supported by Python C
> extensions)
>       Bases:  cv::a, cv::s, cv::s, cv::A, cv::l, cv::g, cv::o, cv::r,
> cv::i, cv::t, cv::h, cv::m
>       Only the first base class will be used
> Note: Class l has more than 1 base class (not supported by Python C
> extensions)
>       Bases:  cv::a, cv::s, cv::s, cv::F, cv::i, cv::l, cv::e, cv::S,
> cv::t, cv::o, cv::r, cv::a, cv::g, cv::e
>       Only the first base class will be used
> Generator error: class l (cname=cv::l) already exists
> modules/python3/CMakeFiles/opencv_python3.dir/build.make:276: recipe for
> target 'modules/python3/pyopencv_generated_include.h' failed
> make[2]: *** [modules/python3/pyopencv_generated_include.h] Error 255
> make[2]: Leaving directory '/tmp/SBo/opencv-3.1.0/build'
> CMakeFiles/Makefile2:14021: recipe for target
> 'modules/python3/CMakeFiles/opencv_python3.dir/all' failed
> make[1]: *** [modules/python3/CMakeFiles/opencv_python3.dir/all] Error 2
> make[1]: Leaving directory '/tmp/SBo/opencv-3.1.0/build'
> Makefile:160: recipe for target 'all' failed
> make: *** [all] Error 2
> I've checked, and made sure  opencv-legacy was not previously installed
> when trying to recreate the package.
> any ideas?

It seems python3-3.7.2 is necessary but not sufficient by itself to
trigger this fault. It's actually the presence of the optional numpy3
(which requires python3) during configuration that enables building of
the python3 wrappers, generating the error above during compilation.

The simplest fix is to remove numpy3 from the system. Even with python3
still installed (perhaps needed for other packages), the python3
wrappers will not be generated if numpy is not available during

This strategy allows opencv-legacy to build to completion but, of course
without python3 wrappings. Is that a bit deal? Maybe but mitigated by:
    1. possible use of python2 wrappings instead by installing numpy
(not numpy3) which will use built in python2 to generate python2 wrappings.
    2. initially, the only reason for having the opencv-legacy
SlackBuild at all was to satisfy building a particular version of
libkface which was required, in turn, for a particular version of
digikam. AFAIK the python3 wrappings are not needed for this use case.

Serious opencv users that may want the python3 bindings won't be using
opencv-legacy anyway; rather the main opencv. The building of the main
opencv package doesn't suffer this python3/numpy3 problem so I'm
prepared to leave things as they are for opencv-legacy. Of course, if
someone wants to research a fix, I'll happily apply it.


More information about the SlackBuilds-users mailing list