Closed sarvesh-sharma-yral closed 1 month ago
This means we can't find a crate called uniffitest
in your workspace so we can load its UDL.
I have the same error. It is strange that uniffi can't find my crate with udl, despite it being present in the output of cargo metadata
command.
I have a minimal reproducible example in my repo here: https://github.com/Sorg666/uniffi-bindgen-error-example
Can you take a look?
Okay, I think I found a work around. In Cargo.toml add "lib" to crate-type (in the repo above it would look like this: crate-type = ["lib", "cdylib"]
). I think it was fixed here https://github.com/mozilla/uniffi-rs/commit/d63ed664208c42e7e127103bdfd7dea555e938bd, but not released yet
Worked for me as well! Thanks @Sorg666
Configuration: Mac OS Sequoia 15.0 rustc 1.81.0
Here's my project structure:
My chain of commands:
Cargo.toml:
lib.rs:
build.rs:
Failed command output: _Finished
dev
profile [unoptimized + debuginfo] target(s) in 0.29s Runningtarget/debug/uniffi-bindgen generate --library target/debug/libuniffitest.a --language swift --out-dir out
thread 'main' panicked at /Users/sarveshsharma/.cargo/registry/src/index.crates.io-6f17d22bba15001f/uniffi-0.28.1/src/lib.rs:28:21: calledResult::unwrap()
on anErr
value: No path known to UDL files for 'uniffitest'Stack backtrace: 0: std::backtrace_rs::backtrace::libunwind::trace at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/std/src/../../backtrace/src/backtrace/libunwind.rs:116:5 1: std::backtrace_rs::backtrace::trace_unsynchronized at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5 2: std::backtrace::Backtrace::create at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/std/src/backtrace.rs:331:13 3: anyhow::context::<impl anyhow::Context<T,core::convert::Infallible> for core::option::Option>::context
at /Users/sarveshsharma/.cargo/registry/src/index.crates.io-6f17d22bba15001f/anyhow-1.0.89/src/backtrace.rs:27:14
4: ::get_udl
at /Users/sarveshsharma/.cargo/registry/src/index.crates.io-6f17d22bba15001f/uniffi_bindgen-0.28.1/src/cargo_metadata.rs:27:20
5: uniffi_bindgen::library_mode::load_udl_metadata
at /Users/sarveshsharma/.cargo/registry/src/index.crates.io-6f17d22bba15001f/uniffi_bindgen-0.28.1/src/library_mode.rs:170:23
6: uniffi_bindgen::library_mode::find_components
at /Users/sarveshsharma/.cargo/registry/src/index.crates.io-6f17d22bba15001f/uniffi_bindgen-0.28.1/src/library_mode.rs:114:43
7: uniffi_bindgen::library_mode::generate_bindings
at /Users/sarveshsharma/.cargo/registry/src/index.crates.io-6f17d22bba15001f/uniffi_bindgen-0.28.1/src/library_mode.rs:46:26
8: uniffi::cli::gen_library_mode
at /Users/sarveshsharma/.cargo/registry/src/index.crates.io-6f17d22bba15001f/uniffi-0.28.1/src/cli.rs:207:38
9: uniffi::cli::run_main
at /Users/sarveshsharma/.cargo/registry/src/index.crates.io-6f17d22bba15001f/uniffi-0.28.1/src/cli.rs:297:17
10: uniffi::uniffi_bindgen_main
at /Users/sarveshsharma/.cargo/registry/src/index.crates.io-6f17d22bba15001f/uniffi-0.28.1/src/lib.rs:28:5
11: uniffi_bindgen::main
at ./uniffi-bindgen.rs:2:5
12: core::ops::function::FnOnce::call_once
at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/core/src/ops/function.rs:250:5
13: std::sys::backtrace::__rust_begin_short_backtrace
at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/std/src/sys/backtrace.rs:152:18
14: std::rt::lang_start::{{closure}}
at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/std/src/rt.rs:162:18
15: core::ops::function::impls::<impl core::ops::function::FnOnce for &F>::call_once
at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/core/src/ops/function.rs:284:13
16: std::panicking::try::do_call
at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/std/src/panicking.rs:557:40
17: std::panicking::try
at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/std/src/panicking.rs:521:19
18: std::panic::catch_unwind
at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/std/src/panic.rs:350:14
19: std::rt::lang_start_internal::{{closure}}
at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/std/src/rt.rs:141:48
20: std::panicking::try::do_call
at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/std/src/panicking.rs:557:40
21: std::panicking::try
at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/std/src/panicking.rs:521:19
22: std::panic::catch_unwind
at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/std/src/panic.rs:350:14
23: std::rt::lang_start_internal
at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/std/src/rt.rs:141:20
24: std::rt::lang_start
at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/std/src/rt.rs:161:17
25: _main
stack backtrace:
0: rust_begin_unwind
at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/std/src/panicking.rs:665:5
1: core::panicking::panic_fmt
at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/core/src/panicking.rs:74:14
2: core::result::unwrap_failed
at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/core/src/result.rs:1679:5
3: core::result::Result<T,E>::unwrap
at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/core/src/result.rs:1102:23
4: uniffi::uniffi_bindgen_main
at /Users/sarveshsharma/.cargo/registry/src/index.crates.io-6f17d22bba15001f/uniffi-0.28.1/src/lib.rs:28:5
5: uniffi_bindgen::main
at ./uniffi-bindgen.rs:2:5
6: core::ops::function::FnOnce::call_once
at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/core/src/ops/function.rs:250:5
note: Some details are omitted, run with
RUST_BACKTRACE=full
for a verbose backtrace._