JTR -- error: linking with `cc` failed: exit status: 1

I've been getting this error whenever I try to compile and don't know what to do with it. My AI had a couple of suggestions that went nowhere and I tried looking through some similar topics here on this forum, but didn't find a solution. I really don't have a clue what this is except that the "cc" maybe is a reference to "C compiler"?? I'm working in Rust, not C, so I'm not seeing the connection. Anyway, I need some help getting past this. The error message actually has page after page of output. Here's part of it:

error: linking with `cc` failed: exit status: 1
  |
  = note:  "cc" "-m64" "/tmp/rustciLcA5t/symbols.o" "<10 object files omitted>" "-Wl,--as-needed" "-Wl,-Bstatic" "/home/jtreagan/programming/rust/mine/qbnk_rbld5/target/debug/deps/{libqbnk_rbld5-b362d0beeb81bc62.rlib,libserde_json-5f898f657b129933.rlib,libmemchr-ee0a9354c559bde2.rlib,libitoa-37c5ecc59978b7f6.rlib,libryu-be08ec97f016dca5.rlib,libnum_traits-a...........

            // lots and lots of similar stuff ...............
            // ending with...........

idget.rs:855:(.text._ZN69_$LT$fltk..input..FloatInput$u20$as$u20$fltk..prelude..WidgetBase$GT$3new17h7df7d972406a8617E+0x164): undefined reference to `Fl_Float_Input_set_deleter'
          /usr/bin/ld: /home/jtreagan/programming/rust/mine/qbnk_rbld5/target/debug/deps/libfltk-fac528403382754b.rlib(fltk-fac528403382754b.fltk.8244e0389a3123a6-cgu.15.rcgu.o): in function `<fltk::window::DoubleWindow as fltk::prelude::WidgetBase>::new':
          /home/jtreagan/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/fltk-1.5.5/src/macros/widget.rs:855:(.text._ZN72_$LT$fltk..window..DoubleWindow$u20$as$u20$fltk..prelude..WidgetBase$GT$3new17h1a9800c918832c4fE+0x164): undefined reference to `Fl_Double_Window_set_deleter'
          collect2: error: ld returned 1 exit status
          
  = note: 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#rustc-link-lib)

Just recently my IDE installed the latest version of Rust. I'm wondering if that could have anything to do with this. Anyway....Help?

It is complaining that you are missing the native libraries for fltk undefined reference to `Fl_Double_Window_set_deleter'

Either you need to install FLTK libraries if using fltk-sys, or look in your dependencies if you want the pre-compiled libraries.

[dependencies]
fltk = { version = "^1.5", features = ["fltk-bundled"] }

https://github.com/fltk-rs/fltk-rs?tab=readme-ov-file#build-dependencies

So, here is what I've been using in the dependencies section of my Cargo.toml file:

fltk = { version = "^1.5.5", features = ["fltk-bundled"] }

When I look through the list of missing files and libraries in that massively long list it seems like I've lost my whole Rust install. Do I need to remove everything from my computer and reinstall Rust? This is a really strange error.

This might be an upstream issue. Can you run cargo update then cargo build.

1 Like

That did it! Thanks.

Any idea what caused the problem?

I think it's some binary conflict. 1.5.6 was released a few days ago with new prebuilt binaries for cfltk and FLTK. I'm guessing when you updated Rust, it reran the build script, downloading the newer prebuilt binaries but the Cargo.lock fixed your fltk dependency to 1.5.5. fltk-rs used to pin the prebuilt binaries to each version but that resulted in excessive storage for each release. Now only changes to FLTK or cfltk will require new binaries.