Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 666716

Summary: media-libs/opencv-3.4.1-r4: Unhandled automagic dependency on >=dev-games/ogre-1.10[experimental] contrib
Product: Gentoo Linux Reporter: Andreas Sturmlechner <asturm>
Component: Current packagesAssignee: Amy Liffey <amynka>
Status: RESOLVED FIXED    
Severity: normal CC: gentoo, sven.eden
Priority: Normal Keywords: PullRequest
Version: unspecified   
Hardware: All   
OS: Linux   
See Also: https://github.com/gentoo/gentoo/pull/17307
https://github.com/gentoo/gentoo/pull/17899
Whiteboard:
Package list:
Runtime testing required: ---
Attachments: build.log
Fix building against ogre-1.12.x

Description Andreas Sturmlechner gentoo-dev 2018-09-21 18:02:25 UTC
Created attachment 547494 [details]
build.log

opencv_contrib-3.4.1/modules/ovis/CMakeLists.txt has:

find_package(OGRE 1.10 QUIET)

...en-/disabling ovis module based on availability of >=ogre-1.10.
Comment 1 Andreas Sturmlechner gentoo-dev 2018-09-21 18:08:38 UTC
Oh, and the build error as follows:

/var/tmp/portage/media-libs/opencv-3.4.1-r4/work/opencv_contrib-3.4.1/modules/ovis/src/ovis.cpp:7:10: fatal error: OgreApplicationContext.h: No such file or directory
 #include <OgreApplicationContext.h>
          ^~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.


@Sven, do you have an idea where this should be coming from (USE-flag)?
Comment 2 Andreas Sturmlechner gentoo-dev 2018-09-21 19:03:09 UTC
Found it.

@Sven, is USE=experimental going to stay with >=ogre-1.11 and >=ogre-2 as well, will it be a different USE flag or part of the default installation? That will influence how this dependency needs to be declared in opencv ebuild.
Comment 3 Jouni Kosonen 2018-09-22 00:23:02 UTC
Bug 647266 comment 22 suggests that the dependency should be 
contrib? ( dev-games/ogre[experimental(+)] )
Comment 4 Sven Eden 2018-09-23 09:34:47 UTC
(In reply to Andreas Sturmlechner from comment #2)
> Found it.
> 
> @Sven, is USE=experimental going to stay with >=ogre-1.11 and >=ogre-2 as
> well, will it be a different USE flag or part of the default installation?
> That will influence how this dependency needs to be declared in opencv
> ebuild.

The referenced "BITES" component is only marked as experimental in the Ogre 1.10 series, and a core component from Ogre 1.11 on. So this flag is only needed with Ogre 1.10 enabled. (*)

However, it is really only "ovis" that uses Ogre. Maybe an "ogre" USE flag that enables the "Ogre VISualizer" would be in order?
Or maybe, as there are several contrib_* flags already, a contrib_ovis flag? It could read:
  "OVIS module requires dev-games/ogre"
which would nicely fall in line as well.

(*) I _think_ that the OpenCV ovis module is only compatible with Ogre-1.10, but I haven't checked against Ogre-1.11 or 2.1, yet.
Comment 5 Jouni Kosonen 2018-10-08 10:03:55 UTC
(In reply to Sven Eden from comment #4)
> (*) I _think_ that the OpenCV ovis module is only compatible with Ogre-1.10,
> but I haven't checked against Ogre-1.11 or 2.1, yet.
FWIW, at least opencv-3.4.3 does build against ogre-1.11.2[-experimental] too.
Comment 6 Sven Eden 2020-01-13 07:28:56 UTC
Created attachment 603134 [details, diff]
Fix building against ogre-1.12.x

As long as OpenCV has no USE flag to allow or deny building of the OVIS app, the build system will automagically enable it when it detects the presence of Ogre.

Unfortunately it does not detect the version.

The latest stable Ogre release is 1.12.4, which is currently masked in the tree for reverse dependency checking. One of these is OpenCV, but only implicitly.

The provided patch removes the only single point of failure to build against ogre-1.12.4. 

As a side note: OpenCV-4.1.2 does not build against ogre-1.9.0 and *needs* ogre-1.12.4.

Now to the evil part:
While this patch makes the ovis app in opencv-3.x to compile against ogre-1.12.4, it also breaks building against ogre-1.9.0.
Comment 7 Sven Eden 2020-09-16 07:59:55 UTC
And there is something new with ogre-1.12.8 in the tree:

OpenCV uses some deprecated features, so if ogre-1.12.x is installed, it must have the "deprecated" USE flag enabled, or OpenCV will fail with:

--------
/data/portage/portage/media-libs/opencv-4.1.2-r3/work/opencv_contrib-4.1.2/modules/ovis/src/ovis.cpp: In member function ‘virtual void cv::ovis::WindowSceneImpl::createLightEntity(const String&, cv::InputArray, cv::InputArray, const Scalar&, const Scalar&)’:
/data/portage/portage/media-libs/opencv-4.1.2-r3/work/opencv_contrib-4.1.2/modules/ovis/src/ovis.cpp:550:16: error: ‘class Ogre::Light’ has no member named ‘setDirection’
  550 |         light->setDirection(Vector3::NEGATIVE_UNIT_Z);
      |                ^~~~~~~~~~~~
--------

The background is, that lights must now be attached to nodes, which are then used to set the direction.
But if ogre is installed with USE="deprecated", then the nodeless positioning of lights is re-enabled.

See:
--------
 ~ # eix -c -e ogre ; eix -c -e opencv
[I] dev-games/ogre (1.12.8(0/1.12)@16.09.2020): Object-oriented Graphics Rendering Engine
[I] media-libs/opencv (4.1.2-r3(0/4.1.2)@16.09.2020): A collection of algorithms and sample code for various computer vision problems
--------
Comment 8 Sven Eden 2020-09-16 08:15:39 UTC
Also I just reviewed the PR and I am convinced that unconditionally disabling OVIS is the wrong way to go.

I would:
1. Add a USE flag "ovis"
2. Make opencv depend on
    ovis? =dev-games/ogre-1.12*[deprecated]

If I remember correctly, opencv-4 does no longer build against (ancient!) ogre-1.9.
Comment 9 Larry the Git Cow gentoo-dev 2020-10-16 21:47:59 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=5c21b91ad2464439514aae406a0c0d5f310aca1d

commit 5c21b91ad2464439514aae406a0c0d5f310aca1d
Author:     Ross Charles Campbell <rossbridger.cc@gmail.com>
AuthorDate: 2020-10-14 02:17:02 +0000
Commit:     Sam James <sam@gentoo.org>
CommitDate: 2020-10-16 21:47:50 +0000

    media-libs/opencv: version bump to 4.5.0
    
    Bug: https://bugs.gentoo.org/701790
    Bug: https://bugs.gentoo.org/700176
    Bug: https://bugs.gentoo.org/717812
    Bug: https://bugs.gentoo.org/703658
    Bug: https://bugs.gentoo.org/689838
    Closes: https://bugs.gentoo.org/666716
    Closes: https://bugs.gentoo.org/747163
    Closes: https://bugs.gentoo.org/729190
    Closes: https://bugs.gentoo.org/699730
    Closes: https://bugs.gentoo.org/672840
    Package-Manager: Portage-3.0.8, Repoman-3.0.1
    
    Signed-off-by: Ross Charles Campbell <rossbridger.cc@gmail.com>
    Closes: https://github.com/gentoo/gentoo/pull/17899
    Signed-off-by: Sam James <sam@gentoo.org>

 media-libs/opencv/Manifest            |   2 +
 media-libs/opencv/opencv-4.5.0.ebuild | 555 ++++++++++++++++++++++++++++++++++
 2 files changed, 557 insertions(+)