On Mon, Feb 24, 2025 at 11:57:24AM +0100, Paolo Bonzini wrote:
> On 2/4/25 21:10, Joel Granados wrote:
> > Replace the meson introspect argument with the build directory instead
> > of the meson.build file. The introspect command accepts an optional
> > build directory not a file.
> > 
> > Signed-off-by: Joel Granados <joel.grana...@kernel.org>
> > ---
> > For some reason this causes an error when I "remote" compile qemu.
> > In any case, the introspect only accepts directories, so having it point
> > the to the meson.build file is a mistake.
> 
> Unfortunately, the help for "meson introspect" doesn't tell the whole
> story...  Instead, https://mesonbuild.com/IDE-integration.html under "Build
> options" says:
> 
>    Since Meson 0.50.0 it is also possible to get the default
>    buildoptions without a build directory by providing the root
>    meson.build instead of a build directory to meson introspect
>    --buildoptions.
> 
>    Running --buildoptions without a build directory produces the same
>    output as running it with a freshly configured build directory.
Thx for the clarification. Never would have thought to looking to the
IDE-integration. If it *is* supposed to work with the file instead of
the BUILDDIR, maybe the error is somewhere else.

> 
> The idea here is to make it possible to update the meson-buildoptions.sh
> script even in case the build directory if somehow hosed.  So I'd rather
> avoid this patch if possible.
> 
> What's the error that you have and do you have a reproducer?

Here is the error I see:
cmd:
  meson introspect --buildoptions /home/joel/src/qemu/meson.build

output:
  meson.build:88:12: ERROR: Unknown compiler(s): [['rustc']]
  The following exception(s) were encountered:
  Running `rustc --version` gave "[Errno 2] No such file or directory: 'rustc'"

When I pass it a builddir it actually gives me all the buildoptions
(which is what I expect)
cmd:
  meson introspect --buildoptions /home/joel/src/qemu/bdir

output (Just pasted a few values as it is too long):
  [{"name": "build.cmake_prefix_path", "value": [], "section": "core",
  "machine": "build", "type": "array", "description": "List of additional
  prefixes for cmake to search"}, {"name": "build.pkg_config_path",
  "value":
  ["/nix/store/xslbksjj97g6nagcx4n5maj9fpvnyhvs-glib-2.82.1-dev/lib/pkgconfig",
  "/nix/store/06q0p7bhn2ffxxya20rrfqdib3h32csn-zlib-1.3.1-dev/lib/pkgconfig",
  "/nix/store/30gl46y1afg6crvcw9v3ipb6hmkmd7hj-libffi-3.4.6-dev/lib/pkgconfig",
  "/nix/store/08dqyhwwvn0yvc0zziw9q8vc4njb7jal-lz4-1.10.0-dev/lib/pkgconfig",
  "/nix/store/zcg3yygpamw1hk28yd46zswvyjf26vnz-libslirp-4.8.0/lib/pkgconfig",
  "/nix/store/3alx4nrhy7ss32i6fmfgj0hp96pfjvx6-python3-3.11.11/lib/pkgconfig",
  "/nix/store/l8g4dx38bkhfphgwyhi513nhw2x47c6r-python3-3.11.11/lib/pkgconfig"],
  "section": "core", "machine": "build", "type": "array", "description":
  "List of additional paths for pkg-config to search"}, {"name":
  "auto_features", "value": "auto", "section": "core", "machine": "any",
  "choices": ["enabled", "disabled", "auto"], "type": "combo",
  "description": "Override value of all 'auto' features"}, {"name":
  "backend", "value": "ninja", "section": "core", "machine": "any",
  "choices": ["ninja", "vs", "vs2010", "vs2012", "vs2013", "vs2015",
  ...

Quickly looking at the error message and at line 88 shows me that it has
to do with the build trying to call the rust compiler (which I do
**not** have installed). It seems that have_rust has the true value even
though I do not have it installed. However all this goes away when I
pass it a builddir.

Maybe the fix is to change the detection logic for the rust compiler?
FYI:
1. These are the lines that have rust in the meson_options.txt:
  option('rust', type: 'feature', value: 'disabled',
         description: 'Rust support')
  option('strict_rust_lints', type: 'boolean', value: false,
         description: 'Enable stricter set of Rust warnings')
2. This is how I run configure:
  ../configure --target-list=x86_64-softmmu --disable-docs

Notice that in meson.build:88 the value of has_rust depends on
have_system which in turn depends on target_dirs. Does target_dirs have
values outside a builddir?

Hopes this helps clarify my situation

Best

-- 

Joel Granados

Reply via email to