Is this (Hello world) (Rust) code supposed to launch a (GTK 4) window? (Rust+Gtk 4+IntelliJ IDEA Community Edition or terminal)

Hello everyone. :slight_smile:

I want to learn Rust and GTK (4), but before I can do so, I need to set up my environment, which I’m unfortunately having trouble with. :frowning:

In the Flatpaked version of IntelliJ IDEA Community Edition (and, if I remember correctly, the upstream-archive version too), I try using the following Cargo.toml file along with the rust-stable (1.60.0) runtime from Flathub (the org.freedesktop.Sdk.Extension.rust-stable Flatpak package which installs into /var/lib/flatpak/runtime/org.freedesktop.Sdk.Extension.rust-stable) and the Gnome SDK, which seems to include GTK 4 (the org.gnome.Sdk Flatpak package which installs in /var/lib/flatpak/runtime/org.gnome.Sdk/x86_64/42/active/files/).

Contents of Cargo.toml:

[package]
name = "untitled3"
version = "0.1.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
gtk4 = "0.4.7"
cairo-sys-rs = "0.15.1"
glib-sys = "0.15.10"
gobject-sys = "0.15.10"
gio-sys = "0.15.10"[/code]

Here ( https://crates.io/crates/gtk4 ) is the Cargo crate I am using.

When I create a Rust project, I put “/var/lib/flatpak/runtime/org.freedesktop.Sdk.Extension.rust-stable/x86_64/21.08/active/files/bin” (without the quotes) as the “toolchain” and “/var/lib/flatpak/runtime/org.freedesktop.Sdk.Extension.rust-stable/x86_64/21.08/active/files/lib/rustlib/src/rust” (without the quotes) for the “standard library” part and choose Binary (application) for the Project Template.

At least the “toolchain” part seems to be correctly detected (because the IDE reports the version number 1.60.0).

I set the environment variables as follows (in the IDE, by clicking Run → Edit Configurations and going to Environment variables section - some of the following paths may be extraneous or invalid - I’ll look into that later).:

PKG_CONFIG_PATH=/var/lib/flatpak/runtime/org.gnome.Sdk/x86_64/42/active/files/lib/x86_64-linux-gnu/pkgconfig/;PATH=/var/lib/flatpak/runtime/org.gnome.Sdk/x86_64/42/active/files/sbin:/var/run/host/usr/lib/gcc/x86_64-unknown-linux-gnu/11.3.0/../../../../x86_64-unknown-linux-gnu/bin/:/var/run/host/usr/bin:/var/lib/flatpak/runtime/org.gnome.Sdk/x86_64/42/active/files/lib/x86_64-linux-gnu/pkgconfig/:/var/lib/flatpak/runtime/org.freedesktop.Sdk.Extension.rust-stable/x86_64/21.08/active/files/bin/:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games

The command-line-interface equivalent is as follows.:

cd ~/IdeaProjects/untitled3 && export PATH=/var/lib/flatpak/runtime/org.gnome.Sdk/x86_64/42/active/files/sbin:/var/run/host/usr/lib/gcc/x86_64-unknown-linux-gnu/11.3.0/../../../../x86_64-unknown-linux-gnu/bin/:/var/run/host/usr/bin:/var/lib/flatpak/runtime/org.gnome.Sdk/x86_64/42/active/files/lib/x86_64-linux-gnu/pkgconfig/:/var/lib/flatpak/runtime/org.freedesktop.Sdk.Extension.rust-stable/x86_64/21.08/active/files/bin/:$PATH && export PKG_CONFIG_PATH=/var/lib/flatpak/runtime/org.gnome.Sdk/x86_64/42/active/files/lib/x86_64-linux-gnu/pkgconfig/ && cargo build && cargo run

The following is the output when I do it the GUI/IDE way.:

/var/lib/flatpak/runtime/org.freedesktop.Sdk.Extension.rust-stable/x86_64/21.08/active/files/bin/cargo build --color=always --message-format=json-diagnostic-rendered-ansi --package untitled3 --bin untitled3
   Compiling glib-sys v0.15.10
   Compiling gobject-sys v0.15.10
   Compiling gio-sys v0.15.10
   Compiling pango-sys v0.15.10
   Compiling cairo-sys-rs v0.15.1
   Compiling gdk-pixbuf-sys v0.15.10
   Compiling gdk4-sys v0.4.2
   Compiling graphene-sys v0.15.10
   Compiling gsk4-sys v0.4.2
   Compiling gtk4-sys v0.4.5
   Compiling glib v0.15.11
   Compiling gio v0.15.11
   Compiling cairo-rs v0.15.11
   Compiling pango v0.15.10
   Compiling graphene-rs v0.15.1
   Compiling gdk-pixbuf v0.15.11
   Compiling gdk4 v0.4.7
   Compiling gsk4 v0.4.7
   Compiling gtk4 v0.4.7
   Compiling untitled3 v0.1.0 (/home/user/IdeaProjects/untitled3)
warning: function is never used: `main`
 --> src/main.rs:8:8
  |
8 |     fn main() {
  |        ^^^^
  |
  = note: `#[warn(dead_code)]` on by default

warning: 1 warning emitted

    Finished dev [unoptimized + debuginfo] target(s) in 1m 16s
Process finished with exit code 0

The following is when I do it via the command line (within the Flatpaked IDE).:

user@debian:~/IdeaProjects/untitled3$ cd ~/IdeaProjects/untitled3 && export PATH=/var/lib/flatpak/runtime/org.gnome.Sdk/x86_64/42/active/files/sbin:/var/run/host/usr/lib/gcc/x86_64-unknown-linux-gnu/11.3.0/../../../../x86_64-unknown-linux-gnu/bin/:/var/run/host/usr/bin:/var/lib/flatpak/runtime/org.gnome.Sdk/x86_64/42/active/files/lib/x86_64-linux-gnu/pkgconfig/:/var/lib/flatpak/runtime/org.freedesktop.Sdk.Extension.rust-stable/x86_64/21.08/active/files/bin/:$PATH && export PKG_CONFIG_PATH=/var/lib/flatpak/runtime/org.gnome.Sdk/x86_64/42/active/files/lib/x86_64-linux-gnu/pkgconfig/ && cargo build && cargo run
warning: function is never used: `main`
 --> src/main.rs:8:8
  |
8 |     fn main() {
  |        ^^^^
  |
  = note: `#[warn(dead_code)]` on by default

warning: `untitled3` (bin "untitled3") generated 1 warning
    Finished dev [unoptimized + debuginfo] target(s) in 0.04s
warning: function is never used: `main`
 --> src/main.rs:8:8
  |
8 |     fn main() {
  |        ^^^^
  |
  = note: `#[warn(dead_code)]` on by default

warning: `untitled3` (bin "untitled3") generated 1 warning
    Finished dev [unoptimized + debuginfo] target(s) in 0.04s
     Running `target/debug/untitled3`
Hello, world!
Goodbye, world!
user@debian:~/IdeaProjects/untitled3$

Here is the main.rs file’s contents.:

fn main() {
    println!("Hello, world!");

    use gtk4 as gtk;
    use gtk::prelude::*;
    use gtk::{Application, ApplicationWindow};

    fn main() {
        let app = Application::builder()
            .application_id("org.example.HelloWorld")
            .build();

        app.connect_activate(|app| {
            // We create the main window.
            let window = ApplicationWindow::builder()
                .application(app)
                .default_width(320)
                .default_height(200)
                .title("Hello, World!")
                .build();

            // Show the window.
            window.show();
        });

        app.run();
    }

    println!("Goodbye, world!");
}

Here is my folder+project structure.:

user@debian:~/IdeaProjects/untitled3$ ls -a
.  ..  Cargo.lock  Cargo.toml  .git  .gitignore  .idea  src  target  untitled3.iml
user@debian:~/IdeaProjects/untitled3$ ls -a ./src/
.  ..  main.rs
user@debian:~/IdeaProjects/untitled3$

Either way no windows pops up. Is this normal? Am I doing something wrong? How do I fix this problem?

Could someone please help me get this working correctly?

Any input would be GREATLY appreciated!

P.S.
The formatting of my post seems off, but I don’t know the correct syntax to fix things for that. If someone could let me know what the correct syntax is, I can fix my post (and use the syntax correctly for any potential future posts here).

Use normal markdown code blocks with triple-backticks ```

Something seems to be strange with your project setup. Can you put the whole code into a git repo on github.com or so?

Also why do you pass --package / --bin to cargo? That shouldn’t be necessary and might actually be part of the problem here (mismatch between what is actually there).

The compiler says that function main in main function is not called.

Just call main() or this:

use gtk4 as gtk;
use gtk::prelude::*;
use gtk::{Application, ApplicationWindow};

fn main() {
    println!("Hello, World!");

    let app = Application::builder()
    // ...
    // ...

    println!("Goodbye, World!");
}

Thanks for the responses. :slight_smile:

And, oops! I feel blind now (for not noticing main within main). :stuck_out_tongue:

After having done that, I’m now experiencing another issue, though.

In the following terminal interaction, notice how the PATH environment variable has the directory with the cc binary in it, and how the Flatpak sandbox should not be an issue. (That terminal was not in the IDE. It was in a regular, non-Flatpaked terminal. The situation is similar in the terminal within the Flatpaked IDE.)

user@debian:~$ cd ~/IdeaProjects/untitled3 && export PATH=/var/lib/flatpak/runtime/org.kde.Platform/x86_64/5.15/2c9e014e7d60da0f002c9d9d7a620bcedf59546007a7ae16accb3ee3e6335430/files/lib/x86_64-linux-gnu/:/var/lib/flatpak/runtime/org.gnome.Sdk/x86_64/42/bd5cf2646c70337561c1a2bf214e3ca797fd2ea96d981baf8fd537cb931eeebb/files/lib/x86_64-linux-gnu/:/var/lib/flatpak/runtime/org.gnome.Sdk/x86_64/42/bd5cf2646c70337561c1a2bf214e3ca797fd2ea96d981baf8fd537cb931eeebb/files/x86_64-unknown-linux-gnu/bin:/var/lib/flatpak/runtime/org.gnome.Sdk/x86_64/42/bd5cf2646c70337561c1a2bf214e3ca797fd2ea96d981baf8fd537cb931eeebb/files/bin:/var/lib/flatpak/runtime/org.gnome.Sdk/x86_64/42/bd5cf2646c70337561c1a2bf214e3ca797fd2ea96d981baf8fd537cb931eeebb/files/bin/../lib/gcc/x86_64-unknown-linux-gnu/11.3.0/../../../../x86_64-unknown-linux-gnu/bin/:/var/lib/flatpak/runtime/org.gnome.Sdk/x86_64/42/active/files/sbin:/var/run/host/usr/lib/gcc/x86_64-unknown-linux-gnu/11.3.0/../../../../x86_64-unknown-linux-gnu/bin/:/var/run/host/usr/bin:/var/lib/flatpak/runtime/org.gnome.Sdk/x86_64/42/active/files/lib/x86_64-linux-gnu/pkgconfig/:/var/lib/flatpak/runtime/org.freedesktop.Sdk.Extension.rust-stable/x86_64/21.08/active/files/bin/:$PATH && export PKG_CONFIG_PATH=/var/lib/flatpak/runtime/org.gnome.Sdk/x86_64/42/active/files/lib/x86_64-linux-gnu/pkgconfig/ && cargo build && cargo run
   Compiling untitled3 v0.1.0 (/home/user/IdeaProjects/untitled3)
error: linking with `cc` failed: exit status: 1
  |
  = note: "cc" "-m64" "/home/user/IdeaProjects/untitled3/target/debug/deps/untitled3-7b5ad7a0ffc15b76.10vcj8nlwaoo6v6.rcgu.o" "/home/user/IdeaProjects/untitled3/target/debug/deps/untitled3-7b5ad7a0ffc15b76.11oknuvdidlwho0b.rcgu.o" "/home/user/IdeaProjects/untitled3/target/debug/deps/untitled3-7b5ad7a0ffc15b76.12ll1rptsd39et4l.rcgu.o" "/home/user/IdeaProjects/untitled3/target/debug/deps/untitled3-7b5ad7a0ffc15b76.15p1y65avc5d13t0.rcgu.o" "/home/user/IdeaProjects/untitled3/target/debug/deps/untitled3-7b5ad7a0ffc15b76.15zepqn3m639gmcl.rcgu.o" "/home/user/IdeaProjects/untitled3/target/debug/deps/untitled3-7b5ad7a0ffc15b76.1ezv829nuhly42ij.rcgu.o" "/home/user/IdeaProjects/untitled3/target/debug/deps/untitled3-7b5ad7a0ffc15b76.1ir5k53npkcxkbh9.rcgu.o" "/home/user/IdeaProjects/untitled3/target/debug/deps/untitled3-7b5ad7a0ffc15b76.1vm266okay32hcga.rcgu.o" "/home/user/IdeaProjects/untitled3/target/debug/deps/untitled3-7b5ad7a0ffc15b76.1wx0ps3l1mctqpco.rcgu.o" "/home/user/IdeaProjects/untitled3/target/debug/deps/untitled3-7b5ad7a0ffc15b76.2313xef8qgicpww9.rcgu.o" "/home/user/IdeaProjects/untitled3/target/debug/deps/untitled3-7b5ad7a0ffc15b76.2ci7cb1szq7uptue.rcgu.o" "/home/user/IdeaProjects/untitled3/target/debug/deps/untitled3-7b5ad7a0ffc15b76.2jkei144wsmeqksz.rcgu.o" "/home/user/IdeaProjects/untitled3/target/debug/deps/untitled3-7b5ad7a0ffc15b76.2s8aagy27g932nia.rcgu.o" "/home/user/IdeaProjects/untitled3/target/debug/deps/untitled3-7b5ad7a0ffc15b76.2vdvp1n7j2hc3qj9.rcgu.o" "/home/user/IdeaProjects/untitled3/target/debug/deps/untitled3-7b5ad7a0ffc15b76.2vtg0bas7mmbgjtm.rcgu.o" "/home/user/IdeaProjects/untitled3/target/debug/deps/untitled3-7b5ad7a0ffc15b76.2xw0lhm2ivnkvfn3.rcgu.o" "/home/user/IdeaProjects/untitled3/target/debug/deps/untitled3-7b5ad7a0ffc15b76.33kfs9klx4r5a6jg.rcgu.o" "/home/user/IdeaProjects/untitled3/target/debug/deps/untitled3-7b5ad7a0ffc15b76.33sfo52cex1t2tnf.rcgu.o" "/home/user/IdeaProjects/untitled3/target/debug/deps/untitled3-7b5ad7a0ffc15b76.375o2fmvamcmb58t.rcgu.o" "/home/user/IdeaProjects/untitled3/target/debug/deps/untitled3-7b5ad7a0ffc15b76.3ia6dfsllyt9sdz.rcgu.o" "/home/user/IdeaProjects/untitled3/target/debug/deps/untitled3-7b5ad7a0ffc15b76.3jk6f65yr2dnnh39.rcgu.o" "/home/user/IdeaProjects/untitled3/target/debug/deps/untitled3-7b5ad7a0ffc15b76.3pkh5xvpbpbcp2rp.rcgu.o" "/home/user/IdeaProjects/untitled3/target/debug/deps/untitled3-7b5ad7a0ffc15b76.3ub2qmc6ccf7ay11.rcgu.o" "/home/user/IdeaProjects/untitled3/target/debug/deps/untitled3-7b5ad7a0ffc15b76.43gye453ia8ul5r0.rcgu.o" "/home/user/IdeaProjects/untitled3/target/debug/deps/untitled3-7b5ad7a0ffc15b76.46f6hrwdlipo6dax.rcgu.o" "/home/user/IdeaProjects/untitled3/target/debug/deps/untitled3-7b5ad7a0ffc15b76.4cjl9wg5m5r78e7n.rcgu.o" "/home/user/IdeaProjects/untitled3/target/debug/deps/untitled3-7b5ad7a0ffc15b76.4fv5zmwgtmjstqiq.rcgu.o" "/home/user/IdeaProjects/untitled3/target/debug/deps/untitled3-7b5ad7a0ffc15b76.4h1s2d294z6h0d8x.rcgu.o" "/home/user/IdeaProjects/untitled3/target/debug/deps/untitled3-7b5ad7a0ffc15b76.4p9sgwjrjt06qt1z.rcgu.o" "/home/user/IdeaProjects/untitled3/target/debug/deps/untitled3-7b5ad7a0ffc15b76.51p2gxhjd16r1vs8.rcgu.o" "/home/user/IdeaProjects/untitled3/target/debug/deps/untitled3-7b5ad7a0ffc15b76.99amp00yv1xr5i1.rcgu.o" "/home/user/IdeaProjects/untitled3/target/debug/deps/untitled3-7b5ad7a0ffc15b76.bs6r2plbi9m4sbh.rcgu.o" "/home/user/IdeaProjects/untitled3/target/debug/deps/untitled3-7b5ad7a0ffc15b76.e7uyqt5cj9waqt1.rcgu.o" "/home/user/IdeaProjects/untitled3/target/debug/deps/untitled3-7b5ad7a0ffc15b76.gxj9u7yl59j0buj.rcgu.o" "/home/user/IdeaProjects/untitled3/target/debug/deps/untitled3-7b5ad7a0ffc15b76.ohfwvyc7f8r1i3f.rcgu.o" "/home/user/IdeaProjects/untitled3/target/debug/deps/untitled3-7b5ad7a0ffc15b76.s0gtyw4inpb0ck6.rcgu.o" "-Wl,--as-needed" "-L" "/home/user/IdeaProjects/untitled3/target/debug/deps" "-L" "/var/lib/flatpak/runtime/org.freedesktop.Sdk.Extension.rust-stable/x86_64/21.08/e70dbcf542e105f9251ee1535de8d1d4437da47294bff113d11492f54b4639d0/files/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-Wl,-Bstatic" "/home/user/IdeaProjects/untitled3/target/debug/deps/libgtk4-ca902c7f7eba28c6.rlib" "/home/user/IdeaProjects/untitled3/target/debug/deps/libgsk4-f86fc15a1fed60f1.rlib" "/home/user/IdeaProjects/untitled3/target/debug/deps/libgraphene-d3971d917bbfbf49.rlib" "/home/user/IdeaProjects/untitled3/target/debug/deps/libgdk4-cf80e7127fed318c.rlib" "/home/user/IdeaProjects/untitled3/target/debug/deps/libpango-04d385c4353719c1.rlib" "/home/user/IdeaProjects/untitled3/target/debug/deps/libgdk_pixbuf-6f013e886d9ed80d.rlib" "/home/user/IdeaProjects/untitled3/target/debug/deps/libgio-763da2eaa5fe9719.rlib" "/home/user/IdeaProjects/untitled3/target/debug/deps/libfutures_io-ae8d0cc855367cbf.rlib" "/home/user/IdeaProjects/untitled3/target/debug/deps/libcairo-646c5927ff279be1.rlib" "/home/user/IdeaProjects/untitled3/target/debug/deps/libglib-c6f2f6866365728f.rlib" "/home/user/IdeaProjects/untitled3/target/debug/deps/libfutures_executor-22921000605cf671.rlib" "/home/user/IdeaProjects/untitled3/target/debug/deps/libfutures_util-ef36e67040a629ab.rlib" "/home/user/IdeaProjects/untitled3/target/debug/deps/libslab-ae59c7b6e0d36368.rlib" "/home/user/IdeaProjects/untitled3/target/debug/deps/libpin_project_lite-ff7ec06daf2cd9b9.rlib" "/home/user/IdeaProjects/untitled3/target/debug/deps/libpin_utils-6c669315cfadfec5.rlib" "/home/user/IdeaProjects/untitled3/target/debug/deps/libsmallvec-068ac8185082e6f5.rlib" "/home/user/IdeaProjects/untitled3/target/debug/deps/libthiserror-b186ca3ff4e664c6.rlib" "/home/user/IdeaProjects/untitled3/target/debug/deps/libfutures_channel-0fceb783f1ba6f1e.rlib" "/home/user/IdeaProjects/untitled3/target/debug/deps/libfutures_task-ecde0fd8afc76364.rlib" "/home/user/IdeaProjects/untitled3/target/debug/deps/libfutures_core-e4d3a2040637810a.rlib" "/home/user/IdeaProjects/untitled3/target/debug/deps/libonce_cell-d4edd22523d7b9ae.rlib" "/home/user/IdeaProjects/untitled3/target/debug/deps/libbitflags-f1ca410388ec357f.rlib" "/home/user/IdeaProjects/untitled3/target/debug/deps/libgtk4_sys-96fa244889173473.rlib" "/home/user/IdeaProjects/untitled3/target/debug/deps/libgsk4_sys-c4f8eb77d97ab30f.rlib" "/home/user/IdeaProjects/untitled3/target/debug/deps/libgraphene_sys-23e65496c528a782.rlib" "/home/user/IdeaProjects/untitled3/target/debug/deps/libgdk4_sys-8edf29ea7bb9aad4.rlib" "/home/user/IdeaProjects/untitled3/target/debug/deps/libgdk_pixbuf_sys-cdf2ac238dd517ec.rlib" "/home/user/IdeaProjects/untitled3/target/debug/deps/libpango_sys-9ccfbf95bd0d8e4a.rlib" "/home/user/IdeaProjects/untitled3/target/debug/deps/libcairo_sys-6ed51310430022c6.rlib" "/home/user/IdeaProjects/untitled3/target/debug/deps/libgio_sys-ad3999ab84f22338.rlib" "/home/user/IdeaProjects/untitled3/target/debug/deps/libgobject_sys-440edb70b0cd853f.rlib" "/home/user/IdeaProjects/untitled3/target/debug/deps/libglib_sys-156b714538c596d6.rlib" "/home/user/IdeaProjects/untitled3/target/debug/deps/liblibc-c8abee9503293ab0.rlib" "/home/user/IdeaProjects/untitled3/target/debug/deps/libfield_offset-34477f9ac2df78c9.rlib" "/home/user/IdeaProjects/untitled3/target/debug/deps/libmemoffset-9c9e2ab89dd01fb6.rlib" "-Wl,--start-group" "/var/lib/flatpak/runtime/org.freedesktop.Sdk.Extension.rust-stable/x86_64/21.08/e70dbcf542e105f9251ee1535de8d1d4437da47294bff113d11492f54b4639d0/files/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd-8d61b92a0a02f53a.rlib" "/var/lib/flatpak/runtime/org.freedesktop.Sdk.Extension.rust-stable/x86_64/21.08/e70dbcf542e105f9251ee1535de8d1d4437da47294bff113d11492f54b4639d0/files/lib/rustlib/x86_64-unknown-linux-gnu/lib/libpanic_unwind-fc45202bb435016b.rlib" "/var/lib/flatpak/runtime/org.freedesktop.Sdk.Extension.rust-stable/x86_64/21.08/e70dbcf542e105f9251ee1535de8d1d4437da47294bff113d11492f54b4639d0/files/lib/rustlib/x86_64-unknown-linux-gnu/lib/libminiz_oxide-f2400674c7513725.rlib" "/var/lib/flatpak/runtime/org.freedesktop.Sdk.Extension.rust-stable/x86_64/21.08/e70dbcf542e105f9251ee1535de8d1d4437da47294bff113d11492f54b4639d0/files/lib/rustlib/x86_64-unknown-linux-gnu/lib/libadler-605c3a7d1a5d300d.rlib" "/var/lib/flatpak/runtime/org.freedesktop.Sdk.Extension.rust-stable/x86_64/21.08/e70dbcf542e105f9251ee1535de8d1d4437da47294bff113d11492f54b4639d0/files/lib/rustlib/x86_64-unknown-linux-gnu/lib/libobject-3d4fb4efa907e4e8.rlib" "/var/lib/flatpak/runtime/org.freedesktop.Sdk.Extension.rust-stable/x86_64/21.08/e70dbcf542e105f9251ee1535de8d1d4437da47294bff113d11492f54b4639d0/files/lib/rustlib/x86_64-unknown-linux-gnu/lib/libmemchr-65207f030ab23308.rlib" "/var/lib/flatpak/runtime/org.freedesktop.Sdk.Extension.rust-stable/x86_64/21.08/e70dbcf542e105f9251ee1535de8d1d4437da47294bff113d11492f54b4639d0/files/lib/rustlib/x86_64-unknown-linux-gnu/lib/libaddr2line-76ca199cb0186109.rlib" "/var/lib/flatpak/runtime/org.freedesktop.Sdk.Extension.rust-stable/x86_64/21.08/e70dbcf542e105f9251ee1535de8d1d4437da47294bff113d11492f54b4639d0/files/lib/rustlib/x86_64-unknown-linux-gnu/lib/libgimli-1e3e01ed4f561dc1.rlib" "/var/lib/flatpak/runtime/org.freedesktop.Sdk.Extension.rust-stable/x86_64/21.08/e70dbcf542e105f9251ee1535de8d1d4437da47294bff113d11492f54b4639d0/files/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_demangle-dd8dddcba7c13fee.rlib" "/var/lib/flatpak/runtime/org.freedesktop.Sdk.Extension.rust-stable/x86_64/21.08/e70dbcf542e105f9251ee1535de8d1d4437da47294bff113d11492f54b4639d0/files/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd_detect-00b13d31c3420656.rlib" "/var/lib/flatpak/runtime/org.freedesktop.Sdk.Extension.rust-stable/x86_64/21.08/e70dbcf542e105f9251ee1535de8d1d4437da47294bff113d11492f54b4639d0/files/lib/rustlib/x86_64-unknown-linux-gnu/lib/libhashbrown-e4c8460b81557bd5.rlib" "/var/lib/flatpak/runtime/org.freedesktop.Sdk.Extension.rust-stable/x86_64/21.08/e70dbcf542e105f9251ee1535de8d1d4437da47294bff113d11492f54b4639d0/files/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_std_workspace_alloc-600d46e5f0005455.rlib" "/var/lib/flatpak/runtime/org.freedesktop.Sdk.Extension.rust-stable/x86_64/21.08/e70dbcf542e105f9251ee1535de8d1d4437da47294bff113d11492f54b4639d0/files/lib/rustlib/x86_64-unknown-linux-gnu/lib/libunwind-e4a08a2585b62d37.rlib" "/var/lib/flatpak/runtime/org.freedesktop.Sdk.Extension.rust-stable/x86_64/21.08/e70dbcf542e105f9251ee1535de8d1d4437da47294bff113d11492f54b4639d0/files/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcfg_if-fbc21ec567cb9dc7.rlib" "/var/lib/flatpak/runtime/org.freedesktop.Sdk.Extension.rust-stable/x86_64/21.08/e70dbcf542e105f9251ee1535de8d1d4437da47294bff113d11492f54b4639d0/files/lib/rustlib/x86_64-unknown-linux-gnu/lib/liblibc-10b3fa8e49bd978f.rlib" "/var/lib/flatpak/runtime/org.freedesktop.Sdk.Extension.rust-stable/x86_64/21.08/e70dbcf542e105f9251ee1535de8d1d4437da47294bff113d11492f54b4639d0/files/lib/rustlib/x86_64-unknown-linux-gnu/lib/liballoc-64625b73694ffce7.rlib" "/var/lib/flatpak/runtime/org.freedesktop.Sdk.Extension.rust-stable/x86_64/21.08/e70dbcf542e105f9251ee1535de8d1d4437da47294bff113d11492f54b4639d0/files/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_std_workspace_core-fb6b78ac543a58ee.rlib" "/var/lib/flatpak/runtime/org.freedesktop.Sdk.Extension.rust-stable/x86_64/21.08/e70dbcf542e105f9251ee1535de8d1d4437da47294bff113d11492f54b4639d0/files/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcore-1d1f2d1bec6f51b8.rlib" "-Wl,--end-group" "/var/lib/flatpak/runtime/org.freedesktop.Sdk.Extension.rust-stable/x86_64/21.08/e70dbcf542e105f9251ee1535de8d1d4437da47294bff113d11492f54b4639d0/files/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcompiler_builtins-acf5ff6e9595d982.rlib" "-Wl,-Bdynamic" "-lgobject-2.0" "-lgtk-4" "-lpangocairo-1.0" "-lpango-1.0" "-lharfbuzz" "-lgdk_pixbuf-2.0" "-lcairo-gobject" "-lcairo" "-lgraphene-1.0" "-lgio-2.0" "-lgobject-2.0" "-lglib-2.0" "-lgtk-4" "-lpangocairo-1.0" "-lpango-1.0" "-lharfbuzz" "-lgdk_pixbuf-2.0" "-lcairo-gobject" "-lcairo" "-lgraphene-1.0" "-lgio-2.0" "-lgobject-2.0" "-lglib-2.0" "-lgraphene-1.0" "-lgobject-2.0" "-lglib-2.0" "-lgtk-4" "-lpangocairo-1.0" "-lpango-1.0" "-lharfbuzz" "-lgdk_pixbuf-2.0" "-lcairo-gobject" "-lcairo" "-lgraphene-1.0" "-lgio-2.0" "-lgobject-2.0" "-lglib-2.0" "-lgdk_pixbuf-2.0" "-lgobject-2.0" "-lglib-2.0" "-lpango-1.0" "-lgobject-2.0" "-lglib-2.0" "-lharfbuzz" "-lcairo-gobject" "-lcairo" "-lgobject-2.0" "-lglib-2.0" "-lgio-2.0" "-lgobject-2.0" "-lglib-2.0" "-lgobject-2.0" "-lglib-2.0" "-lgobject-2.0" "-lglib-2.0" "-lgcc_s" "-lutil" "-lrt" "-lpthread" "-lm" "-ldl" "-lc" "-Wl,--eh-frame-hdr" "-Wl,-znoexecstack" "-L" "/var/lib/flatpak/runtime/org.freedesktop.Sdk.Extension.rust-stable/x86_64/21.08/e70dbcf542e105f9251ee1535de8d1d4437da47294bff113d11492f54b4639d0/files/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-o" "/home/user/IdeaProjects/untitled3/target/debug/deps/untitled3-7b5ad7a0ffc15b76" "-Wl,--gc-sections" "-pie" "-Wl,-zrelro,-znow" "-nodefaultlibs"
  = note: /var/lib/flatpak/runtime/org.gnome.Sdk/x86_64/42/bd5cf2646c70337561c1a2bf214e3ca797fd2ea96d981baf8fd537cb931eeebb/files/bin/../lib/gcc/x86_64-unknown-linux-gnu/11.3.0/../../../../x86_64-unknown-linux-gnu/bin/ld: error while loading shared libraries: libbfd-2.37.so: cannot open shared object file: No such file or directory
          collect2: error: ld returned 127 exit status
          

error: could not compile `untitled3` due to previous error
user@debian:~/IdeaProjects/untitled3$ cd /var/lib/flatpak/runtime/org.gnome.Sdk/x86_64/42/bd5cf2646c70337561c1a2bf214e3ca797fd2ea96d981baf8fd537cb931eeebb/files/lib/x86_64-linux-gnu/
user@debian:/var/lib/flatpak/runtime/org.gnome.Sdk/x86_64/42/bd5cf2646c70337561c1a2bf214e3ca797fd2ea96d981baf8fd537cb931eeebb/files/lib/x86_64-linux-gnu$ ls | grep -i libbfd-2.37.so
grep: error while loading shared libraries: libpcre.so.1: cannot open shared object file: No such file or directory
user@debian:/var/lib/flatpak/runtime/org.gnome.Sdk/x86_64/42/bd5cf2646c70337561c1a2bf214e3ca797fd2ea96d981baf8fd537cb931eeebb/files/lib/x86_64-linux-gnu$ ls | /usr/bin/grep -i libbfd-2.37.so
libbfd-2.37.so
user@debian:/var/lib/flatpak/runtime/org.gnome.Sdk/x86_64/42/bd5cf2646c70337561c1a2bf214e3ca797fd2ea96d981baf8fd537cb931eeebb/files/lib/x86_64-linux-gnu$ cd /var/lib/flatpak/runtime/org.gnome.Sdk/x86_64/42/bd5cf2646c70337561c1a2bf214e3ca797fd2ea96d981baf8fd537cb931eeebb/files/bin/
user@debian:/var/lib/flatpak/runtime/org.gnome.Sdk/x86_64/42/bd5cf2646c70337561c1a2bf214e3ca797fd2ea96d981baf8fd537cb931eeebb/files/bin$ ls | /usr/bin/grep -i ld
appstream-builder
fold
gifbuild
gtk4-builder-tool
gtk-builder-tool
ld
ldattach
ld.bfd
ldconfig
ldd
ld.gold
perldoc
pldd
sasldblistusers2
yelp-build
user@debian:/var/lib/flatpak/runtime/org.gnome.Sdk/x86_64/42/bd5cf2646c70337561c1a2bf214e3ca797fd2ea96d981baf8fd537cb931eeebb/files/bin$ flatpak override  --show
[Context]
filesystems=/var/lib/flatpak/runtime/org.kde.Platform/x86_64/5.15/2c9e014e7d60da0f002c9d9d7a620bcedf59546007a7ae16accb3ee3e6335430/files/lib/x86_64-linux-gnu;/var/lib/flatpak/runtime/org.gnome.Sdk/x86_64/42/bd5cf2646c70337561c1a2bf214e3ca797fd2ea96d981baf8fd537cb931eeebb/files/x86_64-unknown-linux-gnu/bin;/var/lib/flatpak/runtime/org.gnome.Sdk/x86_64/42/bd5cf2646c70337561c1a2bf214e3ca797fd2ea96d981baf8fd537cb931eeebb/files/lib/x86_64-linux-gnu;/var/lib/flatpak/runtime/org.gnome.Sdk/x86_64/42/active/files/sbin;/var/lib/flatpak/runtime/org.gnome.Sdk;/var/lib/flatpak/runtime/org.gnome.Sdk/x86_64/42/bd5cf2646c70337561c1a2bf214e3ca797fd2ea96d981baf8fd537cb931eeebb/files/bin;
user@debian:/var/lib/flatpak/runtime/org.gnome.Sdk/x86_64/42/bd5cf2646c70337561c1a2bf214e3ca797fd2ea96d981baf8fd537cb931eeebb/files/bin$ flatpak override --show com.jetbrains.IntelliJ-IDEA-Community 
[Context]
filesystems=/var/lib/flatpak/runtime/org.gnome.Sdk/x86_64/42/bd5cf2646c70337561c1a2bf214e3ca797fd2ea96d981baf8fd537cb931eeebb/files/x86_64-unknown-linux-gnu/bin;/usr/share/cargo/registry/graphene-sys-0.14.8;/var/lib/flatpak/runtime:ro;/usr/share/cargo/registry/gdk4-sys-0.3.1:ro;/home/user/IdeaProjects;/var/lib/flatpak/runtime/org.kde.Platform/x86_64/5.15/2c9e014e7d60da0f002c9d9d7a620bcedf59546007a7ae16accb3ee3e6335430/files/lib/x86_64-linux-gnu;/var/lib/flatpak/runtime/org.gnome.Sdk/x86_64/42/bd5cf2646c70337561c1a2bf214e3ca797fd2ea96d981baf8fd537cb931eeebb/files/lib/x86_64-linux-gnu/pkgconfig;/usr/lib/x86_64-linux-gnu/gtk-4.0/4.0.0:ro;/var/lib/flatpak/runtime/org.gnome.Sdk;/usr/share/cargo/registry/gsk4-sys-0.3.1:ro;/var/lib/flatpak/runtime/org.gnome.Sdk/x86_64/42/bd5cf2646c70337561c1a2bf214e3ca797fd2ea96d981baf8fd537cb931eeebb/files/bin;host;/home/user;/usr/lib/x86_64-linux-gnu/graphene-1.0:ro;/home/user/.cargo;/usr/include/graphene-1.0;/var/lib/flatpak/runtime/org.gnome.Sdk/x86_64/42/active/files/sbin;/var/lib/flatpak/runtime/org.gnome.Sdk/x86_64/42/bd5cf2646c70337561c1a2bf214e3ca797fd2ea96d981baf8fd537cb931eeebb/files/lib/x86_64-linux-gnu;
user@debian:/var/lib/flatpak/runtime/org.gnome.Sdk/x86_64/42/bd5cf2646c70337561c1a2bf214e3ca797fd2ea96d981baf8fd537cb931eeebb/files/bin$ ls /var/lib/flatpak/runtime/org.gnome.Sdk/x86_64/42/active/files/sbin | /usr/bin/grep -i cc
accessdb
cc
ccache
ccmake
gcc
gcc-ar
gcc-nm
gcc-ranlib
genccode
jpgicc
linkicc
orcc
psicc
racc
selinux_check_access
selinuxexeccon
tificc
transicc
x86_64-unknown-linux-gnu-gcc
x86_64-unknown-linux-gnu-gcc-11.3.0
x86_64-unknown-linux-gnu-gcc-ar
x86_64-unknown-linux-gnu-gcc-nm
x86_64-unknown-linux-gnu-gcc-ranlib
yacc
user@debian:/var/lib/flatpak/runtime/org.gnome.Sdk/x86_64/42/bd5cf2646c70337561c1a2bf214e3ca797fd2ea96d981baf8fd537cb931eeebb/files/bin$

P.S.
I’m also not 100% sure what’s going on with my grep problem.

P.P.S.
That was my only rs file.

I forgot to answer the --package and --bin question(s). Basically, the IDE had those set that way; I didn’t do it myself (but the problem happens in the terminal outside of the Flatpaked IDE too, as stated in my previous post).

In the Flatpaked IDE, with or without the parameters added to the run command, I get the following.:

error: linking with `cc` failed: exit status: 1
  |
  = note: "cc" "-m64" "/home/user/IdeaProjects/untitled3/target/debug/deps/untitled3-7b5ad7a0ffc15b76.10vcj8nlwaoo6v6.rcgu.o" "/home/user/IdeaProjects/untitled3/target/debug/deps/untitled3-7b5ad7a0ffc15b76.11oknuvdidlwho0b.rcgu.o" "/home/user/IdeaProjects/untitled3/target/debug/deps/untitled3-7b5ad7a0ffc15b76.12ll1rptsd39et4l.rcgu.o" "/home/user/IdeaProjects/untitled3/target/debug/deps/untitled3-7b5ad7a0ffc15b76.15p1y65avc5d13t0.rcgu.o" "/home/user/IdeaProjects/untitled3/target/debug/deps/untitled3-7b5ad7a0ffc15b76.15zepqn3m639gmcl.rcgu.o" "/home/user/IdeaProjects/untitled3/target/debug/deps/untitled3-7b5ad7a0ffc15b76.1ezv829nuhly42ij.rcgu.o" "/home/user/IdeaProjects/untitled3/target/debug/deps/untitled3-7b5ad7a0ffc15b76.1ir5k53npkcxkbh9.rcgu.o" "/home/user/IdeaProjects/untitled3/target/debug/deps/untitled3-7b5ad7a0ffc15b76.1vm266okay32hcga.rcgu.o" "/home/user/IdeaProjects/untitled3/target/debug/deps/untitled3-7b5ad7a0ffc15b76.1wx0ps3l1mctqpco.rcgu.o" "/home/user/IdeaProjects/untitled3/target/debug/deps/untitled3-7b5ad7a0ffc15b76.2313xef8qgicpww9.rcgu.o" "/home/user/IdeaProjects/untitled3/target/debug/deps/untitled3-7b5ad7a0ffc15b76.2ci7cb1szq7uptue.rcgu.o" "/home/user/IdeaProjects/untitled3/target/debug/deps/untitled3-7b5ad7a0ffc15b76.2jkei144wsmeqksz.rcgu.o" "/home/user/IdeaProjects/untitled3/target/debug/deps/untitled3-7b5ad7a0ffc15b76.2s8aagy27g932nia.rcgu.o" "/home/user/IdeaProjects/untitled3/target/debug/deps/untitled3-7b5ad7a0ffc15b76.2vdvp1n7j2hc3qj9.rcgu.o" "/home/user/IdeaProjects/untitled3/target/debug/deps/untitled3-7b5ad7a0ffc15b76.2vtg0bas7mmbgjtm.rcgu.o" "/home/user/IdeaProjects/untitled3/target/debug/deps/untitled3-7b5ad7a0ffc15b76.2xw0lhm2ivnkvfn3.rcgu.o" "/home/user/IdeaProjects/untitled3/target/debug/deps/untitled3-7b5ad7a0ffc15b76.33kfs9klx4r5a6jg.rcgu.o" "/home/user/IdeaProjects/untitled3/target/debug/deps/untitled3-7b5ad7a0ffc15b76.33sfo52cex1t2tnf.rcgu.o" "/home/user/IdeaProjects/untitled3/target/debug/deps/untitled3-7b5ad7a0ffc15b76.375o2fmvamcmb58t.rcgu.o" "/home/user/IdeaProjects/untitled3/target/debug/deps/untitled3-7b5ad7a0ffc15b76.3ia6dfsllyt9sdz.rcgu.o" "/home/user/IdeaProjects/untitled3/target/debug/deps/untitled3-7b5ad7a0ffc15b76.3jk6f65yr2dnnh39.rcgu.o" "/home/user/IdeaProjects/untitled3/target/debug/deps/untitled3-7b5ad7a0ffc15b76.3pkh5xvpbpbcp2rp.rcgu.o" "/home/user/IdeaProjects/untitled3/target/debug/deps/untitled3-7b5ad7a0ffc15b76.3ub2qmc6ccf7ay11.rcgu.o" "/home/user/IdeaProjects/untitled3/target/debug/deps/untitled3-7b5ad7a0ffc15b76.43gye453ia8ul5r0.rcgu.o" "/home/user/IdeaProjects/untitled3/target/debug/deps/untitled3-7b5ad7a0ffc15b76.46f6hrwdlipo6dax.rcgu.o" "/home/user/IdeaProjects/untitled3/target/debug/deps/untitled3-7b5ad7a0ffc15b76.4cjl9wg5m5r78e7n.rcgu.o" "/home/user/IdeaProjects/untitled3/target/debug/deps/untitled3-7b5ad7a0ffc15b76.4fv5zmwgtmjstqiq.rcgu.o" "/home/user/IdeaProjects/untitled3/target/debug/deps/untitled3-7b5ad7a0ffc15b76.4h1s2d294z6h0d8x.rcgu.o" "/home/user/IdeaProjects/untitled3/target/debug/deps/untitled3-7b5ad7a0ffc15b76.4p9sgwjrjt06qt1z.rcgu.o" "/home/user/IdeaProjects/untitled3/target/debug/deps/untitled3-7b5ad7a0ffc15b76.51p2gxhjd16r1vs8.rcgu.o" "/home/user/IdeaProjects/untitled3/target/debug/deps/untitled3-7b5ad7a0ffc15b76.99amp00yv1xr5i1.rcgu.o" "/home/user/IdeaProjects/untitled3/target/debug/deps/untitled3-7b5ad7a0ffc15b76.bs6r2plbi9m4sbh.rcgu.o" "/home/user/IdeaProjects/untitled3/target/debug/deps/untitled3-7b5ad7a0ffc15b76.e7uyqt5cj9waqt1.rcgu.o" "/home/user/IdeaProjects/untitled3/target/debug/deps/untitled3-7b5ad7a0ffc15b76.gxj9u7yl59j0buj.rcgu.o" "/home/user/IdeaProjects/untitled3/target/debug/deps/untitled3-7b5ad7a0ffc15b76.ohfwvyc7f8r1i3f.rcgu.o" "/home/user/IdeaProjects/untitled3/target/debug/deps/untitled3-7b5ad7a0ffc15b76.s0gtyw4inpb0ck6.rcgu.o" "-Wl,--as-needed" "-L" "/home/user/IdeaProjects/untitled3/target/debug/deps" "-L" "/var/lib/flatpak/runtime/org.freedesktop.Sdk.Extension.rust-stable/x86_64/21.08/e70dbcf542e105f9251ee1535de8d1d4437da47294bff113d11492f54b4639d0/files/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-Wl,-Bstatic" "/home/user/IdeaProjects/untitled3/target/debug/deps/libgtk4-ca902c7f7eba28c6.rlib" "/home/user/IdeaProjects/untitled3/target/debug/deps/libgsk4-f86fc15a1fed60f1.rlib" "/home/user/IdeaProjects/untitled3/target/debug/deps/libgraphene-d3971d917bbfbf49.rlib" "/home/user/IdeaProjects/untitled3/target/debug/deps/libgdk4-cf80e7127fed318c.rlib" "/home/user/IdeaProjects/untitled3/target/debug/deps/libpango-04d385c4353719c1.rlib" "/home/user/IdeaProjects/untitled3/target/debug/deps/libgdk_pixbuf-6f013e886d9ed80d.rlib" "/home/user/IdeaProjects/untitled3/target/debug/deps/libgio-763da2eaa5fe9719.rlib" "/home/user/IdeaProjects/untitled3/target/debug/deps/libfutures_io-ae8d0cc855367cbf.rlib" "/home/user/IdeaProjects/untitled3/target/debug/deps/libcairo-646c5927ff279be1.rlib" "/home/user/IdeaProjects/untitled3/target/debug/deps/libglib-c6f2f6866365728f.rlib" "/home/user/IdeaProjects/untitled3/target/debug/deps/libfutures_executor-22921000605cf671.rlib" "/home/user/IdeaProjects/untitled3/target/debug/deps/libfutures_util-ef36e67040a629ab.rlib" "/home/user/IdeaProjects/untitled3/target/debug/deps/libslab-ae59c7b6e0d36368.rlib" "/home/user/IdeaProjects/untitled3/target/debug/deps/libpin_project_lite-ff7ec06daf2cd9b9.rlib" "/home/user/IdeaProjects/untitled3/target/debug/deps/libpin_utils-6c669315cfadfec5.rlib" "/home/user/IdeaProjects/untitled3/target/debug/deps/libsmallvec-068ac8185082e6f5.rlib" "/home/user/IdeaProjects/untitled3/target/debug/deps/libthiserror-b186ca3ff4e664c6.rlib" "/home/user/IdeaProjects/untitled3/target/debug/deps/libfutures_channel-0fceb783f1ba6f1e.rlib" "/home/user/IdeaProjects/untitled3/target/debug/deps/libfutures_task-ecde0fd8afc76364.rlib" "/home/user/IdeaProjects/untitled3/target/debug/deps/libfutures_core-e4d3a2040637810a.rlib" "/home/user/IdeaProjects/untitled3/target/debug/deps/libonce_cell-d4edd22523d7b9ae.rlib" "/home/user/IdeaProjects/untitled3/target/debug/deps/libbitflags-f1ca410388ec357f.rlib" "/home/user/IdeaProjects/untitled3/target/debug/deps/libgtk4_sys-96fa244889173473.rlib" "/home/user/IdeaProjects/untitled3/target/debug/deps/libgsk4_sys-c4f8eb77d97ab30f.rlib" "/home/user/IdeaProjects/untitled3/target/debug/deps/libgraphene_sys-23e65496c528a782.rlib" "/home/user/IdeaProjects/untitled3/target/debug/deps/libgdk4_sys-8edf29ea7bb9aad4.rlib" "/home/user/IdeaProjects/untitled3/target/debug/deps/libgdk_pixbuf_sys-cdf2ac238dd517ec.rlib" "/home/user/IdeaProjects/untitled3/target/debug/deps/libpango_sys-9ccfbf95bd0d8e4a.rlib" "/home/user/IdeaProjects/untitled3/target/debug/deps/libcairo_sys-6ed51310430022c6.rlib" "/home/user/IdeaProjects/untitled3/target/debug/deps/libgio_sys-ad3999ab84f22338.rlib" "/home/user/IdeaProjects/untitled3/target/debug/deps/libgobject_sys-440edb70b0cd853f.rlib" "/home/user/IdeaProjects/untitled3/target/debug/deps/libglib_sys-156b714538c596d6.rlib" "/home/user/IdeaProjects/untitled3/target/debug/deps/liblibc-c8abee9503293ab0.rlib" "/home/user/IdeaProjects/untitled3/target/debug/deps/libfield_offset-34477f9ac2df78c9.rlib" "/home/user/IdeaProjects/untitled3/target/debug/deps/libmemoffset-9c9e2ab89dd01fb6.rlib" "-Wl,--start-group" "/var/lib/flatpak/runtime/org.freedesktop.Sdk.Extension.rust-stable/x86_64/21.08/e70dbcf542e105f9251ee1535de8d1d4437da47294bff113d11492f54b4639d0/files/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd-8d61b92a0a02f53a.rlib" "/var/lib/flatpak/runtime/org.freedesktop.Sdk.Extension.rust-stable/x86_64/21.08/e70dbcf542e105f9251ee1535de8d1d4437da47294bff113d11492f54b4639d0/files/lib/rustlib/x86_64-unknown-linux-gnu/lib/libpanic_unwind-fc45202bb435016b.rlib" "/var/lib/flatpak/runtime/org.freedesktop.Sdk.Extension.rust-stable/x86_64/21.08/e70dbcf542e105f9251ee1535de8d1d4437da47294bff113d11492f54b4639d0/files/lib/rustlib/x86_64-unknown-linux-gnu/lib/libminiz_oxide-f2400674c7513725.rlib" "/var/lib/flatpak/runtime/org.freedesktop.Sdk.Extension.rust-stable/x86_64/21.08/e70dbcf542e105f9251ee1535de8d1d4437da47294bff113d11492f54b4639d0/files/lib/rustlib/x86_64-unknown-linux-gnu/lib/libadler-605c3a7d1a5d300d.rlib" "/var/lib/flatpak/runtime/org.freedesktop.Sdk.Extension.rust-stable/x86_64/21.08/e70dbcf542e105f9251ee1535de8d1d4437da47294bff113d11492f54b4639d0/files/lib/rustlib/x86_64-unknown-linux-gnu/lib/libobject-3d4fb4efa907e4e8.rlib" "/var/lib/flatpak/runtime/org.freedesktop.Sdk.Extension.rust-stable/x86_64/21.08/e70dbcf542e105f9251ee1535de8d1d4437da47294bff113d11492f54b4639d0/files/lib/rustlib/x86_64-unknown-linux-gnu/lib/libmemchr-65207f030ab23308.rlib" "/var/lib/flatpak/runtime/org.freedesktop.Sdk.Extension.rust-stable/x86_64/21.08/e70dbcf542e105f9251ee1535de8d1d4437da47294bff113d11492f54b4639d0/files/lib/rustlib/x86_64-unknown-linux-gnu/lib/libaddr2line-76ca199cb0186109.rlib" "/var/lib/flatpak/runtime/org.freedesktop.Sdk.Extension.rust-stable/x86_64/21.08/e70dbcf542e105f9251ee1535de8d1d4437da47294bff113d11492f54b4639d0/files/lib/rustlib/x86_64-unknown-linux-gnu/lib/libgimli-1e3e01ed4f561dc1.rlib" "/var/lib/flatpak/runtime/org.freedesktop.Sdk.Extension.rust-stable/x86_64/21.08/e70dbcf542e105f9251ee1535de8d1d4437da47294bff113d11492f54b4639d0/files/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_demangle-dd8dddcba7c13fee.rlib" "/var/lib/flatpak/runtime/org.freedesktop.Sdk.Extension.rust-stable/x86_64/21.08/e70dbcf542e105f9251ee1535de8d1d4437da47294bff113d11492f54b4639d0/files/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd_detect-00b13d31c3420656.rlib" "/var/lib/flatpak/runtime/org.freedesktop.Sdk.Extension.rust-stable/x86_64/21.08/e70dbcf542e105f9251ee1535de8d1d4437da47294bff113d11492f54b4639d0/files/lib/rustlib/x86_64-unknown-linux-gnu/lib/libhashbrown-e4c8460b81557bd5.rlib" "/var/lib/flatpak/runtime/org.freedesktop.Sdk.Extension.rust-stable/x86_64/21.08/e70dbcf542e105f9251ee1535de8d1d4437da47294bff113d11492f54b4639d0/files/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_std_workspace_alloc-600d46e5f0005455.rlib" "/var/lib/flatpak/runtime/org.freedesktop.Sdk.Extension.rust-stable/x86_64/21.08/e70dbcf542e105f9251ee1535de8d1d4437da47294bff113d11492f54b4639d0/files/lib/rustlib/x86_64-unknown-linux-gnu/lib/libunwind-e4a08a2585b62d37.rlib" "/var/lib/flatpak/runtime/org.freedesktop.Sdk.Extension.rust-stable/x86_64/21.08/e70dbcf542e105f9251ee1535de8d1d4437da47294bff113d11492f54b4639d0/files/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcfg_if-fbc21ec567cb9dc7.rlib" "/var/lib/flatpak/runtime/org.freedesktop.Sdk.Extension.rust-stable/x86_64/21.08/e70dbcf542e105f9251ee1535de8d1d4437da47294bff113d11492f54b4639d0/files/lib/rustlib/x86_64-unknown-linux-gnu/lib/liblibc-10b3fa8e49bd978f.rlib" "/var/lib/flatpak/runtime/org.freedesktop.Sdk.Extension.rust-stable/x86_64/21.08/e70dbcf542e105f9251ee1535de8d1d4437da47294bff113d11492f54b4639d0/files/lib/rustlib/x86_64-unknown-linux-gnu/lib/liballoc-64625b73694ffce7.rlib" "/var/lib/flatpak/runtime/org.freedesktop.Sdk.Extension.rust-stable/x86_64/21.08/e70dbcf542e105f9251ee1535de8d1d4437da47294bff113d11492f54b4639d0/files/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_std_workspace_core-fb6b78ac543a58ee.rlib" "/var/lib/flatpak/runtime/org.freedesktop.Sdk.Extension.rust-stable/x86_64/21.08/e70dbcf542e105f9251ee1535de8d1d4437da47294bff113d11492f54b4639d0/files/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcore-1d1f2d1bec6f51b8.rlib" "-Wl,--end-group" "/var/lib/flatpak/runtime/org.freedesktop.Sdk.Extension.rust-stable/x86_64/21.08/e70dbcf542e105f9251ee1535de8d1d4437da47294bff113d11492f54b4639d0/files/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcompiler_builtins-acf5ff6e9595d982.rlib" "-Wl,-Bdynamic" "-lgobject-2.0" "-lgtk-4" "-lpangocairo-1.0" "-lpango-1.0" "-lharfbuzz" "-lgdk_pixbuf-2.0" "-lcairo-gobject" "-lcairo" "-lgraphene-1.0" "-lgio-2.0" "-lgobject-2.0" "-lglib-2.0" "-lgtk-4" "-lpangocairo-1.0" "-lpango-1.0" "-lharfbuzz" "-lgdk_pixbuf-2.0" "-lcairo-gobject" "-lcairo" "-lgraphene-1.0" "-lgio-2.0" "-lgobject-2.0" "-lglib-2.0" "-lgraphene-1.0" "-lgobject-2.0" "-lglib-2.0" "-lgtk-4" "-lpangocairo-1.0" "-lpango-1.0" "-lharfbuzz" "-lgdk_pixbuf-2.0" "-lcairo-gobject" "-lcairo" "-lgraphene-1.0" "-lgio-2.0" "-lgobject-2.0" "-lglib-2.0" "-lgdk_pixbuf-2.0" "-lgobject-2.0" "-lglib-2.0" "-lpango-1.0" "-lgobject-2.0" "-lglib-2.0" "-lharfbuzz" "-lcairo-gobject" "-lcairo" "-lgobject-2.0" "-lglib-2.0" "-lgio-2.0" "-lgobject-2.0" "-lglib-2.0" "-lgobject-2.0" "-lglib-2.0" "-lgobject-2.0" "-lglib-2.0" "-lgcc_s" "-lutil" "-lrt" "-lpthread" "-lm" "-ldl" "-lc" "-Wl,--eh-frame-hdr" "-Wl,-znoexecstack" "-L" "/var/lib/flatpak/runtime/org.freedesktop.Sdk.Extension.rust-stable/x86_64/21.08/e70dbcf542e105f9251ee1535de8d1d4437da47294bff113d11492f54b4639d0/files/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-o" "/home/user/IdeaProjects/untitled3/target/debug/deps/untitled3-7b5ad7a0ffc15b76" "-Wl,--gc-sections" "-pie" "-Wl,-zrelro,-znow" "-nodefaultlibs"
  = note: /var/lib/flatpak/runtime/org.gnome.Sdk/x86_64/42/bd5cf2646c70337561c1a2bf214e3ca797fd2ea96d981baf8fd537cb931eeebb/files/bin/../lib/gcc/x86_64-unknown-linux-gnu/11.3.0/../../../../x86_64-unknown-linux-gnu/bin/ld: /var/lib/flatpak/runtime/org.gnome.Sdk/x86_64/42/bd5cf2646c70337561c1a2bf214e3ca797fd2ea96d981baf8fd537cb931eeebb/files/bin/../lib/gcc/x86_64-unknown-linux-gnu/11.3.0/../../../x86_64-linux-gnu/libgio-2.0.so: undefined reference to `g_module_open_full'
          collect2: error: ld returned 1 exit status
          
  = help: some `extern` functions couldn't be found; some native libraries may need to be installed or have their path specified
  = note: use the `-l` flag to specify native libraries to link
  = note: use the `cargo:rustc-link-lib` directive to specify the native libraries to link with Cargo (see https://doc.rust-lang.org/cargo/reference/build-scripts.html#cargorustc-link-libkindname)

P.S.
The environment variables part is set as follows.:

PATH=/var/lib/flatpak/runtime/org.kde.Platform/x86_64/5.15/2c9e014e7d60da0f002c9d9d7a620bcedf59546007a7ae16accb3ee3e6335430/files/lib/x86_64-linux-gnu/:/var/lib/flatpak/runtime/org.gnome.Sdk/x86_64/42/bd5cf2646c70337561c1a2bf214e3ca797fd2ea96d981baf8fd537cb931eeebb/files/lib/x86_64-linux-gnu/:/var/lib/flatpak/runtime/org.gnome.Sdk/x86_64/42/bd5cf2646c70337561c1a2bf214e3ca797fd2ea96d981baf8fd537cb931eeebb/files/x86_64-unknown-linux-gnu/bin:/var/lib/flatpak/runtime/org.gnome.Sdk/x86_64/42/bd5cf2646c70337561c1a2bf214e3ca797fd2ea96d981baf8fd537cb931eeebb/files/bin:/var/lib/flatpak/runtime/org.gnome.Sdk/x86_64/42/bd5cf2646c70337561c1a2bf214e3ca797fd2ea96d981baf8fd537cb931eeebb/files/bin/../lib/gcc/x86_64-unknown-linux-gnu/11.3.0/../../../../x86_64-unknown-linux-gnu/bin/:/var/lib/flatpak/runtime/org.gnome.Sdk/x86_64/42/active/files/sbin:/var/run/host/usr/lib/gcc/x86_64-unknown-linux-gnu/11.3.0/../../../../x86_64-unknown-linux-gnu/bin/:/var/run/host/usr/bin:/var/lib/flatpak/runtime/org.gnome.Sdk/x86_64/42/active/files/lib/x86_64-linux-gnu/pkgconfig/:/var/lib/flatpak/runtime/org.freedesktop.Sdk.Extension.rust-stable/x86_64/21.08/active/files/bin/:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games;PKG_CONFIG_PATH=/var/lib/flatpak/runtime/org.gnome.Sdk/x86_64/42/active/files/lib/x86_64-linux-gnu/pkgconfig/

Hi! Is there a reason you can’t use a locally installed Rust installation? It seems strange that you try to use the flatpak extension when there is no need for that.

Afaik the Intellj + Rust extension works flawlessly with a local installation. You make your life just harder.
It could be (not sure) that the flatpak extension uses a different glibc (cause its compiled against freedesktop flatpak) then your system glibc. All this would work if you have a IDE working in tandem with flatpak (like GNOME Builder does) because it uses the same libs and compilers for building and running the application.