Closed funatsufumiya closed 2 months ago
The examples fail to compile with
error[E0425]: cannot find function `auto_register_classes` in module `bevy_godot4::godot::private::class_macros`
--> simple/src/lib.rs:11:1
|
11 | #[bevy_app]
| ^^^^^^^^^^^ not found in `bevy_godot4::godot::private::class_macros`
|
= note: this error originates in the attribute macro `bevy_app` (in Nightly builds, run with -Z macro-backtrace for more info)
For more information about this error, try `rustc --explain E0425`.
error: could not compile `simple` (lib) due to 1 previous error
When updated to bevy 0.14 the crate fails to compile
warning: ambiguous glob re-exports
--> src/lib.rs:18:13
|
18 | pub use bevy::prelude::*;
| ^^^^^^^^^^^^^^^^ the name `Resource` in the type namespace is first re-exported here
19 | pub use bevy_godot4_proc_macros::bevy_app;
20 | pub use godot::prelude::*;
| ----------------- but the name `Resource` in the type namespace is also re-exported here
|
= note: `#[warn(ambiguous_glob_reexports)]` on by default
error[E0615]: attempted to take value of method `world` on type `&mut bevy::prelude::App`
--> src/app.rs:74:17
|
74 | app.world.remove_resource::<GodotVisualFrame>();
| ^^^^^ method, not a field
|
help: use parentheses to call the method
|
74 | app.world().remove_resource::<GodotVisualFrame>();
| ++
error[E0615]: attempted to take value of method `world` on type `&mut bevy::prelude::App`
--> src/app.rs:93:17
|
93 | app.world.remove_resource::<GodotPhysicsFrame>();
| ^^^^^ method, not a field
|
help: use parentheses to call the method
|
93 | app.world().remove_resource::<GodotPhysicsFrame>();
| ++
For more information about this error, try `rustc --explain E0615`.
warning: `bevy_godot4` (lib) generated 1 warning
error: could not compile `bevy_godot4` (lib) due to 2 previous errors; 1 warning emitted
Also @funatsufumiya I don't know if you saw this https://github.com/jrockett6/bevy_godot4/issues/1#issuecomment-2224877086
That is the godot-rust maintainer so I think that puts this overall approach on firmer long term footing!
Thank you for the confirmation. I'll reply after further investigation.
@hammerandtongs
Sorry but I could not reproduce with my environment ( M1 Mac, rustc 1.78.0 (9b00956e5 2024-04-29)
. )
Could you tell me your environment detail?
@hammerandtongs
When updated to bevy 0.14 the crate fails to compile
I would like to specify this error occurs in my posted code, or your modified code. Because my code is only tested in bevy 0.13. If any modifications are required in bevy 0.14, PRs are welcome.
I'm on Debian Linux rustc 1.79.0 (129f3b996 2024-06-10)
I'm on your cd7b4d50bf3f96a08c092d642c0ea562601ab488
It compiles as is but when changing into the /examples of the repo it fails with the error (I have no example code of my own).
I merely updated the cargo.toml top level to .14 for the errors on the next step.
fwiw @jrockett6 I believe said in the discord that he wasn't using godot and/or bevy anymore but would work on the library a bit since he had some users.
@hammerandtongs I could reproduce your error on newly created Linux environment. I would check if I had time, but I'm also not using this project actively, so it may take time. Any PRs are welcome.
I also confirmed gdext
version is different from mine (commit 81631341
on M1 mac, and e99367c
on newly created environment).
Though this may not directly related to the error, I tried specifying it by godot = { git = "https://github.com/godot-rust/gdext", rev = "81631341" }
on Cargo.toml, but related dependencies could not be satisfied. This means we need to check the API update, this will take much time, and I cannot promise I can take that time.
I also recognized important error-fix was commited on latest version on gdext
. So I think continuing to use older versions of gdext
is not recommended (and this error is why I didn't use this project actively, and confirmed fixed now). I'll check if I could find the time.
I added Cargo.lock
to dev
branch (https://github.com/funatsufumiya/bevy_godot4/tree/dev).
I tried recompiling with it, I confirmed other errors occured on Linux environment (Rust 1.79.0) while compile passes on M1 Mac environment (Rust 1.78.0).
I don't know the reason what brings these differences, but may take much time to investigate.
$ cargo build
warning: ambiguous glob re-exports
--> /home/fu/lab/bevy_godot4/src/lib.rs:18:13
|
18 | pub use bevy::prelude::*;
| ^^^^^^^^^^^^^^^^ the name `Resource` in the type namespace is first re-exported here
19 | pub use bevy_godot4_proc_macros::bevy_app;
20 | pub use godot::prelude::*;
| ----------------- but the name `Resource` in the type namespace is also re-exported here
|
= note: `#[warn(ambiguous_glob_reexports)]` on by default
warning: function `maybe_dec_ref_opt` is never used
--> /home/fu/lab/bevy_godot4/src/erased_gd.rs:73:4
|
73 | fn maybe_dec_ref_opt<T: GodotClass>(gd: &mut Option<Gd<T>>) -> bool {
| ^^^^^^^^^^^^^^^^^
|
= note: `#[warn(dead_code)]` on by default
warning: `bevy_godot4` (lib) generated 2 warnings
Compiling simple v0.1.0 (/home/fu/lab/bevy_godot4_dev/examples/simple)
error[E0277]: the trait bound `BevyExtensionLibrary: godot::init::ExtensionLibrary` is not satisfied
--> simple/src/lib.rs:11:1
|
11 | #[bevy_app]
| ^^^^^^^^^^^ the trait `godot::init::ExtensionLibrary` is not implemented for `BevyExtensionLibrary`
|
note: required by a bound in `godot::init::__gdext_load_library`
--> /home/fu/.cargo/git/checkouts/gdext-76630c89719e160c/8163134/godot-core/src/init/mod.rs:21:39
|
21 | pub unsafe fn __gdext_load_library<E: ExtensionLibrary>(
| ^^^^^^^^^^^^^^^^ required by this bound in `__gdext_load_library`
= note: this error originates in the attribute macro `bevy_app` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0308]: mismatched types
--> simple/src/lib.rs:32:13
|
31 | let sprite = ErasedGdResource::new(
| --------------------- arguments to this function are incorrect
32 | / resource_loader
33 | | .load("sprite.tscn".into())
34 | | .unwrap(),
| |_________________________^ expected `Gd<Resource>`, found a different `Gd<Resource>`
|
= note: `Gd<Resource>` and `Gd<Resource>` have similar names, but are actually distinct types
note: `Gd<Resource>` is defined in crate `godot_core`
--> /home/fu/.cargo/git/checkouts/gdext-76630c89719e160c/8163134/godot-core/src/obj/gd.rs:88:1
|
88 | pub struct Gd<T: GodotClass> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: `Gd<Resource>` is defined in crate `godot_core`
--> /home/fu/.cargo/git/checkouts/gdext-76630c89719e160c/8163134/godot-core/src/obj/gd.rs:88:1
|
88 | pub struct Gd<T: GodotClass> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= note: perhaps two different versions of crate `godot_core` are being used?
note: associated function defined here
--> /home/fu/lab/bevy_godot4/src/erased_gd.rs:95:12
|
95 | pub fn new(mut reference: Gd<Resource>) -> Self {
| ^^^
error[E0277]: the trait bound `godot::engine::Sprite2D: bevy_godot4::prelude::Inherits<bevy_godot4::prelude::Node>` is not satisfied
--> simple/src/lib.rs:50:39
|
50 | let mut sprite = sprite.get::<Sprite2D>();
| --- ^^^^^^^^ the trait `bevy_godot4::prelude::Inherits<bevy_godot4::prelude::Node>` is not implemented for `godot::engine::Sprite2D`
| |
| required by a bound introduced by this call
|
= help: the following other types implement trait `bevy_godot4::prelude::Inherits<Base>`:
<BevyApp as bevy_godot4::prelude::Inherits<bevy_godot4::prelude::Node>>
<BevyApp as bevy_godot4::prelude::Inherits<bevy_godot4::prelude::Object>>
<bevy_godot4::godot::engine::AStar2D as bevy_godot4::prelude::Inherits<bevy_godot4::prelude::Object>>
<bevy_godot4::godot::engine::AStar2D as bevy_godot4::prelude::Inherits<bevy_godot4::prelude::RefCounted>>
<bevy_godot4::godot::engine::AStar3D as bevy_godot4::prelude::Inherits<bevy_godot4::prelude::Object>>
<bevy_godot4::godot::engine::AStar3D as bevy_godot4::prelude::Inherits<bevy_godot4::prelude::RefCounted>>
<bevy_godot4::godot::engine::AStarGrid2D as bevy_godot4::prelude::Inherits<bevy_godot4::prelude::Object>>
<bevy_godot4::godot::engine::AStarGrid2D as bevy_godot4::prelude::Inherits<bevy_godot4::prelude::RefCounted>>
and 3057 others
note: required by a bound in `bevy_godot4::prelude::ErasedGd::get`
--> /home/fu/lab/bevy_godot4/src/erased_gd.rs:13:19
|
13 | pub fn get<T: Inherits<Node>>(&mut self) -> Gd<T> {
| ^^^^^^^^^^^^^^ required by this bound in `ErasedGd::get`
error[E0277]: Only classes registered with Godot are allowed in this context
--> simple/src/lib.rs:50:33
|
50 | let mut sprite = sprite.get::<Sprite2D>();
| ^^^ the trait `bevy_godot4::prelude::GodotClass` is not implemented for `godot::engine::Sprite2D`
|
= note: you can use `#[derive(GodotClass)]` to register your own structs with Godot
= note: see also: https://godot-rust.github.io/book/register/classes.html
= help: the following other types implement trait `bevy_godot4::prelude::GodotClass`:
BevyApp
bevy_godot4::godot::engine::AStar2D
bevy_godot4::godot::engine::AStar3D
bevy_godot4::godot::engine::AStarGrid2D
bevy_godot4::godot::engine::AcceptDialog
bevy_godot4::godot::engine::AesContext
bevy_godot4::godot::engine::AnimatableBody2D
bevy_godot4::godot::engine::AnimatableBody3D
and 832 others
note: required by a bound in `bevy_godot4::prelude::Gd`
--> /home/fu/.cargo/git/checkouts/gdext-76630c89719e160c/8163134/godot-core/src/obj/gd.rs:88:18
|
88 | pub struct Gd<T: GodotClass> {
| ^^^^^^^^^^ required by this bound in `Gd`
error[E0599]: no method named `get_position` found for struct `bevy_godot4::prelude::Gd` in the current scope
--> simple/src/lib.rs:52:31
|
52 | let position = sprite.get_position();
| ^^^^^^^^^^^^ method not found in `Gd<Sprite2D>`
error[E0599]: no method named `set_position` found for struct `bevy_godot4::prelude::Gd` in the current scope
--> simple/src/lib.rs:54:16
|
54 | sprite.set_position(Vector2 {
| -------^^^^^^^^^^^^ method not found in `Gd<Sprite2D>`
Some errors have detailed explanations: E0277, E0308, E0599.
For more information about an error, try `rustc --explain E0277`.
error: could not compile `simple` (lib) due to 6 previous errors
@hammerandtongs
With 1.78.0
rust toolchain, dev
version (with Cargo.lock
) compiled successfully.
So for now, please use 1.78.0
and dev
version. (Though old gdext
has fatal error on specific cases...)
This is full process to run example:
$ rustup default 1.78.0-x86_64-unknown-linux-gnu # specify toolchain version here
$ rustc --version
rustc 1.78.0 (9b00956e5 2024-04-29)
$ godot --version
4.2.2.stable.official.15073afe3
$ git clone -b dev https://github.com/funatsufumiya/bevy_godot4
$ cd bevy_godot4
$ cd examples/simple
$ cargo build
$ cargo build --release # only if you need release version lib
$ godot godot/project.godot # NOTE: please open once in editor, and please also run (play) in editor once
$ godot --path godot # NOTE: second time, this is enough to run standalone
Subsumed by #3 , thank you very much @funatsufumiya !
Seems working, but I'm not confident in the implementation around RefCount, so any reviews would be appreciated.