thatstoasty / prism

Mojo CLI Library modeled after Cobra.
MIT License
38 stars 0 forks source link

Command::__init__(...) does not reference a KGEN declaration #28

Closed aleksrutins closed 5 months ago

aleksrutins commented 5 months ago

I'm getting started with Mojo, and I'm getting this error, which seems at first glance like LLVM wizardry:

/Users/aleks/Projects/charm/charm.🔥:10:31: error: @"vendor::prism::command::Command::__init__(prism::command::Command=&,stdlib::builtin::string::String,stdlib::builtin::string::String,stdlib::collections::list::List[stdlib::builtin::string::String],stdlib::collections::list::List[stdlib::builtin::string::String],stdlib::collections::optional::Optional[fn(command: stdlib::memory::_arc::Arc[prism::command::Command], args: stdlib::collections::list::List[stdlib::builtin::string::String]) -> None],stdlib::collections::optional::Optional[fn(command: stdlib::memory::_arc::Arc[prism::command::Command], args: stdlib::collections::list::List[stdlib::builtin::string::String]) -> None],stdlib::collections::optional::Optional[fn(command: stdlib::memory::_arc::Arc[prism::command::Command], args: stdlib::collections::list::List[stdlib::builtin::string::String]) -> None],stdlib::collections::optional::Optional[fn(command: stdlib::memory::_arc::Arc[prism::command::Command], args: stdlib::collections::list::List[stdlib::builtin::string::String]) -> stdlib::builtin::error::Error],stdlib::collections::optional::Optional[fn(command: stdlib::memory::_arc::Arc[prism::command::Command], args: stdlib::collections::list::List[stdlib::builtin::string::String]) -> stdlib::builtin::error::Error],stdlib::collections::optional::Optional[fn(command: stdlib::memory::_arc::Arc[prism::command::Command], args: stdlib::collections::list::List[stdlib::builtin::string::String]) -> stdlib::builtin::error::Error],stdlib::collections::optional::Optional[fn(command: stdlib::memory::_arc::Arc[prism::command::Command], args: stdlib::collections::list::List[stdlib::builtin::string::String]) -> None],stdlib::collections::optional::Optional[fn(command: stdlib::memory::_arc::Arc[prism::command::Command], args: stdlib::collections::list::List[stdlib::builtin::string::String]) -> None],stdlib::collections::optional::Optional[fn(command: stdlib::memory::_arc::Arc[prism::command::Command], args: stdlib::collections::list::List[stdlib::builtin::string::String]) -> stdlib::builtin::error::Error],stdlib::collections::optional::Optional[fn(command: stdlib::memory::_arc::Arc[prism::command::Command], args: stdlib::collections::list::List[stdlib::builtin::string::String]) -> stdlib::builtin::error::Error],fn(stdlib::memory::_arc::Arc[prism::command::Command]) -> stdlib::builtin::string::String)" does not reference a KGEN declaration
    var root_command = Command(
                              ^
mojo: error: failed to run the pass manager

Any ideas?

Here's the code, which is essentially a copy of the example at the moment.

(Yes, I am the same person from the Discord.)

thatstoasty commented 5 months ago

I pulled your repo and rebuilt the package and I ran into the same exact error. I was able to resolve it by moving the prism.mojopkg file out of vendor so it's on the same level as your charm.🔥 file.

After updating the import statement, it ran without issue by running mojo run charm.🔥 and also after building it into a binary and running that. So, try giving that a go.

mojo build charm.🔥
./charm
./charm init

Maybe this is a bug with .mojopkg files? Doesn't seem like it was working correctly when it was part of another package (vendor).

thatstoasty commented 5 months ago

@aleksrutins Were you able to resolve the issue?