mpv-player / mpv-build

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

build libplacebo #188

Closed zeromind closed 2 years ago

zeromind commented 2 years ago

Build libplacebo just like libass, ffmpeg etc.

resolves #186

kevmitch commented 2 years ago

Crap, I didn't see this. Comparing to my PR, it looks like I left out adding a blurb to the README.md, as well as the use-libplacebo-X scripts. I should also probably use alphabetical order in clean, build, and update like is done here.

Conversely, it seems that this PR is missing the libplacebo submodules init and doesn't handle meson's idiotic --reconfigure / --wipe semantics. It also doesn't address the final -lstd++ linking error coming from glslang when it tries to create the mpv executable. The debian stuff is also missing, although this PR doesn't break it and that could always be added separately.

@zeromind do you want to look into the issues raised above and update this PR, or should I incorporate the stuff I missed into mine?

zeromind commented 2 years ago

@kevmitch I've adapted the scripts to support the --wipe functionality from your PR. -lstd++ I added to both ffmpeg and mpv as they may both link against libplacebo, which may have glslang enabled.

I'd get an error from pkg-config when configuring ffmpeg without -lstd++:

/usr/lib64/gcc/x86_64-suse-linux/12/../../../../x86_64-suse-linux/bin/ld: /home/zeromind/src/github.com/zeromind/mpv-build/build_libs/lib/libplacebo.a(glsl_glslang.cc.o): undefined reference to symbol '_ZTVN10__cxxabiv117__class_type_infoE@@CXXABI_1.3'
/usr/lib64/gcc/x86_64-suse-linux/12/../../../../x86_64-suse-linux/bin/ld: /usr/lib64/libstdc++.so.6: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
ERROR: libplacebo >= 4.192.0 not found using pkg-config
haasn commented 2 years ago

Maybe we should work around this by just using shaderc instead of glslang in mpv-build.

kevmitch commented 2 years ago

yeah, was thinking of adding shaderc, but doesn't it have the same libstdc++ problem? what is the actual difference between using glslang vs shaderc? what happens when they're both enabled? also, what is the effect on mpv of enabling libunwind?

haasn commented 2 years ago

yeah, was thinking of adding shaderc, but doesn't it have the same libstdc++ problem? what is the actual difference between using glslang vs shaderc? what happens when they're both enabled? also, what is the effect on mpv of enabling libunwind?

shaderc links glslang statically so you don't need to specify glslang libraries when linking to shaderc at all. Actually, that suggests we probably could/should do the same in libplacebo.

what is the actual difference between using glslang vs shaderc?

The shaderc implementation has a few more debug paths and also enables optimization, but I don't think this is really meaningful.

what happens when they're both enabled?

shaderc is preferred when both are available, due to the aforementioned slight differences

also, what is the effect on mpv of enabling libunwind?

slightly better stack traces in runtime errors

kevmitch commented 2 years ago

could you squash this to a single commit?