Skip to content

Filter extra_paths on Windows to only include SharedLibrary targets - #16039

Open
tristan957 wants to merge 2 commits into
mesonbuild:masterfrom
tristan957:windows
Open

Filter extra_paths on Windows to only include SharedLibrary targets#16039
tristan957 wants to merge 2 commits into
mesonbuild:masterfrom
tristan957:windows

Conversation

@tristan957

Copy link
Copy Markdown
Member

determine_windows_extra_paths() on non-Windows is not used for too much. It is used in two instances. In those two instances, extra_paths has very narrow use cases.

  • Backend::get_devenv(): we add to extra_paths for every build.Executable. This also happens on Windows.
  • Backend::get_executable_serialisation(): extra_paths is empty on non-Windows.

It is important to remember that Windows has no equivalent to {DY,}LD_LIBRARY_PATH. Instead it looks up DLLs on PATH. Performing this filter will have an adverse effect on adding build outputs from build.CustomTarget to PATH. However, when setting {DY,}LD_LIBRARY_PATH, we filter for build.SharedLibrary explicitly, so it was an oversight in the original patch[0] to include this additional behavior.

Link: #14649 [0]
Fixes: #16010
Supersedes: #16011

@tristan957
tristan957 requested a review from jpakkane as a code owner July 27, 2026 18:22
@tristan957
tristan957 requested review from dcbaker and eli-schwartz and removed request for jpakkane July 27, 2026 18:22
@tristan957

Copy link
Copy Markdown
Member Author

cc @lb90

We set IFS to do some parsing, but never unset it. This is a problem in
our Windows setups because paths have a colon, which separates the
drive letter from the rest of the path.

    /d/a/meson/meson/test cases/common/230 external project/libfoo/configure: line 47: D: command not found

Signed-off-by: Tristan Partin <tristan@partin.io>
determine_windows_extra_paths() on non-Windows is not used for too much.
It is used in two instances. In those two instances, extra_paths has very
narrow use cases.

- Backend::get_devenv(): we add to extra_paths for every
  build.Executable. This also happens on Windows.
- Backend::get_executable_serialisation(): extra_paths is empty on
  non-Windows.

It is important to remember that Windows has no equivalent to
{DY,}LD_LIBRARY_PATH. Instead it looks up DLLs on PATH. Performing this
filter will have an adverse effect on adding build outputs from
build.CustomTarget to PATH. However, when setting {DY,}LD_LIBRARY_PATH,
we filter for build.SharedLibrary explicitly, so it was an oversight in
the original patch[0] to include this additional behavior.

Link: mesonbuild#14649 [0]
Fixes: mesonbuild#16010
Supersedes: mesonbuild#16011
Signed-off-by: Tristan Partin <tristan@partin.io>
@tristan957

Copy link
Copy Markdown
Member Author

This is now rebased on #16041 to hopefully fix a CI issue. Please merge that, and then I can rebase again.

@tristan957

Copy link
Copy Markdown
Member Author

Although it has no effect, it might be good to merge #16040 first, and then I can rebase this PR on master.

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.

determine_windows_extra_paths() can add too many paths

1 participant