mpv-player / mpv-build

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

Can't compile static build, fails at linking stage /usr/bin/ld: cannot find -l<name-of-lib> #146

Closed twilson90 closed 1 year ago

twilson90 commented 3 years ago

At the end of waf build I encounter:

/usr/bin/ld: cannot find -lasound

And depending on my ffmpeg enabled libraries, I get the same error referencing a different library. It seems like it can't find any of the compiled libs.

Disabling static-build works.

I'm using Ubuntu 20.04 on a virtual machine (WSL2)

mpv_options:

--lua=luajit
--disable-gl
--enable-static-build

ffmpeg_options:

--enable-nonfree
--enable-gpl
--enable-version3
--enable-vdpau
--enable-libass
--enable-libfdk-aac
--enable-libfreetype
--enable-libmp3lame
--enable-libopus
--enable-libtheora
--enable-libvorbis
--enable-libvpx
--enable-libpulse
--enable-libv4l2
--enable-libx264
--enable-libx265
--enable-static

Log:

Using mpv options: --lua=luajit --disable-gl --enable-static-build
Setting top to                           : /opt/mpv-build/mpv
Setting out to                           : /opt/mpv-build/mpv/build
Checking for waf version in 1.8.4-2.1.0  : ok
Checking for program 'cc'                : /usr/bin/cc
Checking for program 'pkg-config'        : /usr/bin/pkg-config
Checking for program 'ar'                : /usr/bin/ar
Checking for program 'rst2html'          : not found
Checking for program 'rst2man'           : not found
Checking for program 'rst2pdf'           : not found
Checking for program 'windres'           : not found
Checking for program 'perl'              : /usr/bin/perl
Checking for 'gcc' (C compiler)          : /usr/bin/cc
Detected target OS:                      : os-linux
Checking for compiler flags -std=c11     : yes
Checking for compiler flags -Werror -Werror=implicit-function-declaration : yes
Checking for compiler flags -Werror -Wno-error=deprecated-declarations    : yes
Checking for compiler flags -Werror -Wno-error=unused-function            : yes
Checking for compiler flags -Werror -Wempty-body                          : yes
Checking for compiler flags -Werror -Wdisabled-optimization               : yes
Checking for compiler flags -Werror -Wstrict-prototypes                   : yes
Checking for compiler flags -Werror -Wno-format-zero-length               : yes
Checking for compiler flags -Werror -Werror=format-security               : yes
Checking for compiler flags -Werror -Wno-redundant-decls                  : yes
Checking for compiler flags -Werror -Wvla                                 : yes
Checking for compiler flags -Werror -Wno-format-truncation                : yes
Checking for compiler flags -Werror -Wimplicit-fallthrough                : yes
Checking for compiler flags -Werror -fno-math-errno                       : yes
Checking for LGPL (version 2.1 or later) build                            : disabled
Checking for GPL (version 2 or later) build                               : yes
Checking for mpv CLI player                                               : yes
Checking for shared library                                               : disabled
Checking for static library                                               : disabled
Checking for static build                                                 : yes
Checking for whether to include binary compile time                       : yes
Checking for whether to optimize                                          : yes
Checking for whether to compile-in debugging information                  : yes
Checking for unit tests (development only)                                : disabled
Checking for enable ta leak report by default (development only)          : disabled
Checking for manpage generation                                           : no (missing RST2MAN)
Checking for html manual generation                                       : disabled
Checking for pdf manual generation                                        : disabled
Checking for dynamic loader                                               : yes
Checking for C plugins                                                    : yes
Checking for inline assembly (currently without effect)                   : yes
Checking for generate a clang compilation database                        : disabled
Checking for static Swift linking                                         : disabled
Checking for compiler support for noexecstack                             : yes
Checking for linker support for --nxcompat --no-seh --dynamicbase         : no
Checking for -lm                                                          : yes
Checking for MinGW                                                        : os-win32 not found
Checking for POSIX environment                                            : yes
Checking for Android environment                                          : no
Checking for tvOS environment                                             : no
Checking for Android EGL support                                          : disabled
Checking for development environment                                      : yes
Checking for macOS Swift build tools                                      : os-darwin not found
Checking for Universal Windows Platform                                   : disabled
Checking for win32 desktop APIs                                           : os-win32 not found
Checking for internal pthread wrapper for win32 (Vista+)                  : posix found
Checking for POSIX threads                                                : yes
Checking for pthread runtime debugging wrappers                           : disabled
Checking for C11 stdatomic.h                                              : yes
Checking for linking with -lrt                                            : yes
Checking for iconv                                                        : yes
Checking for w32/dos paths                                                : os-win32 not found
Checking for glob() POSIX support                                         : yes
Checking for glob() win32 replacement                                     : posix found
Checking for any glob() support                                           : yes
Checking for vt.h                                                         : yes
Checking for consio.h                                                     : vt.h found
Checking for gbm.h                                                        : no
Checking for GLIBC API for setting thread name                            : yes
Checking for OSX API for setting thread name                              : glibc-thread-name found
Checking for BSD API for setting thread name                              : glibc-thread-name found
Checking for BSD's fstatfs()                                              : no
Checking for Linux's fstatfs()                                            : yes
Checking for Linux's input-event-codes.h                                  : yes
Checking for Lua                                                          : yes (version found: luajit)
Checking for Javascript (MuJS backend)                                    : no ('mujs >= 1.0.0' not found)
Checking for SSA/ASS support                                              : yes
Checking for zlib                                                         : yes
Checking for Bluray support                                               : no ('libbluray >= 0.3.0' not found)
Checking for dvdnav support                                               : disabled
Checking for cdda support (libcdio)                                       : disabled
Checking for uchardet support                                             : no ('uchardet' not found)
Checking for librubberband support                                        : yes
Checking for libzimg support (high quality software scaler)               : no ('zimg >= 2.9' not found)
Checking for LCMS2 support                                                : no ('lcms2 >= 2.6' not found)
Checking for VapourSynth filter bridge                                    : no ('vapoursynth >= 24 vapoursynth-script >= 23' not found)
Checking for libarchive wrapper for reading zip files and more            : yes
Checking for DVB input module                                             : disabled
Checking for SDL2                                                         : disabled
Checking for SDL2 gamepad input                                           : sdl2 not found
Checking for FFmpeg library                                               : yes
Checking for libavdevice                                                  : yes
Checking for Disable all known FFmpeg ABI violations                      : disabled
Checking for SDL2 audio output                                            : sdl2 not found
Checking for PulseAudio audio output                                      : yes
Checking for JACK audio output                                            : yes
Checking for OpenAL audio output                                          : disabled
Checking for OpenSL ES audio output                                       : no
Checking for ALSA audio output                                            : yes
Checking for CoreAudio audio output                                       : no
Checking for AudioUnit output for iOS                                     : no
Checking for WASAPI audio output                                          : os-win32 not found
Checking for SDL2 video output                                            : sdl2 not found
Checking for Cocoa                                                        : no
Checking for DRM                                                          : no ('libdrm >= 2.4.74' not found)
Checking for GBM                                                          : gbm.h not found
Checking for wayland-scanner                                              : yes
Checking for wayland-protocols                                            : no ('wayland-protocols >= 1.15' not found)
Checking for Wayland                                                      : wayland-protocols not found
Checking for Linux's memfd_create()                                       : wayland not found
Checking for X11                                                          : yes
Checking for Xv video output                                              : yes
Checking for OpenGL Cocoa Backend                                         : disabled
Checking for OpenGL X11/GLX (deprecated/legacy)                           : disabled
Checking for Raspberry Pi support                                         : disabled
Checking for EGL 1.4                                                      : disabled
Checking for OpenGL X11 EGL Backend                                       : disabled
Checking for OpenGL DRM EGL Backend                                       : disabled
Checking for OpenGL Wayland Backend                                       : disabled
Checking for OpenGL Win32 Backend                                         : disabled
Checking for OpenGL/DirectX Interop Backend                               : disabled
Checking for OpenGL ANGLE headers                                         : disabled
Checking for OpenGL Win32 ANGLE Library                                   : disabled
Checking for OpenGL Win32 ANGLE Backend                                   : disabled
Checking for VDPAU acceleration                                           : yes
Checking for VDPAU with OpenGL/X11                                        : gl-x11 not found
Checking for VAAPI acceleration                                           : yes
Checking for VAAPI (X11 support)                                          : yes
Checking for VAAPI (Wayland support)                                      : gl-wayland not found
Checking for VAAPI (DRM/EGL support)                                      : egl-drm not found
Checking for VAAPI EGL on X11                                             : egl-x11 not found
Checking for VAAPI EGL                                                    : vaapi-x-egl not found
Checking for CACA                                                         : yes
Checking for JPEG support                                                 : no
Checking for Direct3D support                                             : win32-desktop not found
Checking for libshaderc SPIR-V compiler (shared library)                  : static-build found
Checking for libshaderc SPIR-V compiler (static library)                  : no
Checking for libshaderc SPIR-V compiler                                   : shaderc-shared not found
Checking for SPIRV-Cross SPIR-V shader converter (shared library)         : static-build found
Checking for SPIRV-Cross SPIR-V shader converter (static library)         : no ('spirv-cross' not found)
Checking for SPIRV-Cross SPIR-V shader converter                          : spirv-cross-shared not found
Checking for Direct3D 11 video output                                     : win32-desktop not found
Checking for iOS OpenGL ES hardware decoding interop support              : no
Checking for OpenGL without platform-specific code (e.g. for libmpv)      : libmpv-shared not found
Checking for OpenGL context support                                       : disabled
Checking for libplacebo support                                           : no ('libplacebo >= 1.18.0' not found)
Checking for Vulkan context support                                       : libplacebo not found
Checking for VAAPI Vulkan                                                 : vulkan not found
Checking for EGL helper functions                                         : egl not found
Checking for Sixel                                                        : no ('libsixel >= 1.5' not found)
Checking for libavcodec videotoolbox hwaccel                              : gl-cocoa not found
Checking for Videotoolbox with OpenGL                                     : gl-cocoa not found
Checking for D3D11VA hwaccel                                              : os-win32 not found
Checking for DXVA2 hwaccel                                                : d3d-hwaccel not found
Checking for OpenGL/DirectX Interop Backend DXVA2 interop                 : disabled
Checking for CUDA Headers and dynamic loader                              : no ('ffnvcodec >= 8.2.15.7' not found)
Checking for CUDA acceleration                                            : ffnvcodec not found
Checking for CUDA with graphics interop                                   : cuda-hwaccel not found
Checking for Raspberry Pi MMAL hwaccel                                    : rpi not found
Checking for w32 executable                                               : os-win32 not found
Checking for macOS Touch Bar support                                      : cocoa not found
Checking for macOS 10.11 SDK Features                                     : cocoa not found
Checking for macOS 10.12.2 SDK Features                                   : cocoa not found
Checking for macOS 10.14 SDK Features                                     : cocoa not found
Checking for macOS Media Player support                                   : macos-10-12-2-features not found
Checking for macOS libmpv backend                                         : cocoa not found
Writing configuration header:                                             : config.h
'configure' finished successfully (4.730s)
Waf: Entering directory `/opt/mpv-build/mpv/build'
[1/1] Compiling version.sh
[  2/216] Compiling TOOLS/osxbundle/mpv.app/Contents/Resources/icon.icns
[  3/216] Compiling etc/mpv-icon-8bit-16x16.png
[  4/216] Compiling etc/mpv-icon-8bit-32x32.png
[  5/216] Compiling etc/mpv-icon-8bit-64x64.png
[  6/216] Compiling etc/mpv-icon-8bit-128x128.png
[  7/216] Compiling etc/input.conf
[  8/216] Compiling etc/builtin.conf
[  9/216] Compiling sub/osd_font.otf
[ 10/216] Compiling player/lua/defaults.lua
[ 11/216] Compiling player/lua/assdraw.lua
[ 12/216] Compiling player/lua/options.lua
[ 13/216] Compiling player/lua/osc.lua
[ 14/216] Compiling player/lua/ytdl_hook.lua
[ 15/216] Compiling player/lua/stats.lua
[ 16/216] Compiling player/lua/console.lua
[ 17/216] Compiling player/lua/auto_profiles.lua
[ 18/216] Compiling player/javascript/defaults.js
[ 19/216] Creating build/generated/ebml_types.h
[ 20/216] Creating build/generated/ebml_defs.c
[ 21/216] Compiling libmpv/mpv.def
[ 22/216] Compiling misc/natural_sort.c
[ 23/216] Compiling misc/node.c
[ 24/216] Compiling misc/thread_pool.c
[ 25/216] Compiling video/out/vo_null.c
[ 26/216] Compiling video/repack.c
[ 27/216] Compiling ta/ta.c
[ 28/216] Compiling filters/f_demux_in.c
[ 29/216] Compiling demux/demux_edl.c
[ 30/216] Compiling video/out/gpu/video_shaders.c
[ 31/216] Compiling misc/dispatch.c
[ 32/216] Compiling demux/demux_disc.c
[ 33/216] Compiling video/out/gpu/video.c
[ 34/216] Compiling demux/demux_cue.c
[ 35/216] Compiling video/out/gpu/utils.c
[ 36/216] Compiling video/out/gpu/user_shaders.c
[ 37/216] Compiling input/keycodes.c
[ 38/216] Compiling demux/cache.c
[ 39/216] Compiling input/ipc-unix.c
[ 40/216] Compiling input/ipc.c
[ 41/216] Compiling video/out/gpu/shader_cache.c
[ 42/216] Compiling demux/cue.c
[ 43/216] Compiling video/out/gpu/osd.c
[ 44/216] Compiling common/tags.c
[ 45/216] Compiling sub/osd.c
[ 46/216] Compiling common/stats.c
[ 47/216] Compiling video/out/gpu/lcms.c
[ 48/216] Compiling sub/lavc_conv.c
[ 49/216] Compiling filters/user_filters.c
[ 50/216] Compiling common/recorder.c
[ 51/216] Compiling video/out/gpu/hwdec.c
[ 52/216] Compiling input/cmd.c
[ 53/216] Compiling sub/sd_lavc.c
[ 54/216] Compiling filters/frame.c
[ 55/216] Compiling video/out/gpu/error_diffusion.c
[ 56/216] Compiling video/csputils.c
[ 57/216] Compiling filters/filter.c
[ 58/216] Compiling common/msg.c
[ 59/216] Compiling video/out/gpu/context.c
[ 60/216] Compiling video/filter/vf_format.c
[ 61/216] Compiling common/playlist.c
[ 62/216] Compiling common/encode_lavc.c
[ 63/216] Compiling video/out/filter_kernels.c
[ 64/216] Compiling filters/f_utils.c
[ 65/216] Compiling filters/f_swscale.c
[ 66/216] Compiling common/common.c
[ 67/216] Compiling video/out/dr_helper.c
[ 68/216] Compiling sub/img_convert.c
[ 69/216] Compiling filters/f_swresample.c
[ 70/216] Compiling common/codecs.c
[ 71/216] Compiling sub/sd_ass.c
[ 72/216] Compiling audio/out/ao_pulse.c
[ 73/216] Compiling video/out/dither.c
[ 74/216] Compiling filters/f_output_chain.c
[ 75/216] Compiling common/av_log.c
[ 76/216] Compiling video/out/bitmap_packer.c
[ 77/216] Compiling video/filter/vf_vavpp.c
[ 78/216] Compiling common/av_common.c
[ 79/216] Compiling video/out/aspect.c
[ 80/216] Compiling video/filter/vf_sub.c
[ 81/216] Compiling audio/out/buffer.c
[ 82/216] Compiling filters/f_hwtransfer.c
[ 83/216] Compiling video/mp_image_pool.c
[ 84/216] Compiling video/filter/refqueue.c
[ 85/216] Compiling stream/stream.c
[ 86/216] Compiling filters/f_lavfi.c
[ 87/216] Compiling filters/f_decoder_wrapper.c
[ 88/216] Compiling video/mp_image.c
[ 89/216] Compiling video/img_format.c
[ 90/216] Compiling filters/f_auto_filters.c
[ 91/216] Compiling audio/out/ao_pcm.c
[ 92/216] Compiling audio/out/ao_null.c
[ 93/216] Compiling filters/f_autoconvert.c
[ 94/216] Compiling audio/out/ao_lavc.c
[ 95/216] Compiling video/image_writer.c
[ 96/216] Compiling video/decode/vd_lavc.c
[ 97/216] Compiling video/image_loader.c
[ 98/216] Compiling audio/out/ao_jack.c
[ 99/216] Compiling video/hwdec.c
[100/216] Compiling filters/f_async_queue.c
[101/216] Compiling audio/out/ao_alsa.c
[102/216] Compiling video/fmt-conversion.c
[103/216] Compiling demux/packet.c
[104/216] Compiling audio/out/ao.c
../video/decode/vd_lavc.c: In function 'init_avctx':
../video/decode/vd_lavc.c:664:9: warning: 'thread_safe_callbacks' is deprecated [-Wdeprecated-declarations]
  664 |         avctx->thread_safe_callbacks = 1;
      |         ^~~~~
In file included from ../video/decode/vd_lavc.c:25:
../../build_libs/include/libavcodec/avcodec.h:1805:9: note: declared here
 1805 |     int thread_safe_callbacks;
      |         ^~~~~~~~~~~~~~~~~~~~~

[105/216] Compiling sub/filter_sdh.c
[106/216] Compiling demux/ebml.c
[107/216] Compiling audio/format.c
[108/216] Compiling sub/filter_regex.c
[109/216] Compiling demux/demux_timeline.c
[110/216] Compiling audio/fmt-conversion.c
[111/216] Compiling sub/draw_bmp.c
[112/216] Compiling demux/demux_raw.c
[113/216] Compiling audio/filter/af_scaletempo2_internals.c
[114/216] Compiling sub/dec_sub.c
[115/216] Compiling demux/timeline.c
[116/216] Compiling demux/demux_playlist.c
[117/216] Compiling sub/ass_mp.c
[118/216] Compiling demux/demux_null.c
[119/216] Compiling audio/filter/af_scaletempo.c
[120/216] Compiling stream/stream_null.c
[121/216] Compiling demux/demux_mkv_timeline.c
[122/216] Compiling audio/filter/af_rubberband.c
[123/216] Compiling audio/filter/af_scaletempo2.c
[124/216] Compiling demux/demux_mkv.c
[125/216] Compiling audio/filter/af_lavcac3enc.c
[126/216] Compiling stream/stream_memory.c
[127/216] Compiling demux/demux_mf.c
[128/216] Compiling audio/filter/af_format.c
[129/216] Compiling stream/stream_libarchive.c
[130/216] Compiling stream/stream_mf.c
[131/216] Compiling audio/filter/af_drop.c
[132/216] Compiling stream/stream_lavf.c
[133/216] Compiling demux/demux_libarchive.c
[134/216] Compiling audio/decode/ad_spdif.c
[135/216] Compiling stream/stream_file.c
[136/216] Compiling demux/demux_lavf.c
[137/216] Compiling stream/stream_edl.c
[138/216] Compiling audio/chmap_sel.c
[139/216] Compiling stream/stream_slice.c
[140/216] Compiling audio/chmap.c
[141/216] Compiling sub/osd_libass.c
[142/216] Compiling stream/stream_concat.c
[143/216] Compiling audio/aframe.c
[144/216] Compiling ta/ta_utils.c
[145/216] Compiling stream/stream_cb.c
[146/216] Compiling ta/ta_talloc.c
[147/216] Compiling audio/decode/ad_lavc.c
[148/216] Compiling stream/stream_avdevice.c
[149/216] Compiling osdep/subprocess-posix.c
[150/216] Compiling misc/json.c
[151/216] Compiling stream/cookies.c
[152/216] Compiling osdep/subprocess.c
[153/216] Compiling player/client.c
[154/216] Compiling osdep/semaphore_osx.c
[155/216] Compiling player/sub.c
[156/216] Compiling player/video.c
[157/216] Compiling player/scripting.c
[158/216] Compiling osdep/polldev.c
[159/216] Compiling osdep/path-unix.c
[160/216] Compiling player/screenshot.c
[161/216] Compiling osdep/timer-linux.c
[162/216] Compiling osdep/timer.c
[163/216] Compiling player/osd.c
[164/216] Compiling osdep/threads.c
[165/216] Compiling player/misc.c
[166/216] Compiling osdep/io.c
[167/216] Compiling player/main.c
[168/216] Compiling video/out/libmpv_sw.c
[169/216] Compiling player/playloop.c
[170/216] Compiling osdep/terminal-unix.c
[171/216] Compiling video/vdpau_mixer.c
[172/216] Compiling player/loadfile.c
[173/216] Compiling video/vdpau.c
[174/216] Compiling player/lua.c
[175/216] Compiling video/vaapi.c
[176/216] Compiling player/configfiles.c
[177/216] Compiling video/sws_utils.c
[178/216] Compiling player/command.c
[179/216] Compiling video/filter/vf_vdpaupp.c
../video/sws_utils.c: In function 'mp_sws_reinit':
../video/sws_utils.c:326:1: warning: label 'success' defined but not used [-Wunused-label]
  326 | success:
      | ^~~~~~~
At top level:
../video/sws_utils.c:127:13: warning: 'allow_zimg' defined but not used [-Wunused-function]
  127 | static bool allow_zimg(struct mp_sws_context *ctx)
      |             ^~~~~~~~~~

[180/216] Compiling player/external_files.c
[181/216] Compiling video/out/x11_common.c
[182/216] Compiling video/out/win_state.c
[183/216] Compiling player/audio.c
[184/216] Compiling video/out/vo_xv.c
[185/216] Compiling options/parse_configfile.c
[186/216] Compiling video/out/vo_x11.c
[187/216] Compiling options/parse_commandline.c
[188/216] Compiling video/out/vo_vdpau.c
[189/216] Compiling options/options.c
[190/216] Compiling video/out/vo_vaapi.c
[191/216] Compiling options/m_property.c
[192/216] Compiling video/out/vo_tct.c
[193/216] Compiling options/m_option.c
[194/216] Compiling video/out/vo_gpu.c
[195/216] Compiling video/out/vo_libmpv.c
[196/216] Compiling options/m_config_frontend.c
[197/216] Compiling options/m_config_core.c
[198/216] Compiling video/out/vo_lavc.c
[199/216] Compiling options/path.c
[200/216] Compiling video/out/vo_image.c
[201/216] Compiling video/out/vo.c
[202/216] Compiling misc/rendezvous.c
[203/216] Compiling misc/thread_tools.c
[204/216] Compiling video/out/vo_caca.c
[205/216] Compiling video/out/gpu/spirv.c
[206/216] Compiling input/event.c
[207/216] Compiling video/out/gpu/libmpv_gpu.c
[208/216] Compiling common/version.c
[209/216] Compiling input/input.c
[210/216] Compiling video/out/gpu/ra.c
[211/216] Compiling demux/codec_tags.c
[212/216] Compiling misc/charset_conv.c
[213/216] Compiling misc/bstr.c
[214/216] Compiling demux/demux.c
[215/216] Compiling osdep/main-fn-unix.c
[216/216] Linking build/mpv
/usr/bin/ld: cannot find -lasound
collect2: error: ld returned 1 exit status

Waf: Leaving directory `/opt/mpv-build/mpv/build'
Build failed
 -> task in 'mpv' failed with exit status 1 (run with -v to display more information)
nathanfranke commented 3 years ago

Getting this same issue. libasound2-dev is installed.

twilson90 commented 3 years ago

Has anyone solved this?

avih commented 3 years ago

Has anyone solved this?

It can't be solved for you. You need a static versions of the libraries for that to work. If your distro or package-manager doesn't have them (most don't have them) then you need to build them yourself if you want it - which is LOT of work.

mpv-build only does that for libass and ffmpeg (build static libraries) because it uses the newest version of these libs, instead of the older versions from your package manager, and it's a sort of a hack.

mpv-build can't do that for you also for all the other packages which mpv needs to link with.

The "do it yourself" method is not really practical here, so your only real option is to use a distro which can install static versions of all the libraries which mpv needs.

twilson90 commented 3 years ago

Thanks for clarifying. Which distro would you recommend for building all the dependencies then?

avih commented 3 years ago

Which distro would you recommend for building all the dependencies then?

I don't recommend and I don't know.

If you have good reasons to need a static version of (lib)mpv with all the libraries, then you should know what you're doing. We can't help you with that.

Dudemanguy commented 1 year ago

As discussed in the comments, this is not a bug.