Commit Graph

14558 Commits

Author SHA1 Message Date
Andres Freund 7148b4f207 macos: Do not emit -undefined,error for Sonoma compatibility
Emitting -undefined,error was correct,, but starting with Xcode 15 / Sonoma,
doing so triggers "ld: warning: -undefined error is deprecated". Given that
"-undefined error" is documented to be the linker's default behaviour, this
warning seems ill advised. However, it does create a lot of noise.  As
"-undefined error" is the default behaviour, the least bad way to deal with
this seems to be to just not emit anything. Of course that only works as long
as nothing else injects -undefined dynamic_lookup, or such. Complain to Apple.

Fixes: https://github.com/mesonbuild/meson/issues/12450
2023-12-06 23:20:09 +02:00
Eli Schwartz 39ecfc2d54
compilers: drop dead code
no_warn_args is unused. Its only purpose was to implement automatic
hiding of UB in transpiled code, and it was not used at all in languages
other than C/C++ -- specifically when the C/C++ source files were
created by transpiling from vala or cython.
2023-12-05 19:52:23 -05:00
Eli Schwartz 5f659af870
ninja backend: don't hide all compiler warnings for transpiled languages
This was originally added for vala only, with the rationale that vala
generates bad code that has warnings. Unfortunately, the rationale was
fatally flawed. The compiler warns about a number of things, which the
user can control depending on their code (or their code generator's
code), but some of those things are absolutely critical to warn about.

In particular, GCC 14 and clang 17 are updating their defaults to warn
-- and error by default for -- invalid C code that breaks the standard,
but has been silently accepted for over 20 years "because lots of people
do it". The code in question is UB, and compilers will generate faulty
machine code that behaves erroneously and probably has a mass of CVEs
waiting to happen.

Compiler warnings are NOT safe to just... universally turn off. Compiler
warnings could be either:

- coding style lints

- threatening statements that the code is factually and behaviorally wrong

There is no magic bullet to ignore the former while respecting the
latter. And the very last thing we should ever do is pass `-w`, since
that causes ALL warnings to be disabled, even the manually added
`-Werror=XXX`.

If vala generated code creates warnings, then the vala compiler can
decrease the log level by generating better code, or by adding warning
suppression pragmas for *specific* issues, such as unused functions.
2023-12-05 19:51:56 -05:00
Andres Freund 30184a48a0 macos: Skip as-needed test, the linker is too smart
The new linker in Sonoma / Xcode 15 considers the dependency via the
initializer sufficient to pull in the library. The man page now notes:
  The linker never dead strips initialization and termination routines.
  They are considered "roots" of the dead strip graph.

I could not find a good way to skip only if the linker version is new
enough. Before long everyone will be using the new linker anyway...
2023-12-04 23:54:59 +02:00
Dylan Baker f1c748df87 run_project_tests: remove debug print 2023-12-04 14:36:43 -05:00
Randy Eckenrode dcff439df0 Fix test failure on Darwin on a case-sensitive fs
This was encountered while looking into an issue with
https://github.com/NixOS/nixpkgs/pull/268583.

I run my Nix store on case-sensitive APFS, so the test fails due to
trying to link `-framework ldap` instead of `-framework LDAP`.
2023-12-04 16:23:59 +02:00
Christoph Reiter 6eee9e7c0c python: fix mingw python detection code in case pkg-config isn't available
The code assumed that sysconfig.get_platform() returns "mingw" for mingw Python,
but that's no longer the case for 2.5 years now, as it now only starts with
"mingw" and contains further information like the arch and other ABI relevant things
to avoid conflicts.

This updates the detection code to the current status quo. mingw Python only documents
right now that it starts with "mingw", and none of that arch stuff, but it's
unlikely that this will change, and this looks less error prone than looking at CC.

Fixes #12547
2023-12-03 13:42:45 -05:00
Andres Freund 4ddaef8133 macos: Fix test case for constructor_priority when using gcc
GCC does not support constructor_priority on macos. It's possibly not the only
platform for which that is the case, but...
2023-12-03 14:04:46 +02:00
Andres Freund c1f0897248 macos: Fix path in test to be Sonoma compatible
The path tested prior does not exist anymore in Sonoma. It seems less likely
that 'cat' will be removed, so use that.
2023-12-03 12:53:15 +02:00
Andres Freund eb44957c1f Handle macos linker reporting error message in pluring during detection
Previously macos reported "ld: unknown option: --version" when being passed
--version, but now sometimes it reports in plural, albeit without an obvious
pattern when.  To handle that, simply just check for the prefix without the :

Fixes: https://github.com/mesonbuild/meson/issues/12552
2023-12-03 12:50:04 +02:00
Jan200101 9016e6958b Only convert boolean values for cmake formats
This caused a regression with mesondefine where
  `conf_data.set("FOO", true)`
turned into
  `#define FOO 1`
instead of
  `#define FOO`
2023-12-02 19:51:44 -05:00
Dylan Baker a85353cd83 cmake: Handle compiler.find_library returning None
I'm not 100% sure that warning is the appropriate action, but it's
better than failing with a backtrace.

Fixes: #12555
2023-12-01 16:19:16 -08:00
Dylan Baker 52638e8c65 dependencies/base: Make MissingCompiler inherit Compiler for mypy
This allows mypy and pyright to correctly determine the return types
from methods, but makes 0 changes at runtime.
2023-12-01 16:19:16 -08:00
Will Toohey 8c70ce466b More robust linker detection for armar (TI vs non-TI) 2023-12-01 22:11:41 +02:00
Eli Schwartz cf64e062bb run_mypy: avoid type-checking tools against every possible python version 2023-11-26 17:12:52 -05:00
Eli Schwartz 739bdef431 NOMERGE: do we need strictyaml too? 2023-11-26 17:12:52 -05:00
Eli Schwartz caa38dad45 fix broken type annotation imports being ignored
If an annotation could not be resolved, it's classified as a "missing
import" and our configuration ignored it:

```
Skipping analyzing "mesonbuild.backends": module is installed, but missing library stubs or py.typed marker
```

As far as mypy is concerned, this library may or may not exist, but it
doesn't have any typing information at all (may need to be installed
first).

We ignored this because of our docs/ and tools/ thirdparty dependencies,
but we really should not. It is trivial to install them, and then
enforce that this "just works".

By enforcing it, we also make sure typos get caught.
2023-11-26 17:12:52 -05:00
Xavier Claessens 319b41b4c9 mlog: Catch OSError when closing pager
For some reasons, with msys2 it sometimes raises OSError instead of
BrokenPipeError.

Fixes: #12541
2023-11-26 01:37:02 -05:00
Xavier Claessens 85e4ee5b54 File: Add full_path() method
This is needed now that str.format() is not allowing it any more. It is
also more consistent with other objects that have that method as well,
such as build targets.

Fixes: #12406
2023-11-24 22:15:14 +02:00
Bin Meng 7f5f432ec9 docs: Update Quick-guide.md
Change the shell prompt to '#' to when installing as root.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
2023-11-22 22:30:58 +02:00
Gerion Entrup 3605981466 docs/dependency: fix type of version kwarg 2023-11-22 22:29:49 +02:00
Filipe Laíns 63453564ee docs: document out of bounds behavior in str.substring
Signed-off-by: Filipe Laíns <lains@riseup.net>
2023-11-22 22:15:13 +02:00
Peter Harris 96f0b3ca38 Update release frequency to match reality
Releases have been happening an average of once every 90 days for the
past two years (since 0.60.0). If we just look at releases since 1.0.0,
the average is over 100 days.
2023-11-22 22:14:21 +02:00
Alyssa Ross 9aa1393fdb docs: fix bindgen_clang_arguments example
> error: unsupported option '--target'; did you mean '-target'?
2023-11-22 22:13:39 +02:00
Fini Jastrow 30ab9747ae clike: Deduplicate rpath linker flags
[why]
On Apple clang 15.0.0 linker (i.e. ld64 1015.7) giving the same rpath
multiple times raises a warning:

ld: warning: duplicate -rpath '/local/lib' ignored

This can frequently happen when linking several dependencies that all
have that rpath in e.g. pkgconfig.

[how]
Deduplicate all rpath arguments.

[note]
I'm not sure how the code handles --start/end-group, but for rpath that
should not make any difference as that is not bound to a group.

Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
2023-11-22 22:11:50 +02:00
Xavier Claessens 4a1e0235cc wrap: Cache get_releases()
"meson wrap status" was calling it for each .wrap file. Better use
lru_cache to ensure we don't make the same mistake elsewhere.
2023-11-22 22:10:01 +02:00
Xavier Claessens 5e06eb9b89 wraptool: Remove dead code
Update command is implemented in msubprojects.py, because it can update
all wraps in parallel.
2023-11-22 22:10:01 +02:00
Chris Lamb 2ed94ccb47 Make the Requires.private line in generated .pkgconfig files reproducible
Whilst working on the Reproducible Builds effort, we noticed that
meson was generates .pkgconfig files that are not reproducible.

For example, here is neatvnc's pkgconfig file when built with HEAD^1:

   Name: neatvnc
   Description: A Neat VNC server library
   Version: 0.7.0
  -Requires.private: pixman-1, aml < 0.4.0, aml >= 0.3.0, zlib, libdrm, libturbojpeg, gnutls, nettle, hogweed, gmp, gbm, libavcodec, libavfilter, libavutil
  +Requires.private: pixman-1, aml >= 0.3.0, aml < 0.4.0, zlib, libdrm, libturbojpeg, gnutls, nettle, hogweed, gmp, gbm, libavcodec, libavfilter, libavutil
   Libs: -L${libdir} -lneatvnc
   Libs.private: -lm
   Cflags: -I${includedir}

This is, ultimately, due to iterating over the contents of a set within a
DefaultDict and can thus be fixed by sorting the output immediately prior to
generating the Requires.private string.

An alternative solution would be to place the sorted(…) call a few lines
down:

    return ', '.join(sorted(result))

However, this changes the expected ordering of the entire line, and many users
may be unhappy with that (alternative) change as a result. By contrast, this
commit will only enforce an ordering when there are multiple version
requirements (eg. a lower and a higher version requirement, ie. a version
range). It will, additionally, order them with the lower part of the range
first.

This was originally filed (with a slightly different patch) by myself in
the the Debian bug tracker <https://bugs.debian.org/1056117>.

Signed-off-by: Chris Lamb <lamby@debian.org>
2023-11-22 22:08:35 +02:00
Tamás Bálint Misius dfd8cfbd8d vs2010backend: fix incompatibility with custom manifests
EmbedManifest seems to default to true, which creates a default manifest based
on other parameters (likewise defaults) and makes it impossible to supply your
own with CREATEPROCESS_MANIFEST_RESOURCE_ID. There is value to being able to do
this and no value to the default one, so this should be disabled.
2023-11-20 19:25:36 +02:00
Jussi Pakkanen dea72e42bf Bump version number for new development. 2023-11-19 22:39:16 +02:00
Jussi Pakkanen 7368795d13 Generate release notes for 1.3.0. 2023-11-19 21:58:19 +02:00
Jussi Pakkanen 1c0c89d30f Bump version number for release. 2023-11-19 21:44:41 +02:00
David Seifert 8928669a69
Fix unity builds (#12452)
* unity builds: correct integer ceiling division

* edge case failure with unity builds:
  - static archive bar that gets installed, that links with another static
    archive foo that does not get installed
  - the number of files in static archive foo is divisible by unity_size

would yield an error with ninja:

  ninja: error: 'subprojects/foo/src/libfoo.a.p/meson-generated_foo-unity1.cpp.o', needed by 'src/libbar.a', missing and no known rule to make it

* unity builds: test for build failure when #files is divisible by unity_size
2023-11-18 11:08:41 +02:00
albert 2b49408395 note on glib library 2023-11-17 12:29:11 -05:00
Marcel Telka 6901ec394f Remove shebang from rewriter.py 2023-11-16 08:31:29 -05:00
Eli Schwartz 398c4b2287
dependencies: allow get_variable to define multiple pkgconfig defines
It was previously impossible to do this:

```
dep.get_pkgconfig_variable(
    'foo',
    define_variable: ['prefix', '/usr', 'datadir', '/usr/share'],
)
```

since get_pkgconfig_variable mandated exactly two (if any) arguments.

However, you could do this:
```
dep.get_variable(
    'foo',
    pkgconfig_define: ['prefix', '/usr', 'datadir', '/usr/share'],
)
```

It would silently do the wrong thing, by defining "prefix" as
`/usr=datadir=/usr/share`, which might not "matter" if only datadir was
used in the "foo" variable as the unmodified value might be adequate.

The actual intention of anyone writing such a meson.build is that they
aren't sure whether the .pc file uses ${prefix} or ${datadir} (or which
one gets used, might have changed between versions of that .pc file,
even).

A recent refactor made this into a hard error, which broke some projects
that were doing this and inadvertently depending on some .pc file that
only used the second variable. (This was "fine" since the result was
essentially meaningful, and even resulted in behavior identical to the
intended behavior if both projects were installed into the same prefix
-- in which case there's nothing to remap.)

Re-allow this. There are two ways we could re-allow this:
- ignore it with a warning
- add a new feature to allow actually doing this

Since the use case which triggered this bug actually has a pretty good
reason to want to do this, it makes sense to add the new feature.

Fixes https://bugs.gentoo.org/916576
Fixes https://github.com/containers/bubblewrap/issues/609
2023-11-14 14:59:12 -05:00
Jussi Pakkanen dac3f26ee5 Bump version number for rc3. 2023-11-14 00:37:04 +02:00
Dylan Baker f8e87134a4 type_checking: simplify error message for object validation 2023-11-14 00:36:51 +02:00
Dylan Baker 7e1aed0abc type_checking: fix typo 2023-11-14 00:36:51 +02:00
Eli Schwartz cddf2e9d87 fix another regression in converting build_target kwargs to typed_kwargs
This time we have a case where people are passing non-objects by using
them as str | File, which we never warned about and silently accepted.
If it was passed via custom_target outputs we *would* error out,
interestingly enough. At the backend layer, we just pass them directly
to the linker... which is valid, if we misdetected what's a valid linker
input or people just used funny names. In particular, the mingw
toolchain allows passing a *.def file directly, and some people are
doing that.

If we do want to allow this, we should do it consistently. For now, just
follow the current theme of what's expected, but do so by warning
instead of fatally erroring, for cases where users were able to do it in
the past.
2023-11-13 23:43:42 +02:00
Xavier Claessens 2da53e943a rust: Add transitive dependencies to ninja rules
In the case r1 -> s1 -> s2 where s1 and s2 are uninstalled C static
libraries, the libs1.a rule does not depend on libs2.a. That means that
r1 rule must depend on both s1 and s2.
2023-11-13 23:17:14 +02:00
Eli Schwartz 0bc01e87d9
CI: adapt to renamed fedora package when building updated images 2023-11-12 19:58:55 -05:00
Eli Schwartz 76e6340f4b fix regression in converting build_target kwargs to typed_kwargs
We haven't actually verified that these kwargs are equal to what we had
before, and should probably revert the entire series. But I have
multiple reports in the wild of projects that no longer build because of
`install: [true, false, get_option('foobar')]` which was always
incorrect and always equal to just dropping values all over the floor
and treating it the same as "bool(value) == True".

Special case this particular typed kwarg and allow it with a sternly
worded warning that it was always wrong and should never ever ever be
done.

Fixes: https://bugs.gentoo.org/917118
Fixes: http://qa-logs.debian.net/2023/11/11/rhythmbox_3.4.7-1_unstable_meson-exp.log

Thanks to the Gentoo Tinderbox project, and Lucas Nussbaum of the Debian
project.
2023-11-12 20:39:49 +02:00
Jussi Pakkanen 97dc8801a6 Renumber test dirs for rc3. 2023-11-12 19:18:06 +02:00
Jussi Pakkanen 422550036e Handle dupe number in test renumberer. 2023-11-12 19:18:06 +02:00
Jussi Pakkanen 8f89ce8a70
Merge pull request #12485 from xclaesse/rust-link-regress
rust: Fix linking with C libraries in subdir
2023-11-12 17:09:51 +02:00
Xavier Claessens 11dec13a19 mtest: -C argument does not need type convertor
It is already done by RealPathAction and mypy started complaining about
it.
2023-11-10 14:22:30 -05:00
Xavier Claessens 42898bb455 msvc: Do not include pch obj when b_pch=false
Fixes: #12494
2023-11-10 14:04:23 -05:00
Xavier Claessens bd99f0bf1c rust: Make sure -l and -L are a single arg
CompilerArgs would otherwise dedup and reorder them.
2023-11-09 16:20:01 -05:00
Xavier Claessens d25d8e2772 rust: Fix linking with C libraries (again)
Pass link arguments directly down to linker by using `-C link-args=`
instead of letting rustc/linker resolve `-l` arguments. This solves
problems with e.g. +verbatim not being portable. Note that we also pass
`-l` args as `-Clink-args=-l` because rustc would otherwise reorder
arguments and put `-lstdc++` before `-Clink-args=libfoo++.a`.

However, when building a rlib/staticlib we should still use `-l`
arguments because that allows rustc to bundle static libraries we
link-whole. In that case, since there is no platform specific dynamic
linker, +verbatim works.

This also fix installed staticlib that now bundle uninstalled static
libraries it links to (recursively). This is done by putting them all
into self.link_whole_targets instead of putting their objects into
self.objects, and let rustc do the bundling. This has the extra
advantage that rustc can bundle static libries built with CustomTarget.

Disable bundling in all other cases, otherwise we could end up with
duplicated objects in static libraries, in diamond dependency graph
case.

Fixes: #12484
2023-11-09 16:20:01 -05:00