-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Closed
Labels
Description
Describe the bug
New versions of Rust's Cargo package manager have started publishing an autolib entry in Cargo.toml.
- Cargo implementation: See feat(toml): Add
autolibrust-lang/cargo#14591 - Cargo documentation: https://doc.rust-lang.org/beta/cargo/reference/cargo-targets.html#target-auto-discovery
- Example: see the
autolib = falsein https://docs.rs/crate/proc-macro2/1.0.87/source/Cargo.toml
All packages published to crates.io by a recent version of Cargo contain this entry.
To Reproduce
| meson.build |
|---|
project('repro', 'rust')
subproject('proc-macro2') |
| subprojects/proc-macro2.wrap |
|---|
[wrap-file]
directory = proc-macro2-1.0.87
source_url = https://static.crates.io/crates/proc-macro2/1.0.87/download
source_filename = unicode-ident-1.0.87.tar.gz
source_hash = b3e4daa0dcf6feba26f985457cdf104d4b4256fc5a09547140f3631bb076b19a
method = cargo |
$ /git/tmp/meson/meson.py setup build
The Meson build system
Version: 1.6.99
Source dir: /path/to
Build dir: /path/to/build
Build type: native build
Project name: repro
Project version: undefined
Rust compiler for the host machine: rustc -C linker=cc (rustc 1.84.0-nightly)
Rust linker for the host machine: rustc -C linker=cc ld.bfd 2.42
Host machine cpu family: x86_64
Host machine cpu: x86_64
Executing subproject proc-macro2 method cargo
meson.build:2: WARNING: Cargo subproject is an experimental feature and has no backwards compatibility guarantees.
Traceback (most recent call last):
File "/path/to/meson/mesonbuild/mesonmain.py", line 193, in run
return options.run_func(options)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/path/to/meson/mesonbuild/msetup.py", line 365, in run
app.generate()
File "/path/to/meson/mesonbuild/msetup.py", line 188, in generate
return self._generate(env, capture, vslite_ctx)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/path/to/meson/mesonbuild/msetup.py", line 227, in _generate
intr.run()
File "/path/to/meson/mesonbuild/interpreter/interpreter.py", line 3062, in run
super().run()
File "/path/to/meson/mesonbuild/interpreterbase/interpreterbase.py", line 169, in run
self.evaluate_codeblock(self.ast, start=1)
File "/path/top/meson/mesonbuild/interpreterbase/interpreterbase.py", line 195, in evaluate_codeblock
raise e
File "/path/to/meson/mesonbuild/interpreterbase/interpreterbase.py", line 187, in evaluate_codeblock
self.evaluate_statement(cur)
File "/path/to/meson/mesonbuild/interpreterbase/interpreterbase.py", line 201, in evaluate_statement
return self.function_call(cur)
^^^^^^^^^^^^^^^^^^^^^^^
File "/path/to/meson/mesonbuild/interpreterbase/interpreterbase.py", line 528, in function_call
res = func(node, func_args, kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/path/to/meson/mesonbuild/interpreterbase/decorators.py", line 237, in wrapper
return f(*nargs, **wrapped_kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/path/to/meson/mesonbuild/interpreterbase/decorators.py", line 556, in wrapper
return f(*wrapped_args, **wrapped_kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/path/to/meson/mesonbuild/interpreter/interpreter.py", line 869, in func_subproject
return self.do_subproject(args[0], kw)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/path/to/meson/mesonbuild/interpreter/interpreter.py", line 951, in do_subproject
raise e
File "/path/to/meson/mesonbuild/interpreter/interpreter.py", line 939, in do_subproject
return methods_map[method](subp_name, subdir, default_options, kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/path/to/meson/mesonbuild/interpreter/interpreter.py", line 1051, in _do_subproject_cargo
ast = self.environment.cargo.interpret(subdir)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/path/to/meson/mesonbuild/cargo/interpreter.py", line 467, in interpret
manifest = self._load_manifest(subdir)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/path/to/meson/mesonbuild/cargo/interpreter.py", line 524, in _load_manifest
manifest_ = _convert_manifest(raw_manifest, subdir)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/path/to/meson/mesonbuild/cargo/interpreter.py", line 358, in _convert_manifest
Package(**pkg),
^^^^^^^^^^^^^^
TypeError: Package.__init__() got an unexpected keyword argument 'autolib'
meson.build:2:0: ERROR: Unhandled python exception
This is a Meson bug and should be reported!This is the relevant line:
meson/mesonbuild/cargo/interpreter.py
Line 358 in db82c2d
| Package(**pkg), |
Expected behavior
Presence of autolib = false within the Cargo.toml of a method = cargo wrap-file does not cause a type error in Meson's cargo interpreter.
The path determined by [lib] path = "..." in the Cargo.toml is treated as the root of the crate's library.
system parameters
- Is this a cross build or just a plain native build (for the same computer)?
- what operating system (e.g. MacOS Catalina, Windows 10, CentOS 8.0, Ubuntu 18.04, etc.)
- what Python version are you using e.g. 3.8.0
- Python 3.12.3
- what
meson --version- 1.6.99 (current master: db82c2d)
- what
ninja --versionif it's a Ninja build
ognevny