Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Panic on GIR not_bound mode for GModule #1295

Open
wash2 opened this issue Dec 29, 2021 · 4 comments · May be fixed by #1297
Open

Panic on GIR not_bound mode for GModule #1295

wash2 opened this issue Dec 29, 2021 · 4 comments · May be fixed by #1297

Comments

@wash2
Copy link

wash2 commented Dec 29, 2021

I'm working on generating bindings to GModule but it panics in not_bound work_mode. I added some debug statements to the point where it was unwrapping, and I've attached the output of each of the failing types:

[WARN  libgir::analysis::functions] Function g_module_symbol has unsupported outs
[WARN  libgir::analysis::functions] Function g_module_open_full has unsupported outs
[ERROR libgir::analysis::record] Missing memory management functions for GModule.Module
[src/library.rs:1091] &tid = TypeId {
    ns_id: 1,
    id: 0,
}
[src/library.rs:1092] &full_name = "GModule.Module"
[src/library.rs:1093] env.library.find_type(0, "GObject.Object") = None
[src/library.rs:1091] &tid = TypeId {
    ns_id: 1,
    id: 1,
}
[src/library.rs:1092] &full_name = "GModule.ModuleFlags"
[src/library.rs:1093] env.library.find_type(0, "GObject.Object") = None
[src/library.rs:1091] &tid = TypeId {
    ns_id: 1,
    id: 2,
}
[src/library.rs:1092] &full_name = "GModule.ModuleCheckInit"
[src/library.rs:1093] env.library.find_type(0, "GObject.Object") = None
[src/library.rs:1091] &tid = TypeId {
    ns_id: 1,
    id: 3,
}
[src/library.rs:1092] &full_name = "GModule.ModuleError"
[src/library.rs:1093] env.library.find_type(0, "GObject.Object") = None
[src/library.rs:1091] &tid = TypeId {
    ns_id: 1,
    id: 4,
}
[src/library.rs:1092] &full_name = "GModule.ModuleUnload"
[src/library.rs:1093] env.library.find_type(0, "GObject.Object") = None

Also, it seems like the generation is failing, partially bc of missing memory management functions and unsupported output.. Does this mean that the safe bindings would all have to be implemented manually, or is it maybe an issue with the GIR file?

[WARN  libgir::analysis::functions] Function g_module_symbol has unsupported outs
[WARN  libgir::analysis::functions] Function g_module_open_full has unsupported outs
[ERROR libgir::analysis::record] Missing memory management functions for GModule.Module
thread 'main' panicked at 'Record Module has record_boxed=true but don't have glib:get_type function', src/codegen/record.rs:31:13
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
@bilelmoussaoui
Copy link
Member

That looks like a duplicate of #1236

@wash2
Copy link
Author

wash2 commented Dec 29, 2021

That looks like a duplicate of #1236

Ok thanks, do you know how difficult of a bug this might be to fix, or where to start working on it? I would be willing to give it a shot.

@bilelmoussaoui
Copy link
Member

It shouldn't be hard, you need to modify the code in https://github.com/gtk-rs/gir/blob/master/src/codegen/record.rs#L17-L35
to allow passing a None for the get_type function, and modify this line https://github.com/gtk-rs/gir/blob/master/src/codegen/general.rs#L428 accordingly

@wash2
Copy link
Author

wash2 commented Dec 29, 2021

Alright, thanks!

wash2 added a commit to wash2/gir that referenced this issue Dec 29, 2021
@wash2 wash2 linked a pull request Dec 29, 2021 that will close this issue
@sdroege sdroege linked a pull request Dec 30, 2021 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants