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

[BUG] Segfault on start #1096

Closed
ghost opened this issue Aug 14, 2022 · 8 comments
Closed

[BUG] Segfault on start #1096

ghost opened this issue Aug 14, 2022 · 8 comments
Labels
bug Something isn't working

Comments

@ghost
Copy link

ghost commented Aug 14, 2022

Bug description

When running the hello world example from the crates.io readme I get a segfault at the first step.

Version: 0.4.8
Distribution: Alpine Linux (musl libc)

GTK4 apps on my system work.

@ghost ghost added the bug Something isn't working label Aug 14, 2022
@bilelmoussaoui
Copy link
Member

Mind sharing the backtrace by running the example with gdb for example?

@ghost
Copy link
Author

ghost commented Aug 14, 2022

Sorry, not experienced with gdb. Is this the right thing?

#0  0x0000000000000000 in ?? ()
#1  0x00007ffff7f6a95a in gtk4::auto::application::{impl#35}::static_type () at src/auto/application.rs:23
#2  0x00007ffff7f65841 in glib::object::Object::new<gtk4::auto::application::Application> (properties=...) at /home/yujiri/.cargo/registry/src/github.com-1ecc6299db9ec823/glib-0.15.12/src/object.rs:1211
#3  0x00007ffff7f69d4e in gtk4::auto::application::ApplicationBuilder::build (self=...) at src/auto/application.rs:88
#4  0x00007ffff7f62f88 in sufec_gtk::main () at src/main.rs:7

sufec_gtk is the name of my application.

Also, confirmed this doesn't happen on other distributions, which points to it being musl-specific.

@bilelmoussaoui
Copy link
Member

Sorry, not experienced with gdb. Is this the right thing?

Was this the output of typing bt? if so, mind trying with bt full

@ghost
Copy link
Author

ghost commented Aug 14, 2022

Sorry, just discovered that command. I'm afraid it doesn't add much

(gdb) bt full
#0  0x0000000000000000 in ?? ()
No symbol table info available.
#1  0x00007ffff7f6a95a in gtk4::auto::application::{impl#35}::static_type () at src/auto/application.rs:23
No locals.
#2  0x00007ffff7f65841 in glib::object::Object::new<gtk4::auto::application::Application> (properties=...) at /home/yujiri/.cargo/registry/src/github.com-1ecc6299db9ec823/glib-0.15.12/src/object.rs:1211
No locals.
#3  0x00007ffff7f69d4e in gtk4::auto::application::ApplicationBuilder::build (self=...) at src/auto/application.rs:88
        properties = alloc::vec::Vec<(&str, &dyn glib::value::ToValue), alloc::alloc::Global> {buf: alloc::raw_vec::RawVec<(&str, &dyn glib::value::ToValue), alloc::alloc::Global> {ptr: core::ptr::unique::Unique<(&str, &dyn glib::value::ToValue)> {pointer: core::ptr::non_null::NonNull<(&str, &dyn glib::value::ToValue)> {pointer: 0x7ffff7fff580}, _marker: core::marker::PhantomData<(&str, &dyn glib::value::ToValue)>}, cap: 4, alloc: alloc::alloc::Global}, len: 1}
#4  0x00007ffff7f62f88 in sufec_gtk::main () at src/main.rs:7
No locals.

@ghost
Copy link
Author

ghost commented Aug 14, 2022

I have some other info that might be relevant. I have a similar issue, also musl-specific, on another rust binding crate. That one I traced to being some sort of failure to load the glfw library, as it segfaulted on the first FFI call to it regardless of what that call was (though ldd output on the binary appears correct). Since it seems like this is also happening at the first FFI call, it could be similar.

@ghost
Copy link
Author

ghost commented Aug 14, 2022

I think it's likely the problem is not in gtk4-rs itself, but in some dependency that deals with linking to native libraries.

@sdroege
Copy link
Member

sdroege commented Aug 14, 2022

See gtk-rs/gtk-rs-core#387 . Toolchain setup problem.

@sdroege sdroege closed this as completed Aug 14, 2022
@ghost
Copy link
Author

ghost commented Aug 14, 2022

Ah, I was about to come back and say that the workaround here solved it for me. I'll look at that issue next

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants