Rust gtk build error in fedora 32

Hi all, I was developing demo project for learning rust with gtk-rs. I was using Fedora 31 and the project was building in it. After upgrading my os to Fedora 32 when I try to build project it gives error.
Now I have setup sample project to replicate the error. The code is as below:
name = "gtk-rs"
version = "0.1.0"
authors = ["user"]
edition = "2018"

version = "0.8.1"
features = ["v3_22"]

version = "0.8.1"
features = ["v2_44"]
extern crate gtk;

use gtk::prelude::*;

fn main() {

With this much code I am able to replicate the issue.
The error is
unresolved import self::event_box::EventBoxBuilder
--> /home/chetan/.cargo/registry/src/
270 | pub use self::event_box::EventBoxBuilder;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no EventBoxBuilder in auto::event_box

error[E0432]: unresolved import self::event_box::EventBoxExt
--> /home/chetan/.cargo/registry/src/
271 | pub use self::event_box::EventBoxExt;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no EventBoxExt in auto::event_box

error[E0432]: unresolved imports self::event_box::EventBox, self::event_box::EventBoxClass, self::event_box::NONE_EVENT_BOX
--> /home/chetan/.cargo/registry/src/
272 | pub use self::event_box::{EventBox, EventBoxClass, NONE_EVENT_BOX};
| ^^^^^^^^ ^^^^^^^^^^^^^ ^^^^^^^^^^^^^^ no NONE_EVENT_BOX in auto::event_box
| | |
| | no EventBoxClass in auto::event_box
| no EventBox in auto::event_box

I have gtk3-devel installed already with version 3.24.20.
How to fix this build issue?

Usually such compilation errors are due to having an outdated Rust version, and almost all Linux distros have outdated Rust versions. Make sure you're not using Rust from Fedora, but from rustup.

Fedora already has 1.43.0. I usually get the builds done for all supported branches and into updates-testing within a day or two, and F32 has already pushed to stable updates.

I don't know why gtk-rs would be failing, but that doesn't really look like a compiler issue in particular.

1 Like

Have you tried with a fresh build directory, after cargo clean? Maybe gtk-rs has some parts that need to be regenerated with the new system libraries.

Even after doing cargo clean I am not able to build. Same error.

I can build your example myself on Fedora 32 with the system rust-1.43.0-1.fc32.x86_64, as well as with rustup toolchains back to 1.37.0, which is the minimum for the ? Kleene macro operator required by glib.

You could try removing ~/.cargo/registry/src/, in case that got corrupted somehow, but otherwise I'm at a loss.

1 Like

Thanks @cuviper, after deleting src and cache directory content in ~/.cargo/registry resolved the issue. Happy Rusting...

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.