conan-io / conan-center-index

Recipes for the ConanCenter repository
https://conan.io/center
MIT License
972 stars 1.78k forks source link

[package] ffmpeg/6.1.1: dlls not found with CMake find_package on windows. #26047

Open TrevorCash opened 1 day ago

TrevorCash commented 1 day ago

Description

After conan installing ffmpeg/6.1.1 with shared libs enabled. I get the following errors when calling find_package from my CMake project:

find_package(ffmpeg REQUIRED)

-- Conan: Component target declared 'ffmpeg::avutil'
-- Conan: Component target declared 'ffmpeg::swscale'
-- Conan: Component target declared 'ffmpeg::swresample'
-- Conan: Component target declared 'ffmpeg::postproc'
-- Conan: Component target declared 'ffmpeg::avcodec'
-- Conan: Component target declared 'ffmpeg::avformat'
-- Conan: Component target declared 'ffmpeg::avfilter'
-- Conan: Component target declared 'ffmpeg::avdevice'
-- Conan: Target declared 'ffmpeg::ffmpeg'
-- Conan: Library avdevice found C:/Users/tcash/.conan2/p/b/ffmpebeb0eaa318e8f/p/lib/avdevice.lib
-- Cannot locate shared library: avdevice
...
..
.

after inspecting the C:/Users/tcash/.conan2/p/b/ffmpebeb0eaa318e8f/p/bin directory, it shows dlls with extra version names - which I am guessing is why CMake is not finding it:

image

After inserting some debug messages in cmakedeps_macros.cmake: package_bindir is C:/Users/tcash/.conan2/p/b/ffmpebeb0eaa318e8f/p/bin CMAKE_FIND_LIBRARY_SUFFIXES is .dll;.dll.lib;.lib;.a

Package and Environment Details

visual studio 2022

Conan profile

[settings] arch=x86_64 build_type=Release compiler=msvc compiler.cppstd=17 compiler.runtime=dynamic compiler.version=194 os=Windows

Steps to reproduce

install ffmpeg/6.1.1 and use CMake FindPackage

Logs

-- Conan: Component target declared 'ffmpeg::avutil' -- Conan: Component target declared 'ffmpeg::swscale' -- Conan: Component target declared 'ffmpeg::swresample' -- Conan: Component target declared 'ffmpeg::postproc' -- Conan: Component target declared 'ffmpeg::avcodec' -- Conan: Component target declared 'ffmpeg::avformat' -- Conan: Component target declared 'ffmpeg::avfilter' -- Conan: Component target declared 'ffmpeg::avdevice' -- Conan: Target declared 'ffmpeg::ffmpeg' -- Conan: Library avdevice found C:/Users/tcash/.conan2/p/b/ffmpebeb0eaa318e8f/p/lib/avdevice.lib -- Cannot locate shared library: avdevice

uilianries commented 11 hours ago

@TrevorCash Hello and thank you for sharing your case.

The ffmpeg Conan looks fine, as we just built it as shared library in the CI and I locally built it too. Please, check my setup and build log: https://gist.github.com/uilianries/1ab22aa6f78754c192c25b537977db0e

I would suggest talking a look in the Conan tutorial how to consume packages: https://docs.conan.io/2/tutorial/consuming_packages/build_simple_cmake_project.html