Message ID | 20241108180139.117112-1-pbonzini@redhat.com (mailing list archive) |
---|---|
Headers | show |
Series | rust: improved integration with cargo | expand |
Paolo Bonzini <pbonzini@redhat.com> writes: > While we're not sure where we'll be going in the future, for now > using cargo remains an important part of developing QEMU Rust code. > This is because cargo is the easiest way to run clippy, rustfmt, > rustdoc. Cargo also allows working with doc tests, though there are > pretty much none yet, and provides tools such as "cargo expand". > > This series aims at improving the integration with cargo and > cargo-based tooling. > > First, while it is currently possible to run cargo on the rust/ directory, > but it has the issue that the bindings.rs must be placed by hand in > the build directory. Therefore, this series starts by allowing > cargo to "just work" when run in a "meson devenv" environment: > > meson devenv -w ../rust cargo clippy --tests > meson devenv -w ../rust cargo fmt Is this meant to be the rust source root, or the root of the rust builddir: $ meson devenv ../../rust ERROR: Build data file './meson-private/build.dat' references functions or classes that don't exist. This probably means that it was generated with an old version of meson. Try running from the source directory meson setup . --wipe
On Thu, Nov 14, 2024 at 2:07 PM Alex Bennée <alex.bennee@linaro.org> wrote: > > First, while it is currently possible to run cargo on the rust/ directory, > > it has the issue that the bindings.rs must be placed by hand in > > the build directory. Therefore, this series starts by allowing > > cargo to "just work" when run in a "meson devenv" environment: > > > > meson devenv -w ../rust cargo clippy --tests > > meson devenv -w ../rust cargo fmt > > Is this meant to be the rust source root, or the root of the rust > builddir: > > $ meson devenv ../../rust rust/ in the source directory. You also need to run "meson devenv" from the root of the build directory. In practice you can just use "make clippy" or similar. > ERROR: Build data file './meson-private/build.dat' references functions or classes that don't exist. This probably means that it was generated with an old version of meson. Try running from the source directory meson setup . --wipe >
Paolo Bonzini <pbonzini@redhat.com> writes: > On Thu, Nov 14, 2024 at 2:07 PM Alex Bennée <alex.bennee@linaro.org> wrote: >> > First, while it is currently possible to run cargo on the rust/ directory, >> > it has the issue that the bindings.rs must be placed by hand in >> > the build directory. Therefore, this series starts by allowing >> > cargo to "just work" when run in a "meson devenv" environment: >> > >> > meson devenv -w ../rust cargo clippy --tests >> > meson devenv -w ../rust cargo fmt >> >> Is this meant to be the rust source root, or the root of the rust >> builddir: >> >> $ meson devenv ../../rust > > rust/ in the source directory. You also need to run "meson devenv" > from the root of the build directory. > > In practice you can just use "make clippy" or similar. make clippy certainly works >> ERROR: Build data file './meson-private/build.dat' references >> functions or classes that don't exist. This probably means that it >> was generated with an old version of meson. Try running from the >> source directory meson setup . --wipe >>
On 11/14/24 16:22, Alex Bennée wrote: > ERROR: Build data file './meson-private/build.dat' references functions or classes that don't exist. This probably means that it was generated with an old version of meson. Try running from the source directory meson setup . --wipe > > I also tried a wipe and re-configure but the same thing. Ah, nevermind - you must have an older meson installation in /usr. You have to do pyvenv/bin/meson to pick the right one. I'll adjust the docs. Paolo
Paolo Bonzini <pbonzini@redhat.com> writes: > On 11/14/24 16:22, Alex Bennée wrote: >> ERROR: Build data file './meson-private/build.dat' references >> functions or classes that don't exist. This probably means that it >> was generated with an old version of meson. Try running from the >> source directory meson setup . --wipe >> I also tried a wipe and re-configure but the same thing. > > Ah, nevermind - you must have an older meson installation in /usr. > You have to do pyvenv/bin/meson to pick the right one. I'll adjust > the docs. Hmm, ✗ ./pyvenv/bin/meson devenv ../../rust Traceback (most recent call last): File "/home/alex/lsrc/qemu.git/builds/rust/pyvenv/lib/python3.11/site-packages/mesonbuild/mesonmain.py", line 188, in run return options.run_func(options) ^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/alex/lsrc/qemu.git/builds/rust/pyvenv/lib/python3.11/site-packages/mesonbuild/mdevenv.py", line 228, in run return subprocess.call(args, close_fds=False, ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.11/subprocess.py", line 389, in call with Popen(*popenargs, **kwargs) as p: ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.11/subprocess.py", line 1024, in __init__ self._execute_child(args, executable, preexec_fn, close_fds, File "/usr/lib/python3.11/subprocess.py", line 1901, in _execute_child raise child_exception_type(errno_num, err_msg, err_filename) PermissionError: [Errno 13] Permission denied: '../../rust' ERROR: Unhandled python OSError. This is probably not a Meson bug, but an issue with your build environment.
On 11/14/24 18:27, Alex Bennée wrote: > Paolo Bonzini <pbonzini@redhat.com> writes: > >> On 11/14/24 16:22, Alex Bennée wrote: >>> ERROR: Build data file './meson-private/build.dat' references >>> functions or classes that don't exist. This probably means that it >>> was generated with an old version of meson. Try running from the >>> source directory meson setup . --wipe >>> I also tried a wipe and re-configure but the same thing. >> >> Ah, nevermind - you must have an older meson installation in /usr. >> You have to do pyvenv/bin/meson to pick the right one. I'll adjust >> the docs. > > Hmm, > > ✗ ./pyvenv/bin/meson devenv ../../rust > PermissionError: [Errno 13] Permission denied: '../../rust' You're confusing two things: 1) to start a shell pyvenv/bin/meson devenv 2) to run clippy pyvenv/bin/meson devenv -w ../../rust cargo clippy --tests Note the -w. Since the latter is typically covered by make, the common one will be the former. Paolo
Paolo Bonzini <pbonzini@redhat.com> writes: > On 11/14/24 18:27, Alex Bennée wrote: >> Paolo Bonzini <pbonzini@redhat.com> writes: >> >>> On 11/14/24 16:22, Alex Bennée wrote: >>>> ERROR: Build data file './meson-private/build.dat' references >>>> functions or classes that don't exist. This probably means that it >>>> was generated with an old version of meson. Try running from the >>>> source directory meson setup . --wipe >>>> I also tried a wipe and re-configure but the same thing. >>> >>> Ah, nevermind - you must have an older meson installation in /usr. >>> You have to do pyvenv/bin/meson to pick the right one. I'll adjust >>> the docs. >> Hmm, >> ✗ ./pyvenv/bin/meson devenv ../../rust >> PermissionError: [Errno 13] Permission denied: '../../rust' > > You're confusing two things: > > 1) to start a shell > > pyvenv/bin/meson devenv > > 2) to run clippy > > pyvenv/bin/meson devenv -w ../../rust cargo clippy --tests > > Note the -w. Since the latter is typically covered by make, the > common one will be the former. Ahh right - I misunderstood, got it now.