Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fletch build failure, (OpenCV patch) OpenCV/FFmpeg/libbz2 management not correct #180

Open
d-hoke opened this issue Aug 10, 2017 · 3 comments

Comments

@d-hoke
Copy link

d-hoke commented Aug 10, 2017

This fletch OpenCV3 patch (1a97ac3) with its if() section containing "FIND_LIBRARY(BZIP2_LIBRARIES NAMES bz2 bzip2)" apparently presumes that FFmpeg will have been built incorporating bz2 support, when that support is only conditionally compiled (subject to CONFIG_BZLIB in matroskadec.c), and FFmpeg may configure/build without a requirement of bz2 support.

On systems that may have only versioned instances of the bz2 shared library locatable (no locatable unversioned library or unversioned symlink present), a build failure may occur with cmake not finding the correct bz2 library via FIND_LIBRARY() and thus executing the FIND_FILE() which, in my 64bit targeted build, finds and refs the 32bit version of the library (curiously, twice, in the opencv_videoio link.txt). The OpenCV ld therefore fails, finding the (actually unnecessary) 32bit library to be in the wrong format (for the 64bit targeted build) and failing to complete.

Either of, A) removing the incorrect 32bit ref's from the link.txt, or, B) changing them to reference the correct available 64bit versioned instances of the library, allows the link to complete successfully.

See https://gitlab.kitware.com/cmake/cmake/issues/17131 for a bit more information on the circumstances leading to the failure and this discovery.

@mathstuf
Copy link
Contributor

I commented on the patch which added the faulty logic directly, but it shouldn't be necessary.

Cc: @dstoup

@d-hoke
Copy link
Author

d-hoke commented Aug 11, 2017

I replied to your comment there, but am also reproducing here further below for continuity within this issue.

I suspect the safest (simplest?) solution might be for fletch to obtain and build libbz2 for local use also, since it's already obtaining and building many packages. (FFmpeg, OpenCV, and boost 1.55 bzip2 functionality could all then reference the local copy.)

reproduced from patch (1a97ac3)
1)IIUC, FFmpeg may have been built by fletch rather than installed by a package manager.
2)FFmpeg is only optionally dependent on bz2 (CONFIG_BZLIB), and will configure and build without it (and it did so in my environment.)
3)Should fletch perhaps obtain and build a version of bz2 (perhaps static library version?) for FFmpeg use? And then use it for OpenCV here as well? (Might be useful for building boost as well...)

@mathstuf
Copy link
Contributor

Yes, if fletch is using projects which require bzip2, it should either provide it or error out for it not existing on the system. IIRC, providing dependencies is Fletch's purpose.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants