GTK4 + Rust Development with Silverblue (Noob here!)

Hello all,
I’ve always wanted to make desktop GUI apps, so I’ve decided to learn with Rust + GTK4.
Will be following this book (which looks hella promising): Prerequisites - GUI development with Rust and GTK 4
Do you guys have any recommendations for the setup?
It recommends VSCodium, so I’ll probably be using that.
At the moment I have Rust and Cargo installed as layered packages, but it might be better for me to set up a toolbox aye?
Is there a special way you guys recommend I do this?
Just toolbox create and then sudo dnf install rust cargo
Please let me know if you have any opinions or advice on the matter.
I want my development environment to be really comfy
Thanks :grin:

Okay, serious question, and my first roadblock.

I set up a new toolbox and installed gtk, rust and cargo.

How do I get VSCodium set up to be working with that toolbox?

Check this thread out

1 Like

The link that @jakfrost posted definitely will help you get to to a “really comfy” environment. You’ll need, unfortunately, to use the official Microsoft builds of Visual Studio Code rather than VSCodium - since the “Remote Containers” extension only works with the offiical builds.

(If you are looking for something fully open source, GNOME Builder should also work pretty well for GTK+ development with rust, and might even be better set up for things often used with GTK like GtkBuilder, Meson, etc. But I haven’t tried that combination yet.)

1 Like

Will give the link a try! Is the official microsoft build one I’d have to build from source or is it on flathub?

It’s on Flathub. My script will prompt to install it if it is missing on your system.

1 Like

That’s really cool, will give it a shot now :slight_smile:

Should I be installing code in the flatpak for this?

➜  rustlings git:(main) ✗ code .
zsh: command not found: code
➜  rustlings git:(main) ✗ flatpak install code  
zsh: command not found: flatpak
➜  rustlings git:(main) ✗ ```

The instructions say:

git clone
cd toolbox-vscode
ln -s "$PWD/" ~/.local/bin/code

This depends on $HOME/.local/bin being in your $PATH environment variable. The default $HOME/.bashrc on Fedora sets that up (see /etc/skel/.bashrc), but since you are using zsh, you might need to configure that yourself.

Will look into it :sweat_smile:

strange, my one is long and I don’t remember setting it up

➜ ~ echo $PATH

I might have followed some guide or done tricky stuff in the past to get vscode working with zsh

I set the path to $HOME/.local/bin

with export PATH="$HOME/.local/bin

And get the exact same error.

Is this because the $path variable doesn’t apply to zsh?

Something good seems to be happening :slight_smile:

Getting some more tricky problems :sweat_smile:

It also tells me I need to install docker, but when trying with sudo dnf install docker-ce docker-ce-cli

I get

  file /usr/lib64/ from install of iptables-libs-1.8.7-3.fc34.x86_64 conflicts with file from package iptables-legacy-libs-1.8.7-6.fc34.x86_64```

In theory you should be able to use Podman’s emulation of the Docker API instead. Your mileage may vary, but it could be worth a try:

podman service --help

Yeah, that isn’t necessary and won’t work :-). Can you open an issue in with as much detail as possible about how you went from the first screenshot where things were working to the second screenshot, and we’ll debug it there. Thanks!

I made one, but I’m not sure it’ll be very helpful.

I don’t think I did much in between screenshots, it’s just that it was the second time I tried.

I opened it for the second time, this time with a new project that I downloaded from GitLab.

Of course, even if I go to the first “rustlings” project I get the error so it’s not project specific. Maybe something happened to the toolbox, but I am opening it from the toolbox, and it appears as running when I type toolbox list

For a flatpak based workflows vscodium and the flatpak extension should work fine. If you think that the book should go a bit deeper here, feel free to open an issue.

Otherwise, as others suggested toolbox + vscode is a good alternative.

1 Like

I believe I’ve got a set up working with toolbox + vscode :slight_smile:

This all may have been a very roundabout way not to layer on more packages, haha

Latest episode in my adventures; haven’t been able to build.

This is the message I am getting:

Running `cargo build --bin=relevant-stats-dash --package=relevant-stats-dash --message-format=json`...
   Compiling glib-sys v0.13.0 (
The following warnings were emitted during compilation:

warning: `"pkg-config" "--libs" "--cflags" "glib-2.0" "glib-2.0 >= 2.66"` did not exit successfully: exit code: 1

error: failed to run custom build command for `glib-sys v0.13.0 (`

Caused by:
  process didn't exit successfully: `/var/home/sashin/Documents/Projects/relevant-stats-dash/target/debug/build/glib-sys-1f53007fc5a43b10/build-script-build` (exit code: 1)
  --- stdout
  cargo:warning=`"pkg-config" "--libs" "--cflags" "glib-2.0" "glib-2.0 >= 2.66"` did not exit successfully: exit code: 1
  --- stderr
  Package glib-2.0 was not found in the pkg-config search path.
  Perhaps you should add the directory containing `glib-2.0.pc'
  to the PKG_CONFIG_PATH environment variable
  Package 'glib-2.0', required by 'virtual:world', not found
  Package 'glib-2.0', required by 'virtual:world', not found

I have tried running sudo dnf install glib to no avail.

Running PKG_CONFIG_PATH returns nothing, and I am not sure which if any directory contains glib-2.0.pc