mpv-player / mpv-build

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

libmpv fails linking with meson #208

Closed CounterPillow closed 1 year ago

CounterPillow commented 1 year ago

Steps to reproduce:

echo '-Dlibmpv=true` >> mpv_options
./rebuild -j32

Result:

[519/524] Linking target libmpv.so.2.0.0
FAILED: libmpv.so.2.0.0 
cc  -o libmpv.so.2.0.0 libmpv.so.2.0.0.p/audio_aframe.c.o libmpv.so.2.0.0.p/audio_chmap.c.o libmpv.so.2.0.0.p/audio_chmap_sel.c.o libmpv.so.2.0.0.p/audio_decode_ad_lavc.c.o libmpv.so.2.0.0.p/audio_decode_ad_spdif.c.o libmpv.so.2.0.0.p/audio_filter_af_drop.c.o libmpv.so.2.0.0.p/audio_filter_af_format.c.o libmpv.so.2.0.0.p/audio_filter_af_lavcac3enc.c.o libmpv.so.2.0.0.p/audio_filter_af_scaletempo.c.o libmpv.so.2.0.0.p/audio_filter_af_scaletempo2.c.o libmpv.so.2.0.0.p/audio_filter_af_scaletempo2_internals.c.o libmpv.so.2.0.0.p/audio_fmt-conversion.c.o libmpv.so.2.0.0.p/audio_format.c.o libmpv.so.2.0.0.p/audio_out_ao.c.o libmpv.so.2.0.0.p/audio_out_ao_lavc.c.o libmpv.so.2.0.0.p/audio_out_ao_null.c.o libmpv.so.2.0.0.p/audio_out_ao_pcm.c.o libmpv.so.2.0.0.p/audio_out_buffer.c.o libmpv.so.2.0.0.p/common_av_common.c.o libmpv.so.2.0.0.p/common_av_log.c.o libmpv.so.2.0.0.p/common_codecs.c.o libmpv.so.2.0.0.p/common_common.c.o libmpv.so.2.0.0.p/common_encode_lavc.c.o libmpv.so.2.0.0.p/common_msg.c.o libmpv.so.2.0.0.p/common_playlist.c.o libmpv.so.2.0.0.p/common_recorder.c.o libmpv.so.2.0.0.p/common_stats.c.o libmpv.so.2.0.0.p/common_tags.c.o libmpv.so.2.0.0.p/common_version.c.o libmpv.so.2.0.0.p/demux_codec_tags.c.o libmpv.so.2.0.0.p/demux_cue.c.o libmpv.so.2.0.0.p/demux_cache.c.o libmpv.so.2.0.0.p/demux_demux.c.o libmpv.so.2.0.0.p/demux_demux_cue.c.o libmpv.so.2.0.0.p/demux_demux_disc.c.o libmpv.so.2.0.0.p/demux_demux_edl.c.o libmpv.so.2.0.0.p/demux_demux_lavf.c.o libmpv.so.2.0.0.p/demux_demux_mf.c.o libmpv.so.2.0.0.p/demux_demux_mkv.c.o libmpv.so.2.0.0.p/demux_demux_mkv_timeline.c.o libmpv.so.2.0.0.p/demux_demux_null.c.o libmpv.so.2.0.0.p/demux_demux_playlist.c.o libmpv.so.2.0.0.p/demux_demux_raw.c.o libmpv.so.2.0.0.p/demux_demux_timeline.c.o libmpv.so.2.0.0.p/demux_ebml.c.o libmpv.so.2.0.0.p/demux_packet.c.o libmpv.so.2.0.0.p/demux_timeline.c.o libmpv.so.2.0.0.p/filters_f_async_queue.c.o libmpv.so.2.0.0.p/filters_f_autoconvert.c.o libmpv.so.2.0.0.p/filters_f_auto_filters.c.o libmpv.so.2.0.0.p/filters_f_decoder_wrapper.c.o libmpv.so.2.0.0.p/filters_f_demux_in.c.o libmpv.so.2.0.0.p/filters_f_hwtransfer.c.o libmpv.so.2.0.0.p/filters_f_lavfi.c.o libmpv.so.2.0.0.p/filters_f_output_chain.c.o libmpv.so.2.0.0.p/filters_f_swresample.c.o libmpv.so.2.0.0.p/filters_f_swscale.c.o libmpv.so.2.0.0.p/filters_f_utils.c.o libmpv.so.2.0.0.p/filters_filter.c.o libmpv.so.2.0.0.p/filters_frame.c.o libmpv.so.2.0.0.p/filters_user_filters.c.o libmpv.so.2.0.0.p/input_cmd.c.o libmpv.so.2.0.0.p/input_event.c.o libmpv.so.2.0.0.p/input_input.c.o libmpv.so.2.0.0.p/input_ipc.c.o libmpv.so.2.0.0.p/input_keycodes.c.o libmpv.so.2.0.0.p/misc_bstr.c.o libmpv.so.2.0.0.p/misc_charset_conv.c.o libmpv.so.2.0.0.p/misc_dispatch.c.o libmpv.so.2.0.0.p/misc_json.c.o libmpv.so.2.0.0.p/misc_natural_sort.c.o libmpv.so.2.0.0.p/misc_node.c.o libmpv.so.2.0.0.p/misc_random.c.o libmpv.so.2.0.0.p/misc_rendezvous.c.o libmpv.so.2.0.0.p/misc_thread_pool.c.o libmpv.so.2.0.0.p/misc_thread_tools.c.o libmpv.so.2.0.0.p/options_m_config_core.c.o libmpv.so.2.0.0.p/options_m_config_frontend.c.o libmpv.so.2.0.0.p/options_m_option.c.o libmpv.so.2.0.0.p/options_m_property.c.o libmpv.so.2.0.0.p/options_options.c.o libmpv.so.2.0.0.p/options_parse_commandline.c.o libmpv.so.2.0.0.p/options_parse_configfile.c.o libmpv.so.2.0.0.p/options_path.c.o libmpv.so.2.0.0.p/player_audio.c.o libmpv.so.2.0.0.p/player_client.c.o libmpv.so.2.0.0.p/player_command.c.o libmpv.so.2.0.0.p/player_configfiles.c.o libmpv.so.2.0.0.p/player_external_files.c.o libmpv.so.2.0.0.p/player_loadfile.c.o libmpv.so.2.0.0.p/player_main.c.o libmpv.so.2.0.0.p/player_misc.c.o libmpv.so.2.0.0.p/player_osd.c.o libmpv.so.2.0.0.p/player_playloop.c.o libmpv.so.2.0.0.p/player_screenshot.c.o libmpv.so.2.0.0.p/player_scripting.c.o libmpv.so.2.0.0.p/player_sub.c.o libmpv.so.2.0.0.p/player_video.c.o libmpv.so.2.0.0.p/stream_cookies.c.o libmpv.so.2.0.0.p/stream_stream.c.o libmpv.so.2.0.0.p/stream_stream_avdevice.c.o libmpv.so.2.0.0.p/stream_stream_cb.c.o libmpv.so.2.0.0.p/stream_stream_concat.c.o libmpv.so.2.0.0.p/stream_stream_edl.c.o libmpv.so.2.0.0.p/stream_stream_file.c.o libmpv.so.2.0.0.p/stream_stream_lavf.c.o libmpv.so.2.0.0.p/stream_stream_memory.c.o libmpv.so.2.0.0.p/stream_stream_mf.c.o libmpv.so.2.0.0.p/stream_stream_null.c.o libmpv.so.2.0.0.p/stream_stream_slice.c.o libmpv.so.2.0.0.p/sub_ass_mp.c.o libmpv.so.2.0.0.p/sub_dec_sub.c.o libmpv.so.2.0.0.p/sub_draw_bmp.c.o libmpv.so.2.0.0.p/sub_filter_sdh.c.o libmpv.so.2.0.0.p/sub_img_convert.c.o libmpv.so.2.0.0.p/sub_lavc_conv.c.o libmpv.so.2.0.0.p/sub_osd.c.o libmpv.so.2.0.0.p/sub_osd_libass.c.o libmpv.so.2.0.0.p/sub_sd_ass.c.o libmpv.so.2.0.0.p/sub_sd_lavc.c.o libmpv.so.2.0.0.p/video_csputils.c.o libmpv.so.2.0.0.p/video_decode_vd_lavc.c.o libmpv.so.2.0.0.p/video_filter_refqueue.c.o libmpv.so.2.0.0.p/video_filter_vf_format.c.o libmpv.so.2.0.0.p/video_filter_vf_sub.c.o libmpv.so.2.0.0.p/video_fmt-conversion.c.o libmpv.so.2.0.0.p/video_hwdec.c.o libmpv.so.2.0.0.p/video_image_loader.c.o libmpv.so.2.0.0.p/video_image_writer.c.o libmpv.so.2.0.0.p/video_img_format.c.o libmpv.so.2.0.0.p/video_mp_image.c.o libmpv.so.2.0.0.p/video_mp_image_pool.c.o libmpv.so.2.0.0.p/video_out_aspect.c.o libmpv.so.2.0.0.p/video_out_bitmap_packer.c.o libmpv.so.2.0.0.p/video_out_dither.c.o libmpv.so.2.0.0.p/video_out_dr_helper.c.o libmpv.so.2.0.0.p/video_out_filter_kernels.c.o libmpv.so.2.0.0.p/video_out_gpu_context.c.o libmpv.so.2.0.0.p/video_out_gpu_error_diffusion.c.o libmpv.so.2.0.0.p/video_out_gpu_hwdec.c.o libmpv.so.2.0.0.p/video_out_gpu_lcms.c.o libmpv.so.2.0.0.p/video_out_gpu_libmpv_gpu.c.o libmpv.so.2.0.0.p/video_out_gpu_osd.c.o libmpv.so.2.0.0.p/video_out_gpu_ra.c.o libmpv.so.2.0.0.p/video_out_gpu_shader_cache.c.o libmpv.so.2.0.0.p/video_out_gpu_spirv.c.o libmpv.so.2.0.0.p/video_out_gpu_user_shaders.c.o libmpv.so.2.0.0.p/video_out_gpu_utils.c.o libmpv.so.2.0.0.p/video_out_gpu_video.c.o libmpv.so.2.0.0.p/video_out_gpu_video_shaders.c.o libmpv.so.2.0.0.p/video_out_libmpv_sw.c.o libmpv.so.2.0.0.p/video_out_vo.c.o libmpv.so.2.0.0.p/video_out_vo_gpu.c.o libmpv.so.2.0.0.p/video_out_vo_image.c.o libmpv.so.2.0.0.p/video_out_vo_lavc.c.o libmpv.so.2.0.0.p/video_out_vo_libmpv.c.o libmpv.so.2.0.0.p/video_out_vo_null.c.o libmpv.so.2.0.0.p/video_out_vo_tct.c.o libmpv.so.2.0.0.p/video_out_vo_kitty.c.o libmpv.so.2.0.0.p/video_out_win_state.c.o libmpv.so.2.0.0.p/video_repack.c.o libmpv.so.2.0.0.p/video_sws_utils.c.o libmpv.so.2.0.0.p/osdep_io.c.o libmpv.so.2.0.0.p/osdep_semaphore_osx.c.o libmpv.so.2.0.0.p/osdep_subprocess.c.o libmpv.so.2.0.0.p/osdep_threads.c.o libmpv.so.2.0.0.p/osdep_timer.c.o libmpv.so.2.0.0.p/ta_ta.c.o libmpv.so.2.0.0.p/ta_ta_talloc.c.o libmpv.so.2.0.0.p/ta_ta_utils.c.o libmpv.so.2.0.0.p/input_ipc-unix.c.o libmpv.so.2.0.0.p/osdep_path-unix.c.o libmpv.so.2.0.0.p/osdep_polldev.c.o libmpv.so.2.0.0.p/osdep_subprocess-posix.c.o libmpv.so.2.0.0.p/osdep_terminal-unix.c.o libmpv.so.2.0.0.p/sub_filter_regex.c.o libmpv.so.2.0.0.p/osdep_main-fn-unix.c.o libmpv.so.2.0.0.p/osdep_timer-linux.c.o libmpv.so.2.0.0.p/audio_chmap_avchannel.c.o libmpv.so.2.0.0.p/player_javascript.c.o libmpv.so.2.0.0.p/sub_filter_jsre.c.o libmpv.so.2.0.0.p/demux_demux_libarchive.c.o libmpv.so.2.0.0.p/stream_stream_libarchive.c.o libmpv.so.2.0.0.p/stream_stream_bluray.c.o libmpv.so.2.0.0.p/player_lua.c.o libmpv.so.2.0.0.p/audio_filter_af_rubberband.c.o libmpv.so.2.0.0.p/video_filter_vf_fingerprint.c.o libmpv.so.2.0.0.p/video_zimg.c.o libmpv.so.2.0.0.p/audio_out_ao_alsa.c.o libmpv.so.2.0.0.p/audio_out_ao_jack.c.o libmpv.so.2.0.0.p/audio_out_ao_pipewire.c.o libmpv.so.2.0.0.p/audio_out_ao_pulse.c.o libmpv.so.2.0.0.p/video_drmprime.c.o libmpv.so.2.0.0.p/video_out_drm_atomic.c.o libmpv.so.2.0.0.p/video_out_drm_common.c.o libmpv.so.2.0.0.p/video_out_drm_prime.c.o libmpv.so.2.0.0.p/video_out_hwdec_hwdec_drmprime.c.o libmpv.so.2.0.0.p/video_out_hwdec_hwdec_drmprime_overlay.c.o libmpv.so.2.0.0.p/video_out_vo_drm.c.o libmpv.so.2.0.0.p/video_out_placebo_ra_pl.c.o libmpv.so.2.0.0.p/video_out_placebo_utils.c.o libmpv.so.2.0.0.p/video_out_vo_gpu_next.c.o libmpv.so.2.0.0.p/video_out_gpu_next_context.c.o libmpv.so.2.0.0.p/video_out_gpu_spirv_shaderc.c.o libmpv.so.2.0.0.p/video_out_wayland_common.c.o libmpv.so.2.0.0.p/video_out_vo_wlshm.c.o libmpv.so.2.0.0.p/video_out_vo_x11.c.o libmpv.so.2.0.0.p/video_out_x11_common.c.o libmpv.so.2.0.0.p/video_out_vo_xv.c.o libmpv.so.2.0.0.p/video_out_present_sync.c.o libmpv.so.2.0.0.p/video_out_opengl_context_drm_egl.c.o libmpv.so.2.0.0.p/video_out_opengl_context_wayland.c.o libmpv.so.2.0.0.p/video_out_opengl_context_x11egl.c.o libmpv.so.2.0.0.p/video_out_opengl_egl_helpers.c.o libmpv.so.2.0.0.p/video_filter_vf_gpu.c.o libmpv.so.2.0.0.p/video_out_opengl_common.c.o libmpv.so.2.0.0.p/video_out_opengl_context.c.o libmpv.so.2.0.0.p/video_out_opengl_formats.c.o libmpv.so.2.0.0.p/video_out_opengl_libmpv_gl.c.o libmpv.so.2.0.0.p/video_out_opengl_ra_gl.c.o libmpv.so.2.0.0.p/video_out_opengl_utils.c.o libmpv.so.2.0.0.p/video_out_vulkan_context.c.o libmpv.so.2.0.0.p/video_out_vulkan_context_display.c.o libmpv.so.2.0.0.p/video_out_vulkan_utils.c.o libmpv.so.2.0.0.p/video_out_vulkan_context_wayland.c.o libmpv.so.2.0.0.p/video_out_vulkan_context_xlib.c.o libmpv.so.2.0.0.p/video_filter_vf_vavpp.c.o libmpv.so.2.0.0.p/video_vaapi.c.o libmpv.so.2.0.0.p/video_out_vo_vaapi.c.o libmpv.so.2.0.0.p/video_out_hwdec_hwdec_vaapi.c.o libmpv.so.2.0.0.p/video_out_hwdec_dmabuf_interop_gl.c.o libmpv.so.2.0.0.p/video_out_hwdec_dmabuf_interop_pl.c.o libmpv.so.2.0.0.p/video_out_vo_dmabuf_wayland.c.o libmpv.so.2.0.0.p/video_out_hwdec_dmabuf_interop_wl.c.o libmpv.so.2.0.0.p/video_out_wldmabuf_context_wldmabuf.c.o libmpv.so.2.0.0.p/video_out_wldmabuf_ra_wldmabuf.c.o libmpv.so.2.0.0.p/video_out_wlbuf_pool.c.o -Wl,--as-needed -Wl,--allow-shlib-undefined -Wl,-O1 -shared -fPIC -Wl,--start-group -Wl,-soname,libmpv.so.2 -Wl,-z,noexecstack -rdynamic generated/wayland/libprotocols.a /home/fratti/proj/mpv-build/build_libs/lib/libass.a -lm -pthread /usr/lib/libz.a /usr/lib/libpcre2-8.a /usr/lib/libglib-2.0.a /usr/lib/libsysprof-capture-4.a -L/home/fratti/proj/mpv-build/build_libs/lib -lfontconfig -lfreetype -lbz2 -lbrotlidec -lbrotlicommon -lexpat -lgraphite2 -lfribidi -lpng16 -lharfbuzz /home/fratti/proj/mpv-build/build_libs/lib/libavcodec.a /usr/lib/gcc/x86_64-pc-linux-gnu/12.2.1/../../../../lib/libz.a /home/fratti/proj/mpv-build/build_libs/lib/libswresample.a /home/fratti/proj/mpv-build/build_libs/lib/libavutil.a -L/home/fratti/proj/mpv-build/build_libs/lib -lvpx -llzma -ldav1d -lfdk-aac -lopus -lx264 -lva-drm -lva-x11 -lvdpau -lva -latomic -lX11 /home/fratti/proj/mpv-build/build_libs/lib/libavfilter.a /home/fratti/proj/mpv-build/build_libs/lib/libswscale.a /home/fratti/proj/mpv-build/build_libs/lib/libpostproc.a /home/fratti/proj/mpv-build/build_libs/lib/libavformat.a -L/home/fratti/proj/mpv-build/build_libs/lib -lzimg -lxml2 -lbz2 -lgnutls -lssh -lsmbclient -lvpx -llzma -ldav1d -lfdk-aac -lopus -lx264 -lva-drm -lva-x11 -lvdpau -lva -latomic -lX11 -L/home/fratti/proj/mpv-build/build_libs/lib -lxml2 -lbz2 -lgnutls -lssh -lsmbclient -lvpx -llzma -ldav1d -lfdk-aac -lopus -lx264 -lva-drm -lva-x11 -lvdpau -lva -latomic -lX11 -L/home/fratti/proj/mpv-build/build_libs/lib -lva-drm -lva-x11 -lvdpau -lva -latomic -lX11 -L/home/fratti/proj/mpv-build/build_libs/lib -lva-drm -lva-x11 -lvdpau -lva -latomic -lX11 -L/home/fratti/proj/mpv-build/build_libs/lib -lva-drm -lva-x11 -lvdpau -lva -latomic -lX11 -ldl -lmujs -lpthread -llcms2 -larchive -lcrypto -lacl -lexpat -llzma -lzstd -llz4 -lbz2 -lssl /home/fratti/proj/mpv-build/build_libs/lib/libavdevice.a -L/home/fratti/proj/mpv-build/build_libs/lib -ljack -lxcb -lxcb-shm -lxcb-shape -lxcb-xfixes -lasound -lpulse -lSDL2 -lv4l2 -lXv -lXext -lzimg -lxml2 -lbz2 -lgnutls -lssh -lsmbclient -lvpx -llzma -ldav1d -lfdk-aac -lopus -lx264 -lva-drm -lva-x11 -lvdpau -lva -latomic -lX11 -lbluray -lxml2 -llzma -licui18n -licuuc -licudata -lbz2 -lgraphite2 -lbrotlidec -lbrotlicommon -lfontconfig -lfreetype -lpng16 -lharfbuzz -lexpat -lrt -Wl,-E -lluajit-5.1 -lrubberband -lfftw3 -lsamplerate /usr/lib/gcc/x86_64-pc-linux-gnu/12.2.1/../../../../lib/libatomic.so /usr/lib/libstdc++.a -luchardet -lzimg -lasound -ljack -lpipewire-0.3 -L/usr/lib/pulseaudio -lpulse -lpulsecommon-16.1 -ldrm -lgbm -ljpeg /home/fratti/proj/mpv-build/build_libs/lib/libplacebo.a -L/home/fratti/proj/mpv-build/build_libs/lib -lunwind -llzma -lshaderc_shared -lvulkan -llcms2 /usr/lib/libshaderc_combined.a -lwayland-client -lffi -lwayland-cursor -lwayland-client -lffi -lxkbcommon -lX11 -lxcb -lXau -lXdmcp -lXss -lX11 -lxcb -lXau -lXext -lXdmcp -lXext -lX11 -lxcb -lXau -lXdmcp -lXinerama -lX11 -lxcb -lXau -lXext -lXdmcp -lXpresent -lX11 -lxcb -lXau -lXfixes -lXrandr -lXext -lXrender -lXdmcp -lXrandr -lX11 -lxcb -lXau -lXext -lXrender -lXdmcp -lXv -lX11 -lxcb -lXau -lXext -lXdmcp -lEGL -lwayland-egl -lwayland-client -lffi -lvulkan -lva -lva-drm -lva -lva-wayland -lva -lwayland-client -lffi -lva-x11 -lva -lwayland-client -lffi -Wl,--end-group
/usr/bin/ld: /home/fratti/proj/mpv-build/build_libs/lib/libavcodec.a(h264_intrapred.o): warning: relocation against `ff_pb_3' in read-only section `.text'
/usr/bin/ld: /home/fratti/proj/mpv-build/build_libs/lib/libavcodec.a(vc1dsp_mmx.o): relocation R_X86_64_PC32 against symbol `ff_pw_9' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: final link failed: bad value
collect2: error: ld returned 1 exit status

pls fix uwu :3

LaserEyess commented 1 year ago

meson-logs.txt pls

And ninja logs

CounterPillow commented 1 year ago

Here you go qtpa2tie

meson-log.txt

Dunno where ninja logs are other than the ones output to the terminal.

LaserEyess commented 1 year ago

${buildir}/build.ninja for ninja logs

CounterPillow commented 1 year ago

https://0x0.st/s/jOpuZTexO3L11VjFO_sV-Q/ohGq.ninja

LaserEyess commented 1 year ago

As I'm sure you've guessed the issue seems to be ffmpeg and the like not being compiled with -fPIC for statically linking into libmpv.so. I guess waf is doing something different here. Mpv seems to be doing it right, though.

Dudemanguy commented 1 year ago

It's actually mpv lacking some flags. --enable-pic is enabled in the build for ffmpeg.

eli-schwartz commented 1 year ago

${buildir}/build.ninja for ninja logs

This is not a log :P It's the equivalent of asking to upload the generated Makefile.