microsoft / vcpkg

C++ Library Manager for Windows, Linux, and MacOS
MIT License
22.81k stars 6.3k forks source link

[ffmpeg] Build error on x64-linux (using CMAke on Ubuntu VM) #40222

Open orsnaro opened 1 month ago

orsnaro commented 1 month ago

issue_body.md

LilyWangLL commented 1 month ago

This issue can not repro on the latest vcpkg, the latest version of ffmpeg is 6.1.1#11.

Installing 3/3 ffmpeg[avcodec,avdevice,avfilter,avformat,core,swresample,swscale]:x64-linux@6.1.1#11...
Building ffmpeg[avcodec,avdevice,avfilter,avformat,core,swresample,swscale]:x64-linux@6.1.1#11...
-- Downloading https://github.com/ffmpeg/ffmpeg/archive/n6.1.1.tar.gz -> ffmpeg-ffmpeg-n6.1.1.tar.gz...
-- Extracting source /mnt/lily/0722/downloads/ffmpeg-ffmpeg-n6.1.1.tar.gz
-- Applying patch 0001-create-lib-libraries.patch
-- Applying patch 0002-fix-msvc-link.patch
-- Applying patch 0003-fix-windowsinclude.patch
-- Applying patch 0004-dependencies.patch
-- Applying patch 0005-fix-nasm.patch
-- Applying patch 0007-fix-lib-naming.patch
-- Applying patch 0012-Fix-ssl-110-detection.patch
-- Applying patch 0013-define-WINVER.patch
-- Applying patch 0020-fix-aarch64-libswscale.patch
-- Applying patch 0040-ffmpeg-add-av_stream_get_first_dts-for-chromium.patch
-- Applying patch 0041-add-const-for-opengl-definition.patch
-- Applying patch 0042-fix-arm64-linux.patch
-- Using source at /mnt/lily/0722/buildtrees/ffmpeg/src/n6.1.1-95b141da41.clean
-- Getting CMake variables for x64-linux
-- Building Options: --enable-pic --disable-doc --enable-debug --enable-runtime-cpudetect --disable-autodetect --target-os=linux --enable-pthreads --cc=cc --cxx=c++ --nm=nm --ar='ar' --ranlib=ranlib --strip=strip --disable-ffmpeg --disable-ffplay --disable-ffprobe --enable-avcodec --enable-avdevice --enable-avformat --enable-avfilter --disable-postproc --enable-swresample --enable-swscale --disable-alsa --disable-amf --disable-libaom --disable-libass --disable-avisynth --disable-bzlib --disable-libdav1d --disable-libfdk-aac --disable-libfontconfig --disable-libfreetype --disable-libfribidi --disable-iconv --disable-libilbc --disable-lzma --disable-libmp3lame --disable-libmodplug --disable-cuda --disable-nvenc --disable-nvdec  --disable-cuvid --disable-ffnvcodec --disable-opencl --disable-opengl --disable-libopenh264 --disable-libopenjpeg --disable-libopenmpt --disable-openssl --disable-libopus --disable-sdl2 --disable-libsnappy --disable-libsoxr --disable-libspeex --disable-libssh --disable-libtensorflow --disable-libtesseract --disable-libtheora --disable-libvorbis --disable-libvpx --disable-libwebp --disable-libx264 --disable-libx265 --disable-libxml2 --disable-zlib --disable-libsrt --disable-libmfx --enable-cross-compile --pkg-config=/bin/pkg-config --pkg-config-flags=--static
-- Building Release Options: --enable-optimizations --extra-ldflags=-L"/mnt/lily/0722/installed/x64-linux/lib"
-- Building ffmpeg for Release
-- Building Debug Options: --disable-optimizations --extra-ldflags=-L"/mnt/lily/0722/installed/x64-linux/debug/lib"
-- Building ffmpeg for Debug
-- Fixing pkgconfig file: /mnt/lily/0722/packages/ffmpeg_x64-linux/lib/pkgconfig/libavcodec.pc
-- Fixing pkgconfig file: /mnt/lily/0722/packages/ffmpeg_x64-linux/lib/pkgconfig/libavdevice.pc
-- Fixing pkgconfig file: /mnt/lily/0722/packages/ffmpeg_x64-linux/lib/pkgconfig/libavfilter.pc
-- Fixing pkgconfig file: /mnt/lily/0722/packages/ffmpeg_x64-linux/lib/pkgconfig/libavformat.pc
-- Fixing pkgconfig file: /mnt/lily/0722/packages/ffmpeg_x64-linux/lib/pkgconfig/libavutil.pc
-- Fixing pkgconfig file: /mnt/lily/0722/packages/ffmpeg_x64-linux/lib/pkgconfig/libswresample.pc
-- Fixing pkgconfig file: /mnt/lily/0722/packages/ffmpeg_x64-linux/lib/pkgconfig/libswscale.pc
-- Fixing pkgconfig file: /mnt/lily/0722/packages/ffmpeg_x64-linux/debug/lib/pkgconfig/libavcodec.pc
-- Fixing pkgconfig file: /mnt/lily/0722/packages/ffmpeg_x64-linux/debug/lib/pkgconfig/libavdevice.pc
-- Fixing pkgconfig file: /mnt/lily/0722/packages/ffmpeg_x64-linux/debug/lib/pkgconfig/libavfilter.pc
-- Fixing pkgconfig file: /mnt/lily/0722/packages/ffmpeg_x64-linux/debug/lib/pkgconfig/libavformat.pc
-- Fixing pkgconfig file: /mnt/lily/0722/packages/ffmpeg_x64-linux/debug/lib/pkgconfig/libavutil.pc
-- Fixing pkgconfig file: /mnt/lily/0722/packages/ffmpeg_x64-linux/debug/lib/pkgconfig/libswresample.pc
-- Fixing pkgconfig file: /mnt/lily/0722/packages/ffmpeg_x64-linux/debug/lib/pkgconfig/libswscale.pc
-- Dependencies (release): -pthread;m;atomic
-- Dependencies (debug):   -pthread;m;atomic
-- Installing: /mnt/lily/0722/packages/ffmpeg_x64-linux/share/ffmpeg/usage
-- Installing: /mnt/lily/0722/packages/ffmpeg_x64-linux/share/ffmpeg/copyright
-- Performing post-build validation
Stored binaries in 1 destinations in 20 s.
Elapsed time to handle ffmpeg:x64-linux: 2.6 min
ffmpeg:x64-linux package ABI: b0c1376c3320c739a1d1585cd600fb17e0b0307446c7c4ede441ca24c663d17e
Total install time: 2.6 min
To use ffmpeg add the following to your CMake project:

    find_package(FFMPEG REQUIRED)
    target_include_directories(main PRIVATE ${FFMPEG_INCLUDE_DIRS})
    target_link_directories(main PRIVATE ${FFMPEG_LIBRARY_DIRS})
    target_link_libraries(main PRIVATE ${FFMPEG_LIBRARIES})
orsnaro commented 1 month ago

repo root ╰─ cat vcpkg.json

{
    "$schema": "https://raw.githubusercontent.com/microsoft/vcpkg/master/scripts/vcpkg.schema.json",
    "name": "apriltagtrackers",
    "version": "0.6.0",
    "dependencies": [
        {
            "name": "opencv4",
            "default-features": false,
            "features": [
                "contrib",
                "ffmpeg",
                "ipp",
                "opengl",
                "jpeg"
            ]
        },
        {
            "name": "opencv4",
            "default-features": false,
            "features": [
                "world"
            ],
            "platform": "!static"
        },
        {
            "name": "wxwidgets",
            "default-features": false
        },
        "libusb",
        "apriltag",
        "openvr",
        "doctest",
        "taskflow"
    ],
    "builtin-baseline": "6f7ffeb18f99796233b958aaaf14ec7bd4fb64b2"
}

I think this gets the latest ffmpeg lib available by default?

orsnaro commented 1 month ago

there is also this variable set

set(VCPKG_INSTALL_OPTIONS "--clean-after-build" "--x-abi-tools-use-exact-versions" CACHE STRING "")
greenozon commented 3 weeks ago

@orsnaro latest up-to-date ffmpeg version in vcpkg is 7.0.2 and it builds without issues under Linux (Ubuntu 22 LTS)

./vcpkg install ffmpeg
Computing installation plan...
The following packages are already installed:
    ffmpeg[core,swscale,swresample,avformat,avfilter,avdevice,avcodec]:x64-linux@7.0.2#3
ffmpeg:x64-linux is already installed
Total install time: 37.2 us
To use ffmpeg add the following to your CMake project:

    find_package(FFMPEG REQUIRED)
    target_include_directories(main PRIVATE ${FFMPEG_INCLUDE_DIRS})
    target_link_directories(main PRIVATE ${FFMPEG_LIBRARY_DIRS})
    target_link_libraries(main PRIVATE ${FFMPEG_LIBRARIES})

Please try latest vcpkg

git pull
./bootstrap-vcpkg.sh
./vcpkg update
./vcpkg upgrade
dg0yt commented 3 weeks ago

I think this gets the latest ffmpeg lib available by default?

Not in manifest mode. Your top-level manifest has

"builtin-baseline": "6f7ffeb18f99796233b958aaaf14ec7bd4fb64b2"

so if there is nothing else demanding a higher version, this determines the version of ffmpeg. https://github.com/microsoft/vcpkg/tree/6f7ffeb18f99796233b958aaaf14ec7bd4fb64b2 is from two years ago.