Open Haeri opened 2 years ago
Your vcpkg maybe out-dated, can you please git pull and try again? Also, I can't repro this issue locally.
Thanks.
I updated it to the latest commit (b71b444d5f2c81d2c642ac63bf230efac8a96dd3) as you can see here: https://github.com/Haeri/ElementalDraw/tree/071b800965b62e2bb2620358ad6d48d652b25719/external
But I still get the exact same issue https://github.com/Haeri/ElementalDraw/runs/5139763195?check_suite_focus=true#step:4:408
I also get the exact same issue on my local windows machine
We haven't been able to repro this; if more information comes up, or this issue appears again, please reopen.
@JackBoosY It's an issue with the FindFFmpeg.cmake
module file, not the port itself. The port will successfully build, but when you try to use it in a CMake project according to the instructions provided after the build:
find_package(ffmpeg MODULE REQUIRED)
...it fails with the error as reported by @Haeri above.
As a workaround, I'm using find_path
and find_library
in my project instead of find_package
:
find_path(FFMPEG_INCLUDE_DIR "libavformat/avformat.h" REQUIRED)
find_library(LIBAVFORMAT avformat REQUIRED)
find_library(LIBAVCODEC avcodec REQUIRED)
find_library(LIBAVUTIL avutil REQUIRED)
find_library(LIBSWRESAMPLE swresample REQUIRED)
Then I can compile and link using target_include_directories
and target_link_libraries
using those set variables.
This issue should be reopened and the FindFFmpeg.cmake.in
file should be investigated.
In order to reproduce this issue you have to run cmake from non-developer terminal. It is strange though, because cmake still finds correct toolchain and proceeds to configure project to eventually fail. Developer prompt must be setting up some environment variable that helps find_library(FFMPEG_DEPENDENCY_${lib_name}_${config} NAMES "${lib_name}" REQUIRED)
to find the library in one of default paths.
This is an automated message. Per our repo policy, stale issues get closed if there has been no activity in the past 28 days. The issue will be automatically closed in 14 days. If you wish to keep this issue open, please add a new comment.
I also ran into this issue, after some digging I found that FindFFMPEG.cmake
will call
find_library(FFMPEG_DEPENDENCY_${lib_name}_${config} NAMES "${lib_name}" REQUIRED
To find a set of required system libraries. those system libraries comes from the various pc files
If you link dynamically we will find psapi in libavdevice.pc
Libs: "-L${libdir}" -lavdevice
Libs.private: -lpsapi -lole32 -lstrmiids -luuid -loleaut32 -lshlwapi -lgdi32 -lvfw32
note there that the dependency is "private" so it will not be added to the find_library
above.
But if we link statically we have
Libs: "-L${libdir}" -lavdevice -lpsapi -lole32 -lstrmiids -luuid -loleaut32 -lshlwapi -lgdi32 -lvfw32
these are now public so they are added to the find_library
call above
psapi
is a windows system library that lives in for example, (version and so platforms my vary)
C:/Program Files (x86)/Windows Kits/10/Lib/10.0.22621.0/um/x64/psapi.lib
When you run cmake from a developer terminal this path get automatically picked up by cmake (somwhow, not sure exactly which env variable that it will read) and then every thing work.
But if we run the cmake-gui directly we have not such luck and we can't find the needed libs.
Ideally we should be able to give the find_library
some hint to look into the "right" WindowsSDK directory. But I have not found a good way to get the "right" path, with out a developer terminal
I wonder if there should be a find_library
at all, or if psapi
shouldn't be simply used as is. find_library
doesn't consider all locations searched by the linker.
@LilyWangLL Consider to reopen this issue?
This should be fixed in #39703
Describe the bug Windows static version of ffmpeg fails with the following message:
Environment
To Reproduce Steps to reproduce the behavior:
cmake .. -DVCPKG_TARGET_TRIPLET="x64-windows-static" -DCMAKE_TOOLCHAIN_FILE="%root_path%\external\vcpkg\scripts\buildsystems\vcpkg.cmake" -DBUILD_SHARED_LIBS=OFF
to create my solution filesExpected behavior The expected behavior would be for the cmake script to succeed in creating a solution file.
Failure logs
See the full logs here: https://github.com/Haeri/ElementalDraw/runs/5132276972?check_suite_focus=true#step:4:407
Additional context The non-static windows build works fine as well as macos.