mpv-player / mpv

🎥 Command line video player
https://mpv.io
Other
26.71k stars 2.84k forks source link

0.38.0: windows options are checked on Linux with `--auto-features=enabled` #14241

Closed kloczek closed 1 month ago

kloczek commented 1 month ago

mpv Information

Looks like when meson is executed with `--auto-features=enabled` windows options are checked on Linux.

Other Information

Reproduction Steps

Run meson with --auto-features=enabled.

Expected Behavior

Only Linux option should be checked when meson is executed on Linux.

Actual Behavior

Look like Windows options are checked.

Log File

+ /usr/bin/meson setup --buildtype=plain --prefix=/usr --libdir=/usr/lib64 --libexecdir=/usr/libexec --bindir=/usr/bin --sbindir=/usr/sbin --includedir=/usr/include --datadir=/usr/share --mandir=/usr/share/man --infodir=/usr/share/info --localedir=/usr/share/locale --sysconfdir=/etc --localstatedir=/var --sharedstatedir=/var/lib --wrap-mode=nodownload --auto-features=enabled . x86_64-redhat-linux-gnu -D audiounit=disabled -D build-date=false -D coreaudio=disabled -D cplayer=true -D egl-android=disabled -D egl-angle-lib=disabled -D egl-angle-win32=disabled -D egl-angle=disabled -D html-build=disabled -D jack=disabled -D javascript=disabled -D libmpv=true -D opensles=disabled -D oss-audio=disabled -D sdl2-audio=disabled -D sdl2-gamepad=disabled -D sdl2-video=disabled -D sdl2=disabled -D sixel=disabled -D sndio=disabled -D spirv-cross=disabled -D videotoolbox-pl=disabled -D vulkan-interop=disabled -D werror=false
The Meson build system
Version: 1.4.0
Source dir: /home/tkloczko/rpmbuild/BUILD/mpv-0.38.0
Build dir: /home/tkloczko/rpmbuild/BUILD/mpv-0.38.0/x86_64-redhat-linux-gnu
Build type: native build
Project name: mpv
Project version: 0.38.0
C compiler for the host machine: /usr/bin/gcc (gcc 14.1.1 "gcc (GCC) 14.1.1 20240522 (Red Hat 14.1.1-4)")
C linker for the host machine: /usr/bin/gcc ld.bfd 2.42.50.20240513
Host machine cpu family: x86_64
Host machine cpu: x86_64
Program python3 found: YES (/usr/bin/python3)
Found pkg-config: YES (/usr/bin/pkg-config) 2.1.1
Run-time dependency libavcodec found: YES 61.3.100
Run-time dependency libavfilter found: YES 10.1.100
Run-time dependency libavformat found: YES 61.1.100
Run-time dependency libavutil found: YES 59.8.100
Run-time dependency libswresample found: YES 5.1.100
Run-time dependency libswscale found: YES 8.1.100
Run-time dependency libplacebo found: YES 6.338.2
Run-time dependency libass found: YES 0.17.2
Compiler for C supports arguments -Werror=implicit-function-declaration: YES
Compiler for C supports arguments -Wno-missing-field-initializers: YES
Compiler for C supports arguments -Wno-sign-compare: YES
Compiler for C supports arguments -Wno-unused-parameter: YES
Compiler for C supports arguments -Wno-cast-function-type: YES
Compiler for C supports arguments -Wempty-body: YES
Compiler for C supports arguments -Wdisabled-optimization: YES
Compiler for C supports arguments -Wstrict-prototypes: YES
Compiler for C supports arguments -Wno-format-zero-length: YES
Compiler for C supports arguments -Wno-redundant-decls: YES
Compiler for C supports arguments -Wvla: YES
Compiler for C supports arguments -Wno-format-truncation: YES
Compiler for C supports arguments -Wimplicit-fallthrough: YES
Compiler for C supports arguments -fno-math-errno: YES
Compiler for C supports arguments -Wformat -Werror=format-security: YES
Compiler for C supports link arguments -Wl,-z,noexecstack: YES
Compiler for C supports link arguments -Wl,--nxcompat,--no-seh,--dynamicbase: NO
Run-time dependency dl found: YES
Library atomic found: YES
Compiler for C supports link arguments -rdynamic: YES

meson.build:362:44: ERROR: Feature win32-threads cannot be enabled

Sample Files

No response

I carefully read all instruction and confirm that I did the following:

kloczek commented 1 month ago

Looks loke the same is with MacOS option.

Dependency appleframeworks (modules: Foundation, AudioToolbox) skipped: feature audiounit disabled
Header "AudioToolbox/AudioToolbox.h" has symbol "kAudioUnitSubType_RemoteIO" skipped: feature audiounit disabled
Run-time dependency appleframeworks found: NO (tried framework)

meson.build:802:15: ERROR: Dependency "appleframeworks" not found, tried framework
llyyr commented 1 month ago

Not passing --auto-features works as intended.

  --auto-features {enabled,disabled,auto}
                                        Override value of all 'auto' features
                                        (default: auto).

According to meson docs, auto should be the default anyway so I'm not sure where this discrepancy comes from if you explicitly state the default.

kloczek commented 1 month ago

auto-features has nothing to do with checking non-Linux features on Linux. That options should force checking Linux only features as enabled shortening list of meson params. All distributions are using meson with --auto-features=enabled in build procedures.

kasper93 commented 1 month ago

Run meson with --auto-features=enabled.

Not supported use-case and unlikely to be supported. As always patches are welcome, but the burden of system checking every feature manually will make meson.build messy. Of course it could be done nicely, split into smaller meson.build files that would live in say osdep/<target>, but then targets have sub-targets. For example win32 mingw/msvc or all flavors of posix linux/freebsd/...

Some features simply doesn't make sense to be enabled if they are not supported like if you are building with older macos SDK, macos-12-features won't work.

Some are mutually exclusive, and disabled, for example if win32-threads is enabled, pthread-debug cannot be enabled.

Some features might be not available because the library is too old, even if the target system is "normally" compatible with given feature.

This is what auto detection is for. Detect if given feature is available, regardless of the system. Some features naturally won't be available on other systems, but some others might be. It is job for meson to detect things and not keep static table of enabled features.

All distributions are using meson with --auto-features=enabled in build procedures.

Citation needed. mpv is packaged by many distributions and it was never a problem.

kloczek commented 1 month ago

SuSE, Fedora/RHEL .. all uses by default in %meson macro --auto-features=enabled. Again: what is the sense checking blindly non-linux features on Linux or Linux factures on MacOS? Mingw/Cygwin it is another story.

kasper93 commented 1 month ago

Disabling auto detection is not supported currently. You can disable things that are expected to be not available on your distribution after doing --auto-features=enabled. Should be short enough list compared to enabling everything.

I've also had an idea to improve this, because it would simplify some scripts, but in the end of the day, refactoring whole meson.build was not on my wishlist ;)

Dudemanguy commented 1 month ago

mpv is multiplatform software. There are some features that are os-specific. If I on my linux machine pass -Dwin32-threads=enabled, then the build absolutely should fail because it is impossible for that feature to work. If it doesn't, there is a bug in the meson logic. Passing --auto-features=enabled makes no sense for mpv. You are blindly enabling every single feature. Of course it won't work on your machine.

I would be strongly against some weird hack that tries to detect if --auto-features=enabled was passed and then magically ignore os-specific stuff behind the user's back despite the fact they were passing nonsensical options to meson anyway. My suggestion would be simply don't do this. Throw in an --auto-features=auto after your distro's wrapper if you need to. Only enable what you actually need.

kloczek commented 1 month ago

Thera plenty of OS specific packages which ALREADY not checking some OS specyfice options even if they are specified. This is mpv is only known for me packa which ignores that and blindly checks those options.