Problem with libavformat when using meson

I’m trying to install scrcpy on my machine. I follow this Instruction but I’m getting problem on libavformat.
Here’s the log

Build started at 2022-02-10T07:47:40.664846
Main binary: /usr/bin/python3
Build Options: -Db_lto=true -Dprebuilt_server=scrcpy-server -Dprefix=/usr/local -Dbuildtype=release -Dstrip=True
Python system: Linux
The Meson build system
Version: 0.61.1
Source dir: /home/nextgenop/gittt/scrcpy
Build dir: /home/nextgenop/gittt/scrcpy/build-auto
Build type: native build
Project name: scrcpy
Project version: 1.22
Sanity testing C compiler: gcc
Is cross compiler: False.
Sanity check compiler command line: gcc sanitycheckc.c -o sanitycheckc.exe -g -O3 -feliminate-unused-debug-types -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -Wformat -Wformat-security -m64 -fasynchronous-unwind-tables -Wp,-D_REENTRANT -ftree-loop-distribute-patterns -fno-semantic-interposition -ffat-lto-objects -fno-trapping-math -mtune=skylake -D_FILE_OFFSET_BITS=64
Sanity check compile stdout:


Sanity check compile stderr:


Running test binary command: /home/nextgenop/gittt/scrcpy/build-auto/meson-private/sanitycheckc.exe
C compiler for the host machine: gcc (gcc 11.2.1 “gcc (Clear Linux OS for Intel Architecture) 11.2.1 20220124 releases/gcc-11.2.0-705-gce3954262a”)
C linker for the host machine: gcc ld.bfd 2.37
Sanity testing C compiler: gcc
Is cross compiler: False.
Sanity check compiler command line: gcc sanitycheckc.c -o sanitycheckc.exe -g -O3 -feliminate-unused-debug-types -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -Wformat -Wformat-security -m64 -fasynchronous-unwind-tables -Wp,-D_REENTRANT -ftree-loop-distribute-patterns -fno-semantic-interposition -ffat-lto-objects -fno-trapping-math -mtune=skylake -D_FILE_OFFSET_BITS=64
Sanity check compile stdout:


Sanity check compile stderr:


Running test binary command: /home/nextgenop/gittt/scrcpy/build-auto/meson-private/sanitycheckc.exe
C compiler for the build machine: gcc (gcc 11.2.1 “gcc (Clear Linux OS for Intel Architecture) 11.2.1 20220124 releases/gcc-11.2.0-705-gce3954262a”)
C linker for the build machine: gcc ld.bfd 2.37
Build machine cpu family: x86_64
Build machine cpu: x86_64
Host machine cpu family: x86_64
Host machine cpu: x86_64
Target machine cpu family: x86_64
Target machine cpu: x86_64
Pkg-config binary for 1 is not cached.
Pkg-config binary missing from cross or native file, or env var undefined.
Trying a default Pkg-config fallback at pkg-config
Found pkg-config: /usr/bin/pkg-config (0.29.2)
Determining dependency ‘libavformat’ with pkg-config executable ‘/usr/bin/pkg-config’
env[PKG_CONFIG_PATH]:
Called /usr/bin/pkg-config --modversion libavformat → 1

CMake binary for 1 is not cached
CMake binary missing from cross or native file, or env var undefined.
Trying a default CMake fallback at cmake
Found CMake: /usr/bin/cmake (3.22.1)
Extracting basic cmake information
CMake Toolchain: Calling CMake once to generate the compiler state
Calling CMake ([’/usr/bin/cmake’]) in /home/nextgenop/gittt/scrcpy/build-auto/meson-private/CMake_compiler_info with:

  • “–trace-expand”
  • “–trace-format=json-v1”
  • “–no-warn-unused-cli”
  • “–trace-redirect=cmake_trace.txt”
  • “-G”
  • “Ninja”
  • “-DCMAKE_TOOLCHAIN_FILE=/home/nextgenop/gittt/scrcpy/build-auto/meson-private/CMake_compiler_info/CMakeMesonTempToolchainFile.cmake”
  • “.”
    Try CMake generator: auto
    Calling CMake ([’/usr/bin/cmake’]) in /home/nextgenop/gittt/scrcpy/build-auto/meson-private/cmake_libavformat with:
  • “–trace-expand”
  • “–trace-format=json-v1”
  • “–no-warn-unused-cli”
  • “–trace-redirect=cmake_trace.txt”
  • “-DCMAKE_TOOLCHAIN_FILE=/home/nextgenop/gittt/scrcpy/build-auto/meson-private/cmake_libavformat/CMakeMesonToolchainFile.cmake”
  • “.”
    – Module search paths: [’/’, ‘/opt’, ‘/usr’, ‘/usr/local’]
    – CMake root: /usr/share/cmake-3.22
    – CMake architectures:
    – CMake lib search paths: [‘lib’, ‘lib32’, ‘lib64’, ‘libx32’, ‘share’]
    Preliminary CMake check failed. Aborting.
    Run-time dependency libavformat found: NO (tried pkgconfig and cmake)

app/meson.build:94:4: ERROR: Dependency “libavformat” not found, tried pkgconfig and cmake

This log is obtained after adding env LD_LIBRARY_PATH=/usr/local/lib in front of the meson command.

And this is the result of ls /usr/local/lib

$ ls /usr/local/lib
libaom.so                 libfdk-aac.so             libvidstab.so
libaom.so.3               libfdk-aac.so.2           libvidstab.so.1.2
libaom.so.3.0.0           libfdk-aac.so.2.0.2       libvmaf.so
libavcodec.so             libhdr10plus.so           libvmaf.so.1
libavcodec.so.58          libmp3lame.so             libvmaf.so.1.1.1
libavcodec.so.58.134.100  libmp3lame.so.0           libx26410b.so
libavdevice.so            libmp3lame.so.0.0.0       libx26410b.so.164
libavdevice.so.58         libopus.so                libx264.so
libavdevice.so.58.13.100  libopus.so.0              libx264.so.164
libavfilter.so            libopus.so.0.8.0          libx265_main10.so
libavfilter.so.7          libpostproc.so            libx265_main10.so.199
libavfilter.so.7.110.100  libpostproc.so.55         libx265_main12.so
libavformat.so            libpostproc.so.55.9.100   libx265_main12.so.199
libavformat.so.58         libSvtAv1Enc.so           libx265.so
libavformat.so.58.76.100  libSvtAv1Enc.so.0         libx265.so.199
libavutil.so              libSvtAv1Enc.so.0.8.7     libxvidcore.so
libavutil.so.56           libswresample.so          libxvidcore.so.4
libavutil.so.56.70.100    libswresample.so.3        libxvidcore.so.4.3
libdav1d.so               libswresample.so.3.9.100  pkgconfig
libdav1d.so.5             libswscale.so             zram.conf.d
libdav1d.so.5.0.1         libswscale.so.5
libfdk-aac.la             libswscale.so.5.9.100

how to fix it?