| Age | Commit message (Collapse) | Author |
|
We don't always check if a library is actually linkable because of concerns
that a library may not be standalone, so linking against it may still have
unresolved references. We can workaround that by building a shared library
as a test rather than an executable, and in fact we already do that in a
bunch of cases since bb5f2ca3da821d7a8e865cd55a8d5d638e0aab22.
This comes up in particular with Fedora and dependency('atomic') because
on x86_64, they provide a libatomic.so linker script (so our file existence
check passes), but trying to use it later on will fail if the backing package
isn't installed.
_get_file_from_list has not been deleted because the Ninja backend's
guess_library_absolute_path uses it. We might be able to change it to
also use a link test but I've left that alone.
Test notes:
* The _test_all_naming unittest has been tweaked because we were using a
blank file rather than an actual shared library, which (as expected),
now fails.
* I've also added a test for dependency('atomic') providing a result that
can actually be linked against. I've not made it check generally whether
dependency('atomic') finds something when we expect to (at least for now)
as it'll involve some CI whack-a-mole.
Bug: https://bugzilla.redhat.com/show_bug.cgi?id=2352531
Bug: https://github.com/mesonbuild/meson/issues/14946
Closes: https://github.com/mesonbuild/meson/issues/10936
|
|
In an Ubuntu Bionic container with Python 3.7.5:
```
$ python3 -c 'import tempfile; print(tempfile.mkdtemp(dir=""))'
tmpycdjfo6m
$ python3 -c 'import tempfile; print(tempfile.mkdtemp(dir=None))'
/tmp/tmpy6dlpv0r
```
Pass dir as None to get the behaviour we need - which is how newer Pythons
act, as otherwise we aren't running in the cwd for the compile test
that we expect.
This shows up as a failure in _test_all_naming when _find_library_real is
modified to use links().
|
|
Intel's oneAPI installation, as of 2025.3, no longer provides the
classic ifort compiler, only the newer llvm-based ifx compiler.
|
|
The Microchip XC32 compiler is a GCC-based compiler implemented using
existing GNU compiler classes. As the XC32 version and GCC version do
not match mixins have been implemented to override versions used in
versions checks where applicable.
|
|
Replace the hardcoded version strings with class attributes to allow
subclasses to override them.
|
|
|
|
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
It really isn't a sanity check that a specific compiler doesn't work on
a specific platform. This re-implements the check as a shared component
in the ASMCompiler base class, which has the advantage of code sharing.
|
|
This will be able to hold some shared state between the different ASM
compilers (or should that be assemblers?)
|
|
|
|
This is used for project to require a nightly Rust compiler, and also
for Meson to enable nightly feature if available.
|
|
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
This fixes the following error occured in the test 3 of the Emscripten
build.
> wasm-ld: error: unable to find library -llibvalue.a
Signed-off-by: Kohei Tokunaga <ktokunaga.mail@gmail.com>
|
|
Work around https://github.com/llvm/llvm-project/issues/129881.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
Use the same check for all of clang, nasm and rustc.
This also avoids the following warning:
Sanity check compiler command line: clang++ sanitycheckobjcpp.mm -o sanitycheckobjcpp.exe -D_MT -D_DLL -D_DEBUG -D_FILE_OFFSET_BITS=64 -Wl,-fms-runtime-lib=dll_dbg Sanity check compile stdout:
LINK : warning LNK4044: unrecognized option /fms-runtime-lib=dll_dbg; ignored
iWhat happens is that -fms-runtime-lib sets up an automatic dependency
from the .o files to the final link product, and therefore must be
passed as a compiler argument. But the constructor for ClangCompiler
was incorrectly allowing b_vscrt for MINGW, so I messed up the logic.
With this change, MINGW won't get the b_vscrt option.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
|
|
On Windows, rustc searches both FOO.lib and libFOO.a when passed -lfoo.
This means that the check for nonstandard names in the Unix sense is
too struct, and indeed it breaks passing for example -lkernel32 (which
adds kernel32.lib to the link).
Fix this by special casing Windows. Extract the logic to the Rust
compiler class for clarity.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
This reverts commit 1e254ad7f327e5ed2021463e4b66c37072d354e3.
|
|
This reverts commit be50d0e23737dc0fc5f074a291644d7fde39ef7b.
|
|
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
The two methods are identical.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
This reverts commit 806289a5d27958a084bc6cba41b7cf9ccee4ecf4.
|
|
This reverts commit 8847c938dd1c9e2c6e64e3050eb58f7ec54fccb3.
|
|
This reverts commit 08221c6d1fc4a6afe780a479bbc7e40899242601.
|
|
and Linux"
This reverts commit c520e8981693056419d846f60ffb85061bf3191f.
|
|
This leaves other systems to be implemented, as I don't have a good way
of checking that they work correctly.
|
|
ASM has some special concerns because it has to be implemented in terms
of assembling an object, and then linking the object with a linker or
linker driver. That makes the implementation somewhat complex.
There is a bit of a hack going on here with the `_run_sanity_check`
method and the mro. I'm still thinking about how best to handle that.
|
|
Such as NASM and MASM. These compilers don't actually do any linking,
the just produce object files. As such, we need the C compiler to link
the program in order to make things like sanity_check work.
|
|
The goal is to reduce code duplication, and allow each language to
implement as little as possible to get good checking. The main
motivation is that half of the checks are fragile, as they add the work
directory to the paths of the generated files they want to use. This
works when run inside mesonmain because we always have an absolute build
directory, but when put into run_project_tests.py it doesn't work
because that gives a relative build directory.
|
|
It really isn't a sanity check that a specific compiler doesn't work on
a specific platform. This re-implements the check as a shared component
int he ASMCompiler base class, which has the advantage of code sharing
|
|
This will be able to hold some shared state between the different ASM
compilers (or should that be assemblers?)
|
|
Signed-off-by: Kushal Pal <kushpal@qti.qualcomm.com>
|
|
The main complication here is that passing -fms-runtime-lib during compilation
results in a warning:
clang: error: argument unused during compilation: '-fms-runtime-lib=dll' [-Werror,-Wunused-command-line-argument]
(https://github.com/mesonbuild/meson/actions/runs/17727020048/job/50369771571).
So, for compilation expand the -D flags by hand, and only pass -fms-runtime-lib
when linking.
Fixes: #14571
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
get_crt_link_args was only called for the final linker command line; add
its result to the sanity check and compiler tests as well.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
Option values have type "str | int | list[str]", assert that they are
strings before passing them to self.get_crt_compile_args().
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
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>
|