Age | Commit message (Collapse) | Author | Files | Lines |
|
ccache has been for a long time compatible with MSVC (since 4.6)
but when using debug mode, the /Z7 flag must be passed instead of
/Zi.
See https://ccache.dev/releasenotes.html#_ccache_4_6
|
|
According to https://clang.llvm.org/docs/CommandGuide/clang.html#cmdoption-flto,
the -object_path_lto flag is needed to preserve the intermediate object
files.
|
|
Rust 1.84 uses the latest emsdk 3.1.68 [1], and it fixed an
issue with Emscripten dynamic linking and libc [2]. After that no
native-static-libs in the output if running:
```
rustc --target=wasm32-unknown-emscripten --crate-type staticlib --print native-static-libs - < /dev/null
```
[1] https://github.com/rust-lang/rust/pull/131533
[2] https://github.com/rust-lang/libc/pull/4002
|
|
a16ec8b0fb6d7035b669a13edd4d97ff0c307a0b changed the threshold to 17
for Apple Clang, but it needs to be 16 instead.
Bug: https://github.com/mesonbuild/meson/issues/14440
Closes: https://github.com/mesonbuild/meson/issues/14856
|
|
|
|
|
|
|
|
rustc only needs to be a linker if there are any Rust-ABI dependencies.
Skip it whenever linking to a C-ABI dependency. This makes it possible
for Meson to pick 'rust' whenever it sees Rust sources, but not whenever
it sees Rust used by a dependency with "rust_abi: 'c'".
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
together
Rust sources are not compiled separately: generation of the .a or .so
or binary happens at the same time as compilation. There is no separate
compilation phase where the .o file is created.
In preparation for moving generate_rust_target where generate_link is now,
make the compilation phase of generate_target skip them.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
|
|
Commit eca1ac18dc1978b15b500c9f1710c05cb1ccc0ec (#14252) added support
for properly detecting the -Wno-vla-larger-than flag: a value must be
specified for its positive form (-Wvla-larger-than=N), or GCC will exit
with the error "missing argument to ‘-Walloc-size-larger-than=’".
There is a handful of other -Wno-* flags whose positive form act in the
same manner, but are not covered here:
* -Wno-alloc-size-larger-than (GCC >=7.1.0)
* -Wno-alloca-larger-than (GCC >=7.1.0)
* -Wno-frame-larger-than (GCC >=4.4.0)
* -Wno-stack-usage (GCC >=4.7.0)
Add logic to treat these in the same way.
Signed-off-by: Henrik Lehtonen <eigengrau@vm86.se>
|
|
|
|
rustdoc does not support --print, and therefore the rpath argument corresponding
to the rust installation is not passed to doctests.
Forward anything that requires --print to the RustCompiler, thus fixing
doctests with a shared library dependency.
Fixes: #14813
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
Without adding .pxi` as a known header suffix, the added test will
fail with:
```
No specified compiler can handle file stuff.pxi
```
Technically only .pxd are header files, and .pxi are "include files"
which are literally included in .pyx files. Adding them as headers
seems to be fine though, since they're kinda similar and the point is
to avoid treating them as source files.
|
|
As an initial implementation, simply adding "-C prefer-dynamic" works
for binary crates (as well as dylib and proc-macro that already used it).
In the future this could be extended to other crate types. For more
information see the comment in the changed file, as well as
https://github.com/mesonbuild/meson/issues/8828 and
https://github.com/mesonbuild/meson/issues/14215.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
RustCompiler.build_rpath_args works by appending the directory to the
arguments computed by self.linker.build_rpath_args. This does not
work if there is no argument to begin with, which happens for example
in program crates.
Use the new extra_paths argument to force inclusion of the libdir into
the rpath of the binary, even in that case.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
CUDA 12.9.0 ships a cccl that supports the new debug macros.
|
|
That is where env_opts are stored, so make the compiler call back directly
into the environment.
Suggested-by: Dylan Baker <dylan@pnwbakers.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
This restores the behavior before 1.8's option store refactoring.
The bug arises because c_link_args has been stored in pending_options,
and therefore the extended value (which get_global_options correctly
computes) is overwritten by the value passed on the command line.
In fact, this bug is the reason why I added the "link_args_from_envvar"
check: the CFLAGS would be ignored anyway, so I put that logic in code
instead of relying on the option store's behavior.
The fix is to extend the value *after* the option has been added and
the pending_options resolved. This requires a tiny refactoring of
the split between CoreData.add_lang_args and compilers.get_global_options.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
Commit 2d1c67f09 ("options: restore special behavior of CFLAGS vs. c_args",
2025-05-15) incorrectly checked the presence of c_link_args, and did not
apply CFLAGS if c_link_args was set. This was not the behavior of 1.7,
so remove the check.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
In get_option_std_args for the Intel C compiler, the requested command line flag is 'winlibs' which returns a list of strings of libs.
It should be 'std' as in other adjacent classes, to return the particular value of the C standard desired.
|
|
|
|
As is the case with most other methods, it must be overriden in
another compiler for it to have any use. Only the Swift compiler
uses this method at this time.
|
|
As of Swift 5.9, C++/Objective-C++ code can be mixed with Swift, and
C++ APIs can be imported to Swift. However, this must be explicitly
enabled, as it is disabled by default.
Xcode 15 introduces a new setting for this, so only set it on Xcode 15
and above.
|
|
Based on reports from the users, PGI compilers need an explicit "-o -"
on the command line to emit preprocessed output on stdout. Override
the methods in the PGICompiler mixin to add it when output goes to
stdout but not when output goes elsewhere.
Fixes: #13216
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
|
|
|
|
Signed-off-by: Kushal Pal <kushpal@qti.qualcomm.com>
|
|
|
|
|
|
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
For compatibility with Autotools, CFLAGS is added to the linker command
line if the compiler acts as a linker driver. However, this behavior
was lost in commit d37d649b0 ("Make all Meson level options overridable
per subproject.", 2025-02-13).
The issue is that (for example) c_link_args is stored in env.options, and
from that point on it is treated as a machine-file option. This includes
not being able to override it in compilers.get_global_options:
- initialize_from_top_level_project_call places it in pending_options
- add_lang_args passes the right value to add_compiler_option
- add_compiler_option calls add_system_option_internal
- add_system_option_internal fishes the value out of pending_options
and ignores what get_global_options provided.
Instead, store the putative values of the compiler options coming from
the environment in a separate dictionary, that is only accessed by
get_global_options. This way it never appears in pending_options, and
also there is no internal *_env_args variable anymore.
Fixes: #14533
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
Fixes a regression introduced in commit d37d649b08b8 "Make all Meson level
options overridable per subproject." This change results in every file
printing the warning "cl : Command line warning D9002 : ignoring unknown
option '/std:vc++14'"
Now that "get_option_..." is called before overwriting the option (instead
of after), we have to operate on compiler options, not meson options.
There is no such compiler option as /std:vc++14 (the meson option vc++xx is
split into /std:c++xx for the C++ standard version, and a separate flag
that enables Microsoft extensions). Remove the mapping from c++14 to
vc++14.
|
|
|
|
libc++ deprecated _LIBCPP_ENABLE_ASSERTIONS from version 18.
However, the libc++ shipped with Apple Clang backported that
deprecation in version 17 already,
which is the version which Apple currently ships for macOS.
This PR changes the _LIBCPP_ENABLE_ASSERTIONS deprecation check
to use version ">=17" on Apple Clang.
|
|
Avoid reinventing the wheel and instead use a single helper, taking care
of logging and cross compilation.
Fixes: #14373
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
Particularly if using an exe_wrapper, it can be useful to have output
logged for debugging.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
This will be handled by target binary link. And if it's not compatible
with what Rust uses, it wouldn't work anyway.
|
|
Apple linkers need to use different arguments on macOS and iOS-like platforms.
Pass the system to the constructor so that it can be examined.
Co-authored-by: Russell Keith-Magee <russell@keith-magee.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
If the user specifies java sources as input to a non-jar build
target, raise an error with a message directing them to use the jar
target instead.
Fixes: https://github.com/mesonbuild/meson/issues/13870
|
|
|
|
Move building the -std option to the new get_option_std_args method,
special casing CUDA to never include the option from the host compiler.
This fixes again #8523, which was broken by the option refactoring
(unsurprisingly, since the fix was ripped out unceremoniously without
a replacement).
Fixes: #14365
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
Allow CUDA to completely override the -std arguments but not the rest.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
Windows toolchains append `.exe` to executables. When cross-compiling on
Linux, attempting to run `./rusttest` will not execute the generated
`rusttest.exe`.
Fix this by always appending `.exe`, which is a valid filename on all
supported platforms. This is what the `CLikeCompiler` class does too.
While reviewing `rust.py`, there are opportunities for improvements and
better unification with the rest of the Meson code. However, this commit
focuses on fixing cross-compilation with minimal changes.
Fixes: #14374
|
|
This makes more sense from a "group all options together" It also allows
us to remove a bunch of imports in functions, a clear code smell.
|
|
Pass down the full_version, otherwise assigning "self.is_beta"
fails.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
Adjust get_rust_compiler_args() to accept the crate-type externally, because
rustdoc tests are an executable but are compiled with the parent target's
--crate-type.
Apart from that, the rustdoc arguments are very similar to the parent target, and
are handled by the same functions that were split out of generate_rust_target.
This concludes the backend implementation of doctests, only leaving the
implementation of a doctest() function in the rust module.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
This will be used by rustdoc tests because the Test objects takes a
single string for the command and everything else goes in the args.
But apart from this, the need to split the executable from the
arguments is common so create new methods to do it.
While at it, fix brokenness in the handling of the zig compiler, which
is checking against "zig" but failing to detect e.g. "/usr/bin/zig".
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
Allow reusing the code for doctests. In particular, the sources are
shared between the two cases.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|