[Slackbuilds-users] OpenCV SlackBuild bug - Was: ffmpeg does not compile with opencv 3.4.1

Christoph Willing chris.willing at linux.com
Thu Mar 15 06:15:58 UTC 2018

On 15/03/18 05:51, Matteo Bernardini wrote:
> 2018-03-14 14:41 GMT+01:00 Ythogtha <yth at ythogtha.org>:
>>         Anyway, I found the problem.
>> It's with the opencv.SlackBuild, or more precisely with opencv itself because
>> the SlackBuild didn't change and was working fine before.
>> OpenCV libraries are installed in /usr/lib6464/ !
>> In the opencv.SlackBuild there is a LIBDIRSUFFIX="64" configured when ARCH=x86_64
>> and it seems the opencv make process now does that step itself, installing
>> itself into /usr/lib64, so adding the LIBDIRSUFFIX="64" moves the .so files
>> into /usr/lib6464/
>>         So setting LIBDIRSUFFIX="" looks like a good idea.
>> Except then there are python libraries installed in /usr/lib/ !
>> usr/lib/python2.7/site-packages/cv2.so
>> usr/lib/python3.6/site-packages/cv2.cpython-36m-x86_64-linux-gnu.so
>> And import cv2 doesn't work in either python or python3.
>>         I tried moving usr/lib/python* into usr/lib64/ just before makepkg in the
>> SlackBuild, and everything seems to work fine, I can import cv2 in python and
>> python3. The hack is ugly and there should be a cleaner way to handle that.
> IMHO the best solution for that is to modify a little more the patch
> used by the SlackBuild: I attach the new version

Thanks all for spotting the problem. I've just pushed a fix for it.

While working through this myself, I noticed that the requirement for
python3 to generate a python3 binding no longer works unless numpy3 is
also installed at build time. Since numpy3 requires python3, I've
replaced the requirement for python3 with numpy3.

Back to the original problem of building ffmpeg with opencv support, I
haven't been able to compile that successfully. The configure phase
finds opencv OK but compilation fails with:

In file included from /usr/include/opencv2/core/types_c.h:59:0,
                 from /usr/include/opencv2/core/core_c.h:48,
                 from libavfilter/vf_libopencv.c:28:
/usr/include/opencv2/core/cvdef.h:485:1: error: unknown type name
 namespace cv {
/usr/include/opencv2/core/cvdef.h:485:14: error: expected '=', ',', ';',
'asm' or '__attribute__' before '{' token
 namespace cv {
common.mak:60: recipe for target 'libavfilter/vf_libopencv.o' failed
make: *** [libavfilter/vf_libopencv.o] Error 1

It's not something I want to spend a lot of time trying to fix - for my
own use I have the dependency the other way around by building opencv
with ffmpeg support. However if anyone can propose a fix, I'm happy (and
grateful) to include it in the SlackBuild.


More information about the SlackBuilds-users mailing list