-
Notifications
You must be signed in to change notification settings - Fork 6.4k
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
OpenCV should copy/install opencv_ffmpeg340_64.dll #2799
Comments
I can try to figure this out in my free time. |
I did a bit of investigation and determined the following:
|
Hmm that's cool :D But how does it help us? Are you saying that vcpkg actually inspects the compiled executable, and then only copies the dll's that are necessary? So what you want to do is figure out after compilation whether an executable contains references to ffmpeg, and if so, copy the ffmpeg dll to the build/install directory? |
Yep, we do exactly that [1]!
And that's plan A if it works. The current issue that I'm aware of is that |
Maybe use |
I want to add that another issue with opencv_ffmpeg340_64.dll is that the opencv[ffmpeg] package does not export opencv_ffmpeg library target at all. Therefore I cannot easily create workaround in my project by copying this target explicitly. Could you please export the opencv_ffmpeg target when opencv[ffmpeg] is built? I think that grepping target dependent libraries for a strings which look like names of other shared libraries, and assume that they are potentially run-time loaded is a quite fragile approach. IMHO the right way is to use the available CMake mechanisms to accomplish this. I never used the shared library property IMPORTED_LINK_DEPENDENT_LIBRARIES, but it seems to me that this could be the right way to express that opencv_videoio library has dependency to opencv_ffmpeg library. https://cmake.org/cmake/help/v3.10/prop_tgt/IMPORTED_LINK_DEPENDENT_LIBRARIES.html Unfortunately, it seems that vcpkg does not copy automatically the libraries added to IMPORTED_LINK_DEPENDENT_LIBRARIES. In my project right before the use of the exported target opencv_videoio I have added a workaround code which created imported shared library target named opencv_ffmpeg (based on the imported location of opencv_videoio). I have added this opencv_ffmpeg target to the IMPORTED_LINK_DEPENDENT_LIBRARIES property of the opencv_videoio, but this does not fixed the installation of the opencv_ffmpeg340_64.dll. Does one have to expect that vcpkg would copy the libraries listed in IMPORTED_LINK_DEPENDENT_LIBRARIES property of a linked library target? I have also noticed that opencv_ffmpeg340_64.dll is the only one library which is created in the Debug sub-directory located in the release binary directory. The same is exactly reversed for the debug build. In this case opencv_ffmpeg340_64.dll is the only one library which is created in the Release sub-directory located in the debug binary directory. buildtrees/opencv/x64-windows-rel/bin/Debug/opencv_ffmpeg340_64.dll buildtrees/opencv/x64-windows-dbg/bin/Release/opencv_ffmpeg340_64.dll Is it this a bug or this is intentional? In addition no import libraries are generated for opencv_ffmpeg, also not even in the build directory tree, but this is a way more probable to be intentional, in order to prevent users from linking directly to this library. |
@coderaper Did you try the |
@cenit I have tried to build the external ffmpeg branch, but opencv build fails because the FFMPEG package cannot be found. As far as I can see, another reason for the configuration error can be that the installed libpng headers are located in installed\x64-windows\include\libpng16 and not in installed\x64-windows\include\libpng. vcpkg-ext-ffmpeg>vcpkg install opencv[qt,ffmpeg,core,eigen,tiff,png,jpeg]:x64-windows Call Stack (most recent call first): Error: Building package opencv:x64-windows failed with: BUILD_FAILED Additionally, attach any relevant sections from the log files above. Content of config-x64-windows-out.log: -- Configuring incomplete, errors occurred! Content of vcpkg-ext-ffmpeg\buildtrees\opencv\x64-windows-dbg\CMakeFiles\CMakeError.log: Run Build Command:"C:/balkanski/work/vcpkg-ext-ffmpeg/downloads/tools/ninja/ninja-1.8.2/ninja.exe" "cmTC_cce1d" vcpkg-ext-ffmpeg>vcpkg list libpng vcpkg-ext-ffmpeg>dir vcpkg-ext-ffmpeg\installed\x64-windows\include\libpng16 vcpkg-ext-ffmpeg>vcpkg list ffmpeg |
@ras0219-msft I don't know if the GNU Binutils are accepted as vcpkg tools, but the strings utility in combination with grep seems to work: strings --encoding=l opencv_videoio340.dll | grep "\.dll" If the use of 16-bit littleendian encoding is not specified (--encoding=l command line switch), than I guess strings searches for single-8-bit-byte characters and other dll names are found: strings opencv_videoio340.dll | grep "\.dll" |
I just want to kindly ask, if any progress has been made on this. |
Just stumbled upon this problem myself. Does anyone have any updates on this issue? |
As we found out in #2613,
opencv_ffmpeg340_64.dll
is not copied over to the build/install folder, and causes all operations in OpenCV that use ffmpeg to sort-of "silently" fail. For example, reading from the camera or from video files doesn't work unless the file is manually copied.The text was updated successfully, but these errors were encountered: