Cargo bitbake error, rust app using gtk

Hi, I am getting error when trying to create bitbake recipe for the project that uses gtk3 bindings (project can be successfully build and run locally).
Can anyone suggest an action that would remedy the current situation?
Thank you
//Error

error: failed to parse manifest at /home/Documents/Projects/rust/gtk3_app/Cargo.toml

Caused by:
failed to parse the edition key

Caused by:
this version of Cargo is older than the 2021 edition, and only supports 2015 and 2018 editions.

//Cargo.toml
[package]
name = "gtk3_app"
version = "0.1.0"
edition = "2021"
repository = "https://github.com/userx/gtk3_app.git"

See more keys and their definitions at The Manifest Format - The Cargo Book

[dependencies]
gtk = { git = "GitHub - gtk-rs/gtk3-rs: Provides Rust bindings for GTK libraries" }

Update Cargo. If you installed it through rustup, run rustup update.

Hi and thank you.
Unfortunately even after suggested by you action, the error is still there. Any ideas?

Do you have a rust-toolchain file in your workspace?

I don't believe that I have. What should I do in order to create that file?

You don't need to have it, but if you had had it could infect your running version. What is the output of cargo --version?

cargo 1.61.0-nightly (109bfbd 2022-03-17)
I also changed it to 1.59 stable and it still the same situation.

Do you have a .cargo directory somewhere up the directory hierarchy (e.g. a/b/c/project/.cargo, or a/b/c/.cargo, etc.)?

No, I don't have that folder.
When I changed the edition to 2018 now I'm getting following error:

updating git repository `https://github.com/gtk-rs/gtk3-rs.git

error: failed to get `gtk` as a dependency of package `rgtk3 v0.1.0 (/home/Documents/Projects/rust/gtk3_app)`

Caused by:
  failed to load source for dependency `gtk`

Caused by:
  Unable to update https://github.com/gtk-rs/gtk3-rs.git

Caused by:
  failed to parse manifest at `/home/userx/.cargo/git/checkouts/gtk3-rs-a818089b55180ee1/c4e91b7/gtk/sys/Cargo.toml`

Caused by:
  failed to parse the `edition` key

Caused by:
  this version of Cargo is older than the `2021` edition, and only supports `2015` and `2018` editions.

Are you using GitHub - meta-rust/cargo-bitbake: cargo extension that can generate BitBake recipes utilizing the classes from meta-rust? If so you will need to install the latest version on the master branch. The version on crates.io depends on a rather old cargo version which doesn't yet knows about the 2021 edition.

Hi,
Yes, the cargo I'm using is the cargo from the git repo.

Which commit of cargo-bitbake are you using?

After switching to master branch on yocto and generating that bb recipe for my project now I'm getting:

Sstate summary: Wanted 5 Local 0 Mirrors 0 Missed 5 Current 170 (0% match, 97% complete)
NOTE: Executing Tasks
ERROR: rgtk3015-0.1.0.AUTOINC+08b3485996-r0 do_compile: ExecutionError('/home/Documents/yocto/build/tmp/work/core2-64-poky-linux/rgtk3015/0.1.0.AUTOINC+08b3485996-r0/temp/run.do_compile.6203', 101, None, None)
ERROR: Logfile of failure stored in: /home/Documents/yocto/build/tmp/work/core2-64-poky-linux/rgtk3015/0.1.0.AUTOINC+08b3485996-r0/temp/log.do_compile.6203
Log data follows:
| DEBUG: Executing shell function do_compile
| NOTE: cargo = /home/Documents/yocto/build/tmp/work/core2-64-poky-linux/rgtk3015/0.1.0.AUTOINC+08b3485996-r0/recipe-sysroot-native/usr/bin/cargo
| NOTE: rustc =
| NOTE: cargo build -v --target x86_64-poky-linux --release --manifest-path=/home/Documents/yocto/build/tmp/work/core2-64-poky-linux/rgtk3015/0.1.0.AUTOINC+08b3485996-r0/git//Cargo.toml
| Updating git repository https://github.com/gtk-rs/gtk3-rs.git
| warning: spurious network error (2 tries remaining): [6] Couldn't resolve host name (Could not resolve host: github.com); class=Net (12)
| warning: spurious network error (1 tries remaining): [6] Couldn't resolve host name (Could not resolve host: github.com); class=Net (12)
| error: failed to get gtk as a dependency of package rust_gtk3_example v0.1.0 (/home/Documents/yocto/build/tmp/work/core2-64-poky-linux/rgtk3015/0.1.0.AUTOINC+08b3485996-r0/git)
|
| Caused by:
| failed to load source for dependency gtk
|
| Caused by:
| Unable to update GitHub - gtk-rs/gtk3-rs: Provides Rust bindings for GTK libraries
|
| Caused by:
| failed to fetch into: /home/Documents/yocto/build/tmp/work/core2-64-poky-linux/rgtk3015/0.1.0.AUTOINC+08b3485996-r0/cargo_home/git/db/gtk3-rs-a818089b55180ee1
|
| Caused by:
| network failure seems to have happened
| if a proxy or similar is necessary net.git-fetch-with-cli may help here
| Configuration - The Cargo Book
|
| Caused by:
| [6] Couldn't resolve host name (Could not resolve host: github.com); class=Net (12)
| WARNING: exit code 101 from a shell command.

It looks like it cannot fetch gtk-rs, but I can fetch it manually. I don't understand.

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.