Skip to content

meson: use vapoursynth get-include to get include dir#18127

Open
kasper93 wants to merge 2 commits into
mpv-player:masterfrom
kasper93:vs_inc
Open

meson: use vapoursynth get-include to get include dir#18127
kasper93 wants to merge 2 commits into
mpv-player:masterfrom
kasper93:vs_inc

Conversation

@kasper93

Copy link
Copy Markdown
Member

To build vf_vapoursynth headers are needed. With newer VS versions those are located in Python module, while for older they are installed in system. Try Python module first and fallback to pkg-config.

Note that this requires vapoursynth to be available during build time. If you use venv or similar, make sure it's activated.

Fixes: #18126

@kasper93

Copy link
Copy Markdown
Member Author

/cc @CrendKing

kasper93 added 2 commits June 14, 2026 20:29
To build vf_vapoursynth headers are needed. With newer VS versions those
are located in Python module, while for older they are installed in
system. Try Python module first and fallback to pkg-config.

Note that this requires vapoursynth to be available during build time.
If you use venv or similar, make sure it's activated.

Fixes: mpv-player#18126
This is what actually exposes VSScript4.h header we need. On newer
versions we expect `get-include` to work, as vapoursynth-script.pc no
longer exists.
@CrendKing

Copy link
Copy Markdown
Contributor

Thanks for doing this. I wonder if we should suggest to VapourSynth to move their development-related files such as the headers and the pkg-config .pc file they ship to pkg-config like the old way? mpv can't be the only project suffering the blow.

Comment thread meson.build
vs_inc = vs_get_inc.stdout().strip()
if vs_get_inc.returncode() == 0 and fs.is_dir(vs_inc)
vs_incdirs = include_directories(vs_inc, is_system: true)
if cc.has_header('VSScript4.h', include_directories: vs_incdirs)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since the include dir path is returned by VapourSynth itself, I feel we should just trust it and no need to verify the actual file existence. The likelihood user has both a broken R74 and a working R56 installed in the same system should be low.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See #18126 (comment), I even added fs.is_dir(vs_inc) because of it.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems an OS-specific problem and they found a solution? My point is, the only difference these checks can make is that user has broken R74 like the issue reporter and simultaneously has a working R56 installed, thus instead of failing the meson configure, we use R56 for dependency. In any other cases (R74 working or R56 not installed) the checks don't make a difference. And I assume there is not a security reason for these checks right?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the main regression that happened for the user there, because it is working with 0.41.0 release version. Is that we no longer get vapoursynth-script dependency, and instead only vapoursynth. Which seems to point on different location.

@CrendKing

Copy link
Copy Markdown
Contributor

Also, vapoursynth get-pkgconfig-dir returns the directory of the .pc file. I wonder if we can plug it into Meson and simplify a bit.

@kasper93

Copy link
Copy Markdown
Member Author

Also, vapoursynth get-pkgconfig-dir returns the directory of the .pc file. I wonder if we can plug it into Meson and simplify a bit.

Yes, I know. The question is what is the canonical way to use this. Because ok, there is .pc file, that only set include dir, so we can do it ourselves. If distros don't want to use include-dir from python module, well tough luck. They can remove them, I guess.

Additionally, there is no way to use custom pkg-config path in meson itself. So, it has to be done before calling it. That's fine, but something to remember.

@kasper93

Copy link
Copy Markdown
Member Author

Just to say, there is multiple ways to make this work. It can be made backward compatible on package level, it can be pointed into .pc file from python module, it can query headers directly.

I don't particularly care, but I feel like querying include dir directly, makes it the most portable. Also on Windows, where .pc never worked in fact.

I don't see the need to detour through pkg-config, when we only need include dir. Currently we need the fallback for old version only.

I don't want to force this change, but it seems clean.

@CrendKing

Copy link
Copy Markdown
Contributor

All good. The include dir method certainly works and portable.

@Andarwinux

Copy link
Copy Markdown
Contributor

It looks like this will break cross-compilation. If vapoursynth is installed on host, it will find the host vapoursynth instead of in cross install prefix.

@kasper93

Copy link
Copy Markdown
Member Author

It looks like this will break cross-compilation. If vapoursynth is installed on host, it will find the host vapoursynth instead of in cross install prefix.

How do you install Python project in you cross prefix? Can you show me your cross build with recent vapoursynth?

@Andarwinux

Copy link
Copy Markdown
Contributor

It looks like this will break cross-compilation. If vapoursynth is installed on host, it will find the host vapoursynth instead of in cross install prefix.

How do you install Python project in you cross prefix? Can you show me your cross build with recent vapoursynth?

https://github.com/zhongfly/mpv-winbuild/blob/main/patch/0003-vapoursynth-remove-delayload-libary-generation-and-u.patch

We just manually copied vapoursynth's headers to prefix with custom .pc. This method actually works.

@quietvoid

Copy link
Copy Markdown
Contributor

It looks like this will break cross-compilation. If vapoursynth is installed on host, it will find the host vapoursynth instead of in cross install prefix.

Does it matter where it finds header files? They're only required for compilation.

@Andarwinux

Copy link
Copy Markdown
Contributor

It looks like this will break cross-compilation. If vapoursynth is installed on host, it will find the host vapoursynth instead of in cross install prefix.

Does it matter where it finds header files? They're only required for compilation.

This would break seal and reproducibility. We currently explicitly target vapoursynth headers to R72, but if meson decided to include host headers, it will actually use a version that we cannot control.

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

Successfully merging this pull request may close these issues.

(mpv-build) Fail to build on openSUSE Tumbleweed

4 participants