m-ab-s / media-autobuild_suite

This Windows Batchscript helps setup a Mingw-w64 compiler environment for building ffmpeg and other media tools under Windows.
GNU General Public License v3.0
1.54k stars 267 forks source link

FFMPEG build fails: "libplacebo >= 4.192.0 not found using pkg-config" #2399

Open nivomi opened 1 year ago

nivomi commented 1 year ago

logs.zip

Murmur commented 1 year ago

Similar ticket https://github.com/m-ab-s/media-autobuild_suite/issues/2324

kliffgomel commented 1 year ago

Same problem. logs.zip

dmki commented 1 year ago

Unfortunately, the same.

ENunn commented 1 year ago

Are there any updates to this at all? I ran the suite today and I'm still getting the error.

kliffgomel commented 1 year ago

Compiling with clang runs without errors...

dmki commented 1 year ago

Didn't work for me. logs.zip

fzold commented 1 year ago

And how to compile with Clang? MSYS only uses GCC in this suite.

dmki commented 1 year ago

I assume he means choosing CLang in initial dialog, or changing CC value in media-autobuild_suite.ini file. But it doesn't affect the result.

L4cache commented 1 year ago

Yeah, switch to clang didn't fix the problem.

kliffgomel commented 1 year ago

I'm able to build ffmpeg with libplacebo without errors if the build is done by clang . ffmpeg version N-110229-g9919dd102f-g4dffa564d1+1 Copyright (c) 2000-2023 the FFmpeg developers built with clang version 16.0.1 configuration: --pkg-config=pkgconf --cc='ccache clang' --cxx='ccache clang++' --ld='ccache clang++' --extra-cxxflags=-fpermissive --extra-cflags=-Wno-int-conversion --enable-bzlib --enable-d3d11va --enable-dxva2 --enable-iconv --enable-lzma --enable-zlib --enable-sdl2 --enable-libmp3lame --enable-libopus --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-libdav1d --enable-libaom --disable-debug --enable-libfdk-aac --enable-fontconfig --enable-libass --enable-libbluray --enable-libfreetype --enable-libmfx --enable-libopenjpeg --enable-libwebp --enable-libxml2 --enable-libzimg --enable-gpl --enable-avisynth --enable-libopenmpt --enable-libvmaf --enable-frei0r --enable-libcaca --enable-libfribidi --enable-libilbc --enable-libmodplug --enable-librist --enable-librtmp --enable-libglslang --enable-vulkan --enable-libplacebo --enable-opencl --enable-opengl --enable-gnutls --extra-cflags=-DCACA_STATIC --extra-cflags=-DMODPLUG_STATIC --extra-libs=-lpsapi --extra-cflags=-DLIBXML_STATIC --disable-w32threads --enable-nonfree libavutil 58. 6.100 / 58. 6.100 libavcodec 60. 9.100 / 60. 9.100 libavformat 60. 4.101 / 60. 4.101 libavdevice 60. 2.100 / 60. 2.100 libavfilter 9. 5.100 / 9. 5.100 libswscale 7. 2.100 / 7. 2.100 libswresample 4. 11.100 / 4. 11.100 libpostproc 57. 2.100 / 57. 2.100

logs.zip

dmki commented 1 year ago

I'm able to build ffmpeg with libplacebo without errors if the build is done by clang .

Could you please share your media-autobuild_suite.ini? It contains the answers to initial questions. I can't quite notice what else is different between my config and yours that makes it fail in my machine.

kliffgomel commented 1 year ago

Normal settings, only the clang compiler is selected. CC=1 Ccache=2 FfmpegChoice=1 In ffmpeg_options.txt enabled libplacebo

fzold commented 1 year ago

Thank you. It worked. 👍

dmki commented 1 year ago

"Fixes" one problem, introduces another. CLang can't build xavs2.

Biswa96 commented 1 year ago

It seems that xavs2 is not maintained anymore. See the last commit in 2019 https://github.com/pkuvcl/xavs2

dmki commented 1 year ago

It seems that xavs2 is not maintained anymore. See the last commit in 2019 https://github.com/pkuvcl/xavs2

Yes, but even disabling it with --disable-xavs2 doesn't do anything - it tries to download and build it. And fails.

L4cache commented 1 year ago

OK, now it works for me too. One trick, build xavs2 with gcc, then switch to clang. To compile only certain program you'll need to edit the ini file and remove all --enable-* options from ffmpeg_options. Example: mabs-config.zip This is for x265.

Biswa96 commented 1 year ago

The xavs2 build issue with clang was fixed.

Dixeran commented 1 year ago

Ran into this when I was cross-compiling ffmpeg but using another mingw environment (not this project), so I checked the config.log of ffmpeg and saw:

pkgconf --exists --print-errors libplacebo
check_func_headers libplacebo/vulkan.h pl_vulkan_create -I/root/mpv-cross/mpv-winbuild-cmake/build64/install/mingw/include -I/root/mpv-cross/mpv-winbuild-cmake/build64/install/mingw/include/spirv_cross -L/root/mpv-cross/mpv-winbuild-cmake/build64/install/mingw/lib -lplacebo -lm -lshlwapi -lversion -lshaderc_combined -lspirv-cross-c-shared -lvulkan -lshlwapi -lcfgmgr32 -llcms2 -lm -lpthread -ldovi -ladvapi32 -luserenv -lkernel32 -lws2_32 -lbcrypt -lkernel32 -ladvapi32 -luserenv -lkernel32 -lkernel32 -lws2_32 -lbcrypt
test_ld cc -I/root/mpv-cross/mpv-winbuild-cmake/build64/install/mingw/include -I/root/mpv-cross/mpv-winbuild-cmake/build64/install/mingw/include/spirv_cross -L/root/mpv-cross/mpv-winbuild-cmake/build64/install/mingw/lib -lplacebo -lm -lshlwapi -lversion -lshaderc_combined -lspirv-cross-c-shared -lvulkan -lshlwapi -lcfgmgr32 -llcms2 -lm -lpthread -ldovi -ladvapi32 -luserenv -lkernel32 -lws2_32 -lbcrypt -lkernel32 -ladvapi32 -luserenv -lkernel32 -lkernel32 -lws2_32 -lbcrypt
test_cc -I/root/mpv-cross/mpv-winbuild-cmake/build64/install/mingw/include -I/root/mpv-cross/mpv-winbuild-cmake/build64/install/mingw/include/spirv_cross -L/root/mpv-cross/mpv-winbuild-cmake/build64/install/mingw/lib
BEGIN /tmp/ffconf.ZuVwjN4e/test.c
    1   #include <libplacebo/vulkan.h>
    2   #include <stdint.h>
    3   long check_pl_vulkan_create(void) { return (long) pl_vulkan_create; }
    4   int main(void) { int ret = 0;
    5    ret |= ((intptr_t)check_pl_vulkan_create) & 0xFFFF;
    6   return ret; }
END /tmp/ffconf.ZuVwjN4e/test.c
x86_64-w64-mingw32-gcc -D_ISOC99_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -U__STRICT_ANSI__ -D__USE_MINGW_ANSI_STDIO=1 -D__printf__=__gnu_printf__ -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600 -DPIC -std=c11 -fomit-frame-pointer -I/root/mpv-cross/mpv-winbuild-cmake/build64/install/mingw/include -I/root/mpv-cross/mpv-winbuild-cmake/build64/install/mingw/include -I/root/mpv-cross/mpv-winbuild-cmake/build64/install/mingw/include -I/root/mpv-cross/mpv-winbuild-cmake/build64/install/mingw/include/freetype2 -I/root/mpv-cross/mpv-winbuild-cmake/build64/install/mingw/include/libpng16 -I/root/mpv-cross/mpv-winbuild-cmake/build64/install/mingw/include/harfbuzz -I/root/mpv-cross/mpv-winbuild-cmake/build64/install/mingw/include/fribidi -DFRIBIDI_LIB_STATIC -I/root/mpv-cross/mpv-winbuild-cmake/build64/install/mingw/include -I/root/mpv-cross/mpv-winbuild-cmake/build64/install/mingw/include/freetype2 -I/root/mpv-cross/mpv-winbuild-cmake/build64/install/mingw/include/libpng16 -I/root/mpv-cross/mpv-winbuild-cmake/build64/install/mingw/include/bs2b -I/root/mpv-cross/mpv-winbuild-cmake/build64/install/mingw/include -I/root/mpv-cross/mpv-winbuild-cmake/build64/install/mingw/include -I/root/mpv-cross/mpv-winbuild-cmake/build64/install/mingw/include/fribidi -DFRIBIDI_LIB_STATIC -I/root/mpv-cross/mpv-winbuild-cmake/build64/install/mingw/include -DHWY_STATIC_DEFINE -DJXL_STATIC_DEFINE -I/root/mpv-cross/mpv-winbuild-cmake/build64/install/mingw/include -DJXL_THREADS_STATIC_DEFINE -I/root/mpv-cross/mpv-winbuild-cmake/build64/install/mingw/lib/pkgconfig/../../include -I/root/mpv-cross/mpv-winbuild-cmake/build64/install/mingw/lib/pkgconfig/../../include/vpl -I/root/mpv-cross/mpv-winbuild-cmake/build64/install/mingw/include -DMODPLUG_STATIC -I/root/mpv-cross/mpv-winbuild-cmake/build64/install/mingw/include -I/root/mpv-cross/mpv-winbuild-cmake/build64/install/mingw/include -I/root/mpv-cross/mpv-winbuild-cmake/build64/install/mingw/include/opus -I/root/mpv-cross/mpv-winbuild-cmake/build64/install/mingw/include/opus -I/root/mpv-cross/mpv-winbuild-cmake/build64/install/mingw/include -I/root/mpv-cross/mpv-winbuild-cmake/build64/install/mingw/include/spirv_cross -L/root/mpv-cross/mpv-winbuild-cmake/build64/install/mingw/lib -c -o /tmp/ffconf.ZuVwjN4e/test.o /tmp/ffconf.ZuVwjN4e/test.c
/tmp/ffconf.ZuVwjN4e/test.c: In function 'check_pl_vulkan_create':
/tmp/ffconf.ZuVwjN4e/test.c:3:44: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
    3 | long check_pl_vulkan_create(void) { return (long) pl_vulkan_create; }
      |                                            ^
x86_64-w64-mingw32-gcc -Wl,--nxcompat,--dynamicbase -Wl,--high-entropy-va -Wl,--as-needed -Wl,--image-base,0x140000000 -I/root/mpv-cross/mpv-winbuild-cmake/build64/install/mingw/include -I/root/mpv-cross/mpv-winbuild-cmake/build64/install/mingw/include/spirv_cross -L/root/mpv-cross/mpv-winbuild-cmake/build64/install/mingw/lib -o /tmp/ffconf.ZuVwjN4e/test.exe /tmp/ffconf.ZuVwjN4e/test.o -lplacebo -lm -lshlwapi -lversion -lshaderc_combined -lspirv-cross-c-shared -lvulkan -lshlwapi -lcfgmgr32 -llcms2 -lm -lpthread -ldovi -ladvapi32 -luserenv -lkernel32 -lws2_32 -lbcrypt -lkernel32 -ladvapi32 -luserenv -lkernel32 -lkernel32 -lws2_32 -lbcrypt -lstdc++
/root/mpv-cross/mpv-winbuild-cmake/build64/install/lib/gcc/x86_64-w64-mingw32/12.2.1/../../../../x86_64-w64-mingw32/bin/ld: /tmp/ffconf.ZuVwjN4e/test.o:test.c:(.text+0x3): undefined reference to `__imp_pl_vulkan_create'
collect2: error: ld returned 1 exit status
ERROR: libplacebo not found using pkg-config

It seems like pkg-config can find libplacebo, but failed to build a test program referencing pl_vulkan_create API. Maybe relative to api: decorate all API functions with PL_API

Downgrade libplacebo to a tagged version instead of HEAD fix this for me.