Skip to content

Merge meson 1.12.1 - #29

Merged
rgommers merged 682 commits into
numpy:main-numpymeson-1.11from
mattip:main-numpymeson-1.12.1
Sep 29, 2026
Merged

rgommers merged 682 commits into
numpy:main-numpymeson-1.11from
mattip:main-numpymeson-1.12.1

Conversation

@mattip

@mattip mattip commented Sep 27, 2026

Copy link
Copy Markdown
Member

The merge of 1.12.1 into main-numpymeson-1.11 worked cleanly. I tried this locally and it seems to build NumPy. What is the correct way to validate that everything is correct?

Replaces #28

dcbaker and others added 30 commits June 2, 2026 14:17
This means that mypy will yell if someone tries to mutate one of these
values.
…bclassing

The code I came up with works with mypy for versions of Python >= 3.12,
but for 3.11 and 3.10 it still complains that _BASE_CLASS isn't a static
type. The problem is that in those versions `pathlib.Path` is a factory
instead of a type. But we can side step that because this hack exists
for Windows and only, and just directly inherit the WindowsPath
Drop the manual list of modules, and just add the mesonbuild/
directory.  This adds __init__.py, _pathlib.py and mesonlib.py,
which were previously not included.  _pathlib.py needs
workarounds for Python versions up to 3.11.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Upon further testing with a more complex project, I realised that Nasm
wants newlines and does NOT accept quotes+spaces for splitting
arguments. So for proper escaping this must be done with a custom
generator à la GNOME module, with a CustomTarget.

This reverts commit 173d760.
It requires a special flag `-@foo.rsp` and its contents must be
separated with newlines.

Both must be done externally to ninjabackend as the latter can
only handle newlines in input objects, not in arguments.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
normal compilers does not rely on the position of this argument,
but MSVC-like compilers treat `/link` and any argument after that
as linker arguments. MSVC-like compiler's linker_to_compiler_args
inject `/link` before largs, resulting it being forwarded to link.exe
not the compiler driver.

fixes cross compiling with cc = clang-cl and c_ld = lld-link.
this function does not pass enough args from the compiler object to find
windows sdk without relying on environment variables.
including a file from the same directory removes the dependency on stdlib.
…ixin

clang-cl supports C++11 natively, so CPP11AsCPP14Mixin is not needed.
Override get_option_std_args to use /clang:-std=c++N for all standards
except c++latest/vc++latest which still require /std:c++latest. Add
c++23 and vc++23 to the supported standards list.

Fixes mesonbuild#15845
Fuchsia is a microkernel-like OS that takes many cues from Plan9.

Co-Authored-by: Dylan Baker <dylan@pnwbakers.com>
If doing cc.get_define() with MSVC, for a symbol that isn't
defined, then get_define() can end up returning sentinel_undef
with a trailing space, as an actual defined string.

This happens if MSVC is called with -std:c11 (or -Zc:preprocessor,
to opt in to the newer, standards conformant preprocessor mode) and
the test source file is written with Unix newlines.

(This is observed if cross compiling with MSVC wrapped in Wine on
Unix, but probably would appear the same if Meson was running in
Cygwin/msys2 Python as well.)

This issue has been reported upstream to MSVC at [1].

[1] https://developercommunity.visualstudio.com/t/Inconsistent-whitespace-with-standard-pr/11023343
Targets created from functions such as `install_symlink` were not
automatically tagged as "runtime" when installed under sbindir like it
does when installed under bindir.
I have two signing keys. One is an older rsa4096 one, the newer ed25519
key I created when joining the Gentoo Developers team. Both keys are
still valid, and the newer key is signed by the older key.

When tagging release 1.11.1, I mistakenly uploaded assets signed by the
newer key, which should not actually be a big deal but was confusing
since it was not on this page. Update the docs so that people know this
key is acceptable.

Proofs for the new key:

- cross-sig from the old to new key

- recorded by https://github.com/eli-schwartz.gpg as a known key for me

- recorded by https://codeberg.org/eschwartz.gpg as a known key for me

- this git commit adding the new key to the docs page is signed by the
  old key

- my online identity as a Gentoo Developer is associated with this key
  as observable via:
  https://wiki.gentoo.org/wiki/User:Eschwartz
  https://www.gentoo.org/inside-gentoo/developers/#eschwartz

Fixes: mesonbuild#15901
The rc helper script uses flags specific for MSVC, which clang does not
understand:

> [19/1419] Compiling Windows resource subprojects/ffmpeg/windows_compile_resources_0_avfilterres.rc
> clang: error: no such file or directory: '/showIncludes'
> clang: error: no such file or directory: '/EP'
> clang: error: no such file or directory: '/nologo'
> clang: error: no such file or directory: '/DRC_INVOKED'
> clang: error: no such file or directory: '/Tcsubprojects/ffmpeg/avfilterres.rc'
> clang: error: no input files
Currently, `meson format --recursive` only recurse meson.build files
that are reachable via a `subdir` function. Add `--subprojects` flag to
also recurse subprojects.
As visible from generate_pbx_group(), folder_children is a PbxArray.
Use the same variable names in write_group_target_entry() for
clarity.

Fixes: mesonbuild#15905
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Add a clippy-json target to the ninja script.

This is useful for rust-analyzer, which requires an "external check
command" to function when not using cargo.

Also we add a "clippy-json-prereq" target, and invoke it in the
clippy.py script. The prereq target tries to build as much of the
project as possible with "-k0".
include_directories() can point to a build_subdir that a custom_target()
generated into, so the subdir must exist in the build tree at setup time.

Create a new function to abstract os.makedirs() and use it
validate_build_subdir().

Fixes: mesonbuild#15902
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This reverts commit f7758b9.
Deduplicating OpenMP linker arguments is in principle a
good idea, but it breaks -Xpreprocessor -fopenmp because
deduplication has no idea of which options have an
argument in a separate entry of the array.

Fixes: mesonbuild#15764
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
These were used by the old argument checking infrastructure, which has
all been removed.
detect_subsystem(system) is just a simple transformation if
system; do not require setting machine_info.subsystem at all
costs, and if it is unset just assume that it is okay since
the system has already been matched.

Regression introduced by commit 61c5859 ("envconfig: Cannot
run executables if subsystem doesn't match", 2026-02-04).

Fixes: mesonbuild#15840
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Instead of adding the relaxation universally, just comment out the raise
statement.  This allows the CMake module case (where the relaxation is
added intentionally) to not warn.

Add a test case that the warning happens, though.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
bonzini and others added 25 commits September 22, 2026 02:14
The get_all_linked_targets() method is incomplete, in that it does
not check other targets that provide objects for the target.
Because information about objects is not available in Build,
move the function to Backend.

Note that this drops the lru_cache; it is not necessary because
the function is called in two places and each of them runs at
most once per target.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
(cherry picked from commit 88c5b5d)
The get_all_linked_targets() method is incomplete, in that it does
not check other targets that provide objects for the target. While
ninjabackend.py does use `flatten_object_list` on the target itself,
it does not check any link_with or link_whole targets. And because the
static library in a `BothLibraries` object might actually have no sources
and have just an `ExtractedObjects` entry instead, using `link_with:
foo.get_static_lib()` in a Fortran program is broken.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
(cherry picked from commit bb575c2)
This removes duplicate code from the ninja backend.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
(cherry picked from commit 495f6d7)
Because extract_objects() will only look for sources, and not
for anything passed in `objects` for the target, it is by
definition non-recursive.  Only extract_all_objects() can return
recursive ExtractedObjects.

This ensures that all the recursive calls of _flatten_object_list()
receive exactly the same objlist argument for a given target,
instead of also getting recursive calls with empty objlists.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
_flatten_object_list can reach the same target through multiple
ExtractObjects, which causes an exponential blowup in the number of
recursive calls.  Introduce a set of visited dependencies (which has to
be returned anyway) and use it to ensure that each distinct target is
visited exactly once.

Depth-first order (aka post-order) ensures that each target using
extract_all_objects(recursive: true) is visited after the target
providing the objects, so perform a DFS and flatten each target
one by one: later visits will find the result of earlier visits
already.
Debian/Ubuntu have changed their packaging such that libclang-dev no
longer includes libclang-rt-dev. We require the libraries in
libclang-rt-dev to run some of our tests.

Signed-off-by: Tristan Partin <tristan@partin.io>
Part-of: mesonbuild#16165
Closes: mesonbuild#16165
Signed-off-by: Sam James <sam@gentoo.org>
(cherry picked from commit 34767ed)
Signed-off-by: Tristan Partin <tristan@partin.io>
(cherry picked from commit 570963b)
This reverts commit c63cfd9.
--env-set is being dropped from rustc.  It can be reapplied
once Meson starts supporting environment arguments natively.

(cherry picked from commit cb59331)
We would just run a loop of `x = y while x exists { x = f'{y}0' }`
which... means if `f'{y}0` exists we'll loop forever.

(cherry picked from commit 4d5484c)
There is no need to pass link-only arguments where we are only
compiling. This has led to real world issues:

Clang will emit a warning when unused arguments are passed on the
command line:

	clang: warning: argument unused during compilation: '-L/tmp/opencode' [-Wunused-command-line-argument]

This is a bit of a hard warning to trigger. The following is required:

1. Clang or Clang-derived compiler (clang-cl)
2. A cross build
3. No exe wrapper configured
4. c_link_args is non-empty

When (2) and (3) hold, the compile mode becomes
CompileCheckMode.COMPILE, which means we pass -c to clang's sanity check
command. When -c is passed to clang, it ignores linker arguments like
-L.

Signed-off-by: Tristan Partin <tristan@partin.io>
Part-of: mesonbuild#16142
Closes: mesonbuild#16142
Signed-off-by: Sam James <sam@gentoo.org>
(cherry picked from commit c9bb03c)
Commit 300d7c3 ("compilers: add link always args if
CompileCheckMode.LINK") made has_function() and friends pass the linker's
always args, so that e.g. -Zomf is not missing on OS/2 when a dependency
is used.  Before changing where those arguments are added, add a test.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Commit c9bb03c ("Stop passing link arguments to compile-only
sanity checks", 2026-08-28) dropped link arguments from compile-only
checks for CLikeCompiler.  Introduce Compiler._sanity_check_mode()
to move this logic up to Compiler and so that it applies also to
the super() call of CLikeCompiler._sanity_check_compile_args().

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Commit 797decc ("compilers: pass external args to sanity check")
made Compiler._sanity_check_compile_args() add {c,cpp}_args and
{c,cpp}_link_args, assuming the extra copies on the CLike path were
harmless because "arglist deduplicates them", but the sanity check
builds a plain list so nothing is deduplicated.  Furthermore,
the copy of linker arguments in s_largs would end up in front
of the /link that linker_to_compiler_args() inserts for MSVC-style
compilers.  For example, with c_link_args=['/SUBSYSTEM:CONSOLE']
the probe became

  cl ... /c /SUBSYSTEM:CONSOLE /link /SUBSYSTEM:CONSOLE

(the first from super()._sanity_check_compile_args, the second
from self._get_basic_compiler_args) instead of

  cl ... /c /link /SUBSYSTEM:CONSOLE

Stop using super()._sanity_check_compile_args() to remove the duplication
while keeping control of the position of the linker arguments.

Note that get_always_args() was also duplicated because
_get_basic_compiler_args() returns it via get_compiler_args_for_mode(),
so drop it as well.  The effect is to remove the copy of get_always_args()
that was previously in front of the output argument, and only keep the
one after the source file, but this is harmless.

Fixes: mesonbuild#16111
Fixes: 797decc ("compilers: pass external args to sanity check")
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Right now they are passed twice, but this will be fixed.  Add a
partial test for now.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Commit 300d7c3 ("compilers: add link always args if CompileCheckMode.LINK",
2026-01-07) added get_linker_always_args() to get_compiler_args_for_mode(),
but that function returns *compiler* arguments, and it is applied twice
to a compile check: once by CLikeCompiler._get_basic_compiler_args()
and once by Compiler.compile().

For MSVC this puts linker-only flags on the compiler command line twice
*and* in the wrong place:

  cl ... /release /nologo ... /release /nologo ... /link foo.lib

Add them to the linker argument list that is passed through
linker_to_compiler_args() instead of going through get_compiler_args_for_mode().
While that appears twice (in build_wrapper_args() and in the sanity check),
it is not necessary anymore to add linker always args in find_library()
now that build_wrapper_args() adds them.  Note that this does not include
the Ninja backend which has a call to get_linker_always_args() of its own.

Fixes: mesonbuild#16086
Fixes: 300d7c3 ("compilers: add link always args if CompileCheckMode.LINK", 2026-01-07)
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Commit decc3e assumed the sanity check goes through CompilerArgs,
but it does not.  Add to _sanity_check_compile_args() the
missing call to DCompiler.unix_args_to_native().

Fixes: mesonbuild#16115
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Avoid a repeated get_value_for() idiom.

Rust wraps the linker arguments with -Clink-arg as usual; this is
a bug fix for cc.links(), cc.has_function() and friends which
previously received the raw arguments.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
rustc's sanity check passes no external args at all.  Fix it
for consistency with other languages and to ensure that failures
are detected early.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
…ses or mixins

This is indicated as a problem in comments, and it causes problem with
recent changes to the sanity check command lines.  Get -fpermissive
from a separate method, and implement it where it was used before.

Fixes: mesonbuild#16203
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Match what GNU-like compiler does, helping with c++NN std.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Package seems to be unavailable for the gccx86ninja job's architecture.
@mattip

mattip commented Sep 27, 2026

Copy link
Copy Markdown
Member Author

Are tests expected to pass? I see failures like

>       project(node, ['Test Module Features'], {'version': '0.1'})

unittests/featurestests.py:116: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
mesonbuild/interpreterbase/decorators.py:283: in wrapper
    return f(*nargs, **wrapped_kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
mesonbuild/interpreterbase/decorators.py:656: in wrapper
    return f(*wrapped_args, **wrapped_kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
mesonbuild/interpreter/interpreter.py:1412: in func_project
    self.environment.wrap_resolver = wrap.Resolver(self.environment.get_source_dir(), subprojects_dir, self.subproject, wrap_mode)
                                          ^^^^^^^^
<string>:10: in __init__
    ???
mesonbuild/wrap/wrap.py:379: in __post_init__
    self.project_subdir = os.path.relpath(os.path.dirname(self.subdir_root), self.source_dir)
                                  ^^^^^^^
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

path = '', start = ''

    def relpath(path, start=None):
        """Return a relative version of a path"""
    
        if not path:
>           raise ValueError("no path specified")
E           ValueError: no path specified

@rgommers

Copy link
Copy Markdown
Member

Thanks @mattip. You can validate this by opening a draft PR to the main repo that updates the vendored meson git submodule, temporarily pointing at the branch you opened this PR from. Once it's green, we merge this PR, then retarget the PR on the main repo to the merge commit.

CI here can be ignored, it has never passed.

@rgommers rgommers left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM, thanks Matti!

@rgommers
rgommers merged commit 136c5f5 into numpy:main-numpymeson-1.11 Sep 29, 2026
18 of 31 checks passed
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.