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

Ythogtha yth at ythogtha.org
Wed Mar 14 13:41:32 UTC 2018


> On Tue, 13 Mar 2018 16:53:37 +0100
> Frédéric Falsetti <falsetti at clansco.org> wrote:
> 
> > On Tue, 13 Mar 2018 23:33:53 +1000
> > Christoph Willing <chris.willing at iinet.net.au> wrote:
> > 
> > 
> > > 
> > > An interesting problem - opencv is optional for ffmpeg and ffmpeg is
> > > optional for opencv i.e. an optional circular dependency.
> > > 
> > 
> > to compile ffmpeg against  I have to :
> to compile ffmpeg against CHROMAPRINT ;/
> 
> > 1) build ffmpeg without CHROMAPRINT,
> > 2) rebuild CHROMAPRINT,
> > 3) compile ffmpeg with CHROMAPRINT
> 
> perhaps this can help  for opencv

Well, that's the initial step for building ffmpeg with OpenCV.
That or the reverse : building openCV without ffmpeg, then ffmpeg with openCV
then openCV with ffmpeg.
But I did that quite some time ago and since then I could always build one of
them with the existing other one built against the older version.
And besides, OpenCV builds just fine, and the various binaries are launching
with every version.

	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.

	The ffmpeg problem is fully solved, it compiles fine with openCV
installed correctly in /usr/lib64/, and it even works when built against
OpenCV 3.4.0 with OpenCV is bumped to 3.4.1. And it still works when bumping
ffmpeg to 3.4.2.

Here is my opencv.SlackBuild diff :
diff --git a/libraries/opencv/opencv.SlackBuild
b/libraries/opencv/opencv.SlackBuild index 13e5dea42b..0a0a569600 100644
--- a/libraries/opencv/opencv.SlackBuild
+++ b/libraries/opencv/opencv.SlackBuild
@@ -27,7 +27,7 @@
 PRGNAM=opencv
 PRGNAM2=opencv_contrib
 VERSION=${VERSION:-3.4.1}
-BUILD=${BUILD:-2}
+BUILD=${BUILD:-3}
 TAG=${TAG:-_SBo}

 if [ -z "$ARCH" ]; then
@@ -51,7 +51,7 @@ elif [ "$ARCH" = "i686" ]; then
   LIBDIRSUFFIX=""
 elif [ "$ARCH" = "x86_64" ]; then
   SLKCFLAGS="-O2 -fPIC"
-  LIBDIRSUFFIX="64"
+  LIBDIRSUFFIX=""
 else
   SLKCFLAGS="-O2"
   LIBDIRSUFFIX=""
@@ -137,4 +137,6 @@ mkdir -p $PKG/install
 cat $CWD/slack-desc > $PKG/install/slack-desc

 cd $PKG
+mv usr/lib/* usr/lib64
+rmdir usr/lib
 /sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.
${PKGTYPE:-tgz}

	I, sadly, don't have enough time to investigate further on how to
correct the build so that everything is at the right place.

-- 
Arnaud <yth at ythogtha.org>


More information about the SlackBuilds-users mailing list