mpv-player / mpv-build

🔨 Helper scripts to compile mpv on Linux
http://mpv.io
403 stars 104 forks source link

Can't build on Ubuntu 20.04 since the new libplacebo change #194

Closed hrzhu closed 1 year ago

hrzhu commented 2 years ago

I installed menson and ninja which is the new requirement for libplacebo. I got these error messages.

Using libplacebo options: -Ddefault_library=static -Dtests=false -Ddemos=false --wipe
The Meson build system
Version: 0.63.2
Source dir: /home/h/src/mpv-build/libplacebo
Build dir: /home/h/src/mpv-build/libplacebo/build
Build type: native build
Project name: libplacebo
Project version: 5.217.0
C compiler for the host machine: ccache cc (gcc 9.4.0 "cc (Ubuntu 9.4.0-1ubuntu1~20.04.1) 9.4.0")
C linker for the host machine: cc ld.bfd 2.34
C++ compiler for the host machine: ccache c++ (gcc 9.4.0 "c++ (Ubuntu 9.4.0-1ubuntu1~20.04.1) 9.4.0")
C++ linker for the host machine: c++ ld.bfd 2.34
Host machine cpu family: x86_64
Host machine cpu: x86_64
Compiler for C supports arguments -Wincompatible-pointer-types: YES 
Compiler for C supports link arguments -Wl,--exclude-libs=ALL: YES 
Library m found: YES
Library dl found: YES
Program python3 found: YES (/home/h/.pyenv/versions/3.9.12/envs/3.9.12@playground/bin/python3.9)
Run-time dependency threads found: YES
Header "pthread.h" has symbol "pthread_condattr_setclock" with dependency threads: YES 
Found pkg-config: /usr/bin/pkg-config (0.29.1)
Run-time dependency vulkan found: YES 1.2.131
Run-time dependency shaderc found: NO (tried pkgconfig, pkgconfig, pkgconfig and system)
Found CMake: /usr/bin/cmake (3.16.3)
DEPRECATION: CMake support for versions <3.17 is deprecated since Meson 0.62.0.
|
|   However, Meson was only able to find CMake 3.16.3.
|
|   Support for all CMake versions below 3.17.0 will be removed once
|   newer CMake versions are more widely adopted. If you encounter
|   any errors please try upgrading CMake to a newer version first.

Run-time dependency spirv-cross-c-shared found: NO (tried pkgconfig and cmake)
Library version found: NO
Check usable header "d3d11_4.h" : NO 
Run-time dependency libunwind found: NO (tried pkgconfig and cmake)
Library execinfo found: NO
Checking for function "backtrace_symbols" with dependency -lexecinfo: YES 
Library glslang found: YES
Library MachineIndependent found: NO
Library OSDependent found: YES
Library HLSL found: YES
Library OGLCompiler found: YES
Library GenericCodeGen found: NO
Library SPVRemapper found: YES
Library SPIRV found: YES
Library SPIRV-Tools-opt found: NO
Library SPIRV-Tools found: NO
Library pthread found: YES
Has header "glslang/build_info.h" : NO 
src/meson.build:126: WARNING: vulkan support requires either `shaderc` or `glslang`, disabling
Run-time dependency lcms2 found: YES 2.9
Configuring config.h using configuration
Configuring config_internal.h using configuration
Build targets in project: 3

libplacebo 5.217.0

  Components
    lcms           : YES
    glslang        : NO
    shaderc        : NO
    vulkan         : NO
    opengl         : YES
    d3d11          : NO

In file included from ../video/out/vulkan/utils.h:2,
                 from ../video/out/vulkan/utils.c:2:
../video/out/vulkan/common.h:26:10: fatal error: libplacebo/vulkan.h: No such file or directory
   26 | #include <libplacebo/vulkan.h>
      |          ^~~~~~~~~~~~~~~~~~~~~
compilation terminated.

../video/decode/vd_lavc.c: In function 'decode_frame':
../video/decode/vd_lavc.c:1152:9: warning: 'pkt_duration' is deprecated [-Wdeprecated-declarations]
 1152 |         mp_pts_from_av(ctx->pic->pkt_duration, &ctx->codec_timebase);
      |         ^~~~~~~~~~~~~~
In file included from ../../build_libs/include/libavcodec/avcodec.h:35,
                 from ../video/decode/vd_lavc.c:25:
../../build_libs/include/libavutil/frame.h:617:13: note: declared here
  617 |     int64_t pkt_duration;
      |             ^~~~~~~~~~~~

Waf: Leaving directory `/home/h/src/mpv-build/mpv/build'
Build failed
 -> task in 'objects' failed with exit status 1 (run with -v to display more information)

I installed glslang-dev but it couldn't find glslang/build_info.h. I don't know how to install shaderc. If I build mpv with --disable-libplacebo(adding it in mpv_options), the binary doesn't work properly.

mpv 'file:///home/h/2022-09-07 03-31-59.mkv'
 (+) Video --vid=1 (*) (h264 1920x1080 59.940fps)
 (+) Audio --aid=1 (*) 'Track1' (aac 2ch 48000Hz)
     Audio --aid=2 (*) 'Track2' (aac 2ch 48000Hz)
[vo/gpu] VT_GETMODE failed: Inappropriate ioctl for device
[vo/gpu/opengl] Failed to set up VT switcher. Terminal switching will be unavailable.
amdgpu_device_initialize: amdgpu_query_info(ACCEL_WORKING) failed (-13)
amdgpu: amdgpu_device_initialize failed.
[vo/gpu] Failed to create GBM surface.
[vo/gpu] Failed to setup GBM.
Error opening/initializing the selected video_out (--vo) device.
Video: no video

Exiting... (Errors when loading file)
kevmitch commented 2 years ago

This seems to be a bug in the mpv waf build system itself (rather than mpv-build). It expects libplacebo to have vulkan enabled, if mpv itself finds the vulkan headers, which does not necessarily follow.

You can get around this by using --disable-libplacebo as you have done, or just commenting out the libplacebo lines from the build script (or running the commands in there minus the libplacebo ones).

In any case, it seems you have solved the build issue by not including libplacebo in the linked mpv. Therefore, the subsequent error you get at runtime is something different that doesn't appear related to the addition of libplacebo to mpv-build. It looks like it's using --gpu-context=drm rather than x11 / x11egl / wayland. Is that what you mean to do? Post your actual mpv --log-file to https://0x0.st/ so we can see what's happening.

eli-schwartz commented 2 years ago

mpv's meson build system solves that like this:

vulkan_opt = get_option('vulkan').require(
    libplacebo.get_variable('pl_has_vulkan', default_value: '0') == '1',
    error_message: 'libplacebo could not be found!',
)

It will make -Dvulkan=auto degrade to disabling vulkan if libplacebo doesn't support it, or emit an error when it's required.

Aside: seems like libplacebo doesn't set variables: pc_vars in the declare_dependency, /cc @haasn

hrzhu commented 2 years ago

I notice there's a new commit that adds libxpresent-dev dependency. I can now compile a working mpv(without libplacebo) after installing it.