最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

rust - How do I build a Dioxus bare bones project in Nix? - Stack Overflow

programmeradmin1浏览0评论

I am trying to get up and running with the Dioxus tutorial. I am using NixOS.

This is my shell file. I copied the shell.nix file from the Tauri docs, which is recommended by Dioxus, and then I added the nix package for the dioxus-cli and wasm-pack.

let
  nixpkgs = fetchTarball ";;
  pkgs = import nixpkgs {
    config = { };
    overlays = [];
  };
in
pkgs.mkShell {
  buildInputs = with pkgs;[
    at-spi2-atk
    atkmm
    cairo
    gdk-pixbuf
    glib
    gtk3
    harfbuzz
    librsvg
    libsoup_3
    pango
    webkitgtk_4_1
    openssl
  ];
  nativeBuildInputs = with pkgs; [
    pkg-config
    gobject-introspection
    cargo
    cargo-tauri
    nodejs
  ];
  packages = with pkgs; [
    dioxus-cli
    emacs
    git
    wasm-pack
  ];
  RUST_BACKTRACE = 1;
  RUSTFLAGS = "-Awarnings";
}

Then, per the Dioxus tutorial, I created a project using dx new hot_dog and declined the fullstack website, the router, and Tailwind, and I set the default platform to Web.

When I run cargo build it builds just fine, but when I run `dx build, I get an error. This is the full stack trace:

[nix-shell:~/workbench/hot_dog]$ dx build
   0. 0s  INFO Building project...
   0.243s ERROR Failed to verify tooling: I/O Error: No such file or directory (os error 2)
dx will proceed, but you might run into errors later.
   0.321s ERROR Cargo build failed - no output location
   0.332s ERROR err=Other(Build did not return an executable

Stack backtrace:
   0: dx::build::request::BuildRequest::build_app::{{closure}}
   1: <futures_util::future::try_maybe_done::TryMaybeDone<Fut> as core::future::future::Future>::poll
   2: <futures_util::future::try_join::TryJoin<Fut1,Fut2> as core::future::future::Future>::poll
   3: dx::build::request::BuildRequest::build_all::{{closure}}
   4: dx::build::builder::Builder::start::{{closure}}
   5: tokio::runtime::task::core::Core<T,S>::poll
   6: tokio::runtime::task::harness::Harness<T,S>::poll
   7: tokio::runtime::scheduler::multi_thread::worker::Context::run_task
   8: tokio::runtime::scheduler::multi_thread::worker::Context::run
   9: tokio::runtime::context::scoped::Scoped<T>::set
  10: tokio::runtime::context::runtime::enter_runtime
  11: tokio::runtime::scheduler::multi_thread::worker::run
  12: <tokio::runtime::blocking::task::BlockingTask<T> as core::future::future::Future>::poll
  13: tokio::runtime::task::core::Core<T,S>::poll
  14: tokio::runtime::task::harness::Harness<T,S>::poll
  15: tokio::runtime::blocking::pool::Inner::run
  16: std::sys::backtrace::__rust_begin_short_backtrace
  17: core::ops::function::FnOnce::call_once{{vtable.shim}}
  18: std::sys::pal::unix::thread::Thread::new::thread_start
  19: start_thread
  20: __GI___clone3) 
   0.333s ERROR err=Other(Build did not return an executable

Stack backtrace:
   0: dx::build::request::BuildRequest::build_app::{{closure}}
   1: <futures_util::future::try_maybe_done::TryMaybeDone<Fut> as core::future::future::Future>::poll
   2: <futures_util::future::try_join::TryJoin<Fut1,Fut2> as core::future::future::Future>::poll
   3: dx::build::request::BuildRequest::build_all::{{closure}}
   4: dx::build::builder::Builder::start::{{closure}}
   5: tokio::runtime::task::core::Core<T,S>::poll
   6: tokio::runtime::task::harness::Harness<T,S>::poll
   7: tokio::runtime::scheduler::multi_thread::worker::Context::run_task
   8: tokio::runtime::scheduler::multi_thread::worker::Context::run
   9: tokio::runtime::context::scoped::Scoped<T>::set
  10: tokio::runtime::context::runtime::enter_runtime
  11: tokio::runtime::scheduler::multi_thread::worker::run
  12: <tokio::runtime::blocking::task::BlockingTask<T> as core::future::future::Future>::poll
  13: tokio::runtime::task::core::Core<T,S>::poll
  14: tokio::runtime::task::harness::Harness<T,S>::poll
  15: tokio::runtime::blocking::pool::Inner::run
  16: std::sys::backtrace::__rust_begin_short_backtrace
  17: core::ops::function::FnOnce::call_once{{vtable.shim}}
  18: std::sys::pal::unix::thread::Thread::new::thread_start
  19: start_thread
  20: __GI___clone3) 

[nix-shell:~/workbench/hot_dog]$ 

This error seems very opaque to me as a newcomer to dioxus and a Nix beginner. Any ideas for a nix-shell that's able to successfully build this project?

发布评论

评论列表(0)

  1. 暂无评论