Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[mingw64] [ffmpeg shared] LD fails because of several "multiple definitions" in libplacebo? #2644

Open
vt-idiot opened this issue Apr 15, 2024 · 9 comments

Comments

@vt-idiot
Copy link
Contributor

vt-idiot commented Apr 15, 2024

MABS fails with linker errors for multiple definitions caused by libplacebo? I tried deleting the build folders for ffmpeg-git, libplacebo, and SPIRV. Same issue persists.

11:55:27 ├ Compiling FFmpeg with Vapoursynth R65
11:55:27 ├ FFmpeg will need vapoursynth.dll and vsscript.dll to run using vapoursynth demuxers!
11:55:31   Running git clone for ffmpeg...
11:56:55   Running git update for ffmpeg...
11:57:00 ┌ ffmpeg git  ............................... [Recently updated]
11:57:00 ├ Changing options to comply to nonfree...
11:57:11 ├ Installing clang... done
0001-Add-Alternative-VapourSynth-demuxer.patch
        Patch could not be applied with `git am`. Continuing without patching.
11:57:43 ├ Compiling shared FFmpeg...
11:58:13 ├ Running configure...
13:52:45 ├ Running make...
Likely error (tail of the failed operation logfile):
J:/media-autobuild_suite-master/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: J:/media-autobuild_suite-master/local64/lib/libplacebo.a(vulkan_context.c.obj):context.c:(.text+0x9a0): multiple definition of `pl_vk_inst_create'; libavfilter/libavfilter.dll.a(avfilter_10_dll_d000942.o):(.text+0x0): first defined here
J:/media-autobuild_suite-master/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: J:/media-autobuild_suite-master/local64/lib/libplacebo.a(vulkan_context.c.obj):context.c:(.text+0x2830): multiple definition of `pl_vulkan_destroy'; libavfilter/libavfilter.dll.a(avfilter_10_dll_d000948.o):(.text+0x0): first defined here
J:/media-autobuild_suite-master/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: J:/media-autobuild_suite-master/local64/lib/libplacebo.a(vulkan_context.c.obj):context.c:(.text+0x31a0): multiple definition of `pl_vulkan_create'; libavfilter/libavfilter.dll.a(avfilter_10_dll_d000946.o):(.text+0x0): first defined here
J:/media-autobuild_suite-master/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: J:/media-autobuild_suite-master/local64/lib/libplacebo.a(vulkan_context.c.obj):context.c:(.text+0x4da0): multiple definition of `pl_vulkan_import'; libavfilter/libavfilter.dll.a(avfilter_10_dll_d000951.o):(.text+0x0): first defined here
J:/media-autobuild_suite-master/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: J:/media-autobuild_suite-master/local64/lib/libplacebo.a(vulkan_gpu.c.obj):gpu.c:(.text+0xc90): multiple definition of `pl_vulkan_get'; libavfilter/libavfilter.dll.a(avfilter_10_dll_d000949.o):(.text+0x0): first defined here
J:/media-autobuild_suite-master/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: J:/media-autobuild_suite-master/local64/lib/libplacebo.a(vulkan_gpu_tex.c.obj):gpu_tex.c:(.text+0x21f0): multiple definition of `pl_vulkan_wrap'; libavfilter/libavfilter.dll.a(avfilter_10_dll_d000960.o):(.text+0x0): first defined here
J:/media-autobuild_suite-master/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: J:/media-autobuild_suite-master/local64/lib/libplacebo.a(vulkan_gpu_tex.c.obj):gpu_tex.c:(.text+0x3770): multiple definition of `pl_vulkan_hold_ex'; libavfilter/libavfilter.dll.a(avfilter_10_dll_d000950.o):(.text+0x0): first defined here
J:/media-autobuild_suite-master/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: J:/media-autobuild_suite-master/local64/lib/libplacebo.a(vulkan_gpu_tex.c.obj):gpu_tex.c:(.text+0x3a20): multiple definition of `pl_vulkan_release_ex'; libavfilter/libavfilter.dll.a(avfilter_10_dll_d000955.o):(.text+0x0): first defined here
collect2.exe: error: ld returned 1 exit status
make: *** [/build/ffmpeg-git/Makefile:136: ffplay_g.exe] Error 1
make failed. Check J:/media-autobuild_suite-master/build/ffmpeg-git/build-shared-64bit/ab-suite.make.log
This is required for other packages, so this script will exit.
15:05:46   Creating diagnostics file...

Attach J:\media-autobuild_suite-master\build\logs.zip to the GitHub issue.
Make sure the suite is up-to-date before reporting an issue. It might've been fixed already.
Try running the build again at a later time.

I think this is the important bit? Removed the full path from every line except the first one for readability...

Likely error (tail of the failed operation logfile):
J:/media-autobuild_suite-master/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: J:/media-autobuild_suite-master/local64/lib/libplacebo.a(vulkan_context.c.obj):context.c:(.text+0x9a0): multiple definition of `pl_vk_inst_create'; libavfilter/libavfilter.dll.a(avfilter_10_dll_d000942.o):(.text+0x0): first defined here
ld.exe: libplacebo.a(vulkan_context.c.obj):context.c:(.text+0x2830): multiple definition of `pl_vulkan_destroy'; libavfilter/libavfilter.dll.a(avfilter_10_dll_d000948.o):(.text+0x0): first defined here
ld.exe: libplacebo.a(vulkan_context.c.obj):context.c:(.text+0x31a0): multiple definition of `pl_vulkan_create'; libavfilter/libavfilter.dll.a(avfilter_10_dll_d000946.o):(.text+0x0): first defined here
ld.exe: libplacebo.a(vulkan_context.c.obj):context.c:(.text+0x4da0): multiple definition of `pl_vulkan_import'; libavfilter/libavfilter.dll.a(avfilter_10_dll_d000951.o):(.text+0x0): first defined here
ld.exe: libplacebo.a(vulkan_gpu.c.obj):gpu.c:(.text+0xc90): multiple definition of `pl_vulkan_get'; libavfilter/libavfilter.dll.a(avfilter_10_dll_d000949.o):(.text+0x0): first defined here
ld.exe: libplacebo.a(vulkan_gpu_tex.c.obj):gpu_tex.c:(.text+0x21f0): multiple definition of `pl_vulkan_wrap'; libavfilter/libavfilter.dll.a(avfilter_10_dll_d000960.o):(.text+0x0): first defined here
ld.exe: libplacebo.a(vulkan_gpu_tex.c.obj):gpu_tex.c:(.text+0x3770): multiple definition of `pl_vulkan_hold_ex'; libavfilter/libavfilter.dll.a(avfilter_10_dll_d000950.o):(.text+0x0): first defined here
ld.exe: libplacebo.a(vulkan_gpu_tex.c.obj):gpu_tex.c:(.text+0x3a20): multiple definition of `pl_vulkan_release_ex'; libavfilter/libavfilter.dll.a(avfilter_10_dll_d000955.o):(.text+0x0): first defined here

logs.zip

@vt-idiot vt-idiot changed the title [mingw64] [ffmpeg shared] multiple definition of... [mingw64] [ffmpeg shared] LD fails because of several "multiple definitions" in libplacebo? Apr 15, 2024
@L4cache
Copy link
Contributor

L4cache commented Apr 16, 2024

I can't even get libplacebo to pass the configure step

@vt-idiot
Copy link
Contributor Author

I can't even get libplacebo to pass the configure step

Weird. That part seems to work fine on my end. Here's some stuff from \build\libplacebo-git\build-64bit since I'm not sure if logs.zip includes everything or just the logs from the package that failed (ffmpeg). If there's anything else that might help someone figure it out, let me know.

ab-suite.build.log
ab-suite.install.log
ab-suite.meson.log

and \build\libplacebo-git\build-64bit\meson-private\__CMake_compiler_info__\CMakeFiles\CMakeConfigureLog.yaml.log for good measure?

I know very little about how this all works, but doesn't multiple definition... mean that it's trying to link against libplacebo in a way that it shouldn't?

@L4cache
Copy link
Contributor

L4cache commented Apr 16, 2024

Oh I mean the ffmpeg's configure... my bad.
libplacebo, even when I was able to build ffmpeg with some time ago, is broken when using -vf libplacebo, at least on my side, so there's definitely something wrong

@vt-idiot
Copy link
Contributor Author

Oh I mean the ffmpeg's configure... my bad. libplacebo, even when I was able to build ffmpeg with some time ago, is broken when using -vf libplacebo, at least on my side, so there's definitely something wrong

Ah. ffmpeg configure took two hours on my end, but it did finish. If I can tie my computer up for another 8 hours because someone probably made some more cosmetic commits to curl and libass I can try skipping the dynamic/shared ffmpeg compile and going only for static.

-vf libplacebo being broken doesn't bode well since I only care for it in ffmpeg so it can end up in mpv "downstream"

@L4cache
Copy link
Contributor

L4cache commented Apr 17, 2024

I was able to build ffmpeg with libplacebo from scratch (using your ffmpeg_option.txt) but it's still crashes when I use -vf libplacebo.
However, I think it's not necessary to link libplacebo to the ffmpeg for use in mpv (and tried). mpv can "directly" link libplacebo, it's mpv's own thing (sort of) to begin with.

@Andarwinux
Copy link

You can't mix dynamic and static ffmpeg and libplacebo. Either build only static libplacebo and static ffmpeg, or build only dynamic libplacebo and dynamic ffmpeg.
haasn/libplacebo#221

@vt-idiot
Copy link
Contributor Author

However, I think it's not necessary to link libplacebo to the ffmpeg for use in mpv (and tried). mpv can "directly" link libplacebo, it's mpv's own thing (sort of) to begin with.

Thank you @L4cache - I will disable libplacebo in ffmpeg since I never use it there anyways and give it a shot.

Either build only static libplacebo and static ffmpeg, or build only dynamic libplacebo and dynamic ffmpeg.
I don't

@Andarwinux I think m-ab-s is only building static libplacebo? It looks like do_meson in media-suite_helper.sh is hardcoded to build static libraries log "meson" meson setup "$root" --default-library=static --buildtype=release \

@Andarwinux
Copy link

You can manually append --default-library=shared to override the template args.

@vt-idiot
Copy link
Contributor Author

I have never once used -vf libplacebo in ffmpeg so I just disabled it entirely in ffmpeg_options.txt which got it to compile.

14:12:39 ├ Compiling FFmpeg with Vapoursynth R65
14:12:39 ├ FFmpeg will need vapoursynth.dll and vsscript.dll to run using vapoursynth demuxers!
14:13:22   Running git update for ffmpeg...
14:13:41 ┌ ffmpeg git  .................................. [Updates found]
14:13:42 ├ Changing options to comply to nonfree...
14:13:55 ├ Installing clang... done
0001-Add-Alternative-VapourSynth-demuxer.patch
        Patch could not be applied with `git am`. Continuing without patching.
14:14:35 ├ Compiling shared FFmpeg...
14:15:17 ├ Running configure...
16:17:27 ├ Running make...
17:39:33 ├ Running install...
17:40:08 ├ Compiling static FFmpeg...
17:40:53 ├ Running configure...

We'll see if this make it all the way to mpv or not, then I'll just close this issue since it appears to be core to how libplacebo itself is compiled on Windows ? and would probably require building libplacebo twice.

If you've come across this issue later and are now reading this, and you build both dynamic and static ffmpeg, make a copy of your ffmpeg_options.txt, call it ffmpeg_options_shared.txt, and comment out # --enable-libplacebo. Your dynamic ffmpeg compile won't have libplacebo.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants