Skip to content

CMake: Helpful error message when Rust version too old#1481

Draft
val-ms wants to merge 1 commit intoCisco-Talos:mainfrom
val-ms:issue-1480-min-rust-version
Draft

CMake: Helpful error message when Rust version too old#1481
val-ms wants to merge 1 commit intoCisco-Talos:mainfrom
val-ms:issue-1480-min-rust-version

Conversation

@val-ms
Copy link
Copy Markdown
Contributor

@val-ms val-ms commented Apr 8, 2025

It isn't obvious if a build fails because the Rust version is too low.

The FindRust.cmake module already has logic to check the min supported Rus version. This commit make use of that, adding a Rust version var at the top of CMakeLists.txt. We will have to update it any time we run cargo update, before releasing a new feature version.

If your Rust version is too low (or you artificially crank up the min version for testing, the error will look like this:

-- Rust tool `cargo` found: /home/micah/.cargo/bin/cargo, 1.85.0 -- Rust tool `rustc` found: /home/micah/.cargo/bin/rustc, 1.85.0 -- Rust tool `rustup` found: /home/micah/.cargo/bin/rustup, 1.28.1 -- Rust tool `rust-gdb` found: /home/micah/.cargo/bin/rust-gdb, 9.2 -- Rust tool `rust-lldb` not found: Failed to determine version. -- Rust tool `rustdoc` found: /home/micah/.cargo/bin/rustdoc, 1.85.0 -- Rust tool `rustfmt` found: /home/micah/.cargo/bin/rustfmt, 1.8.0 -- Rust tool `bindgen` not found.
CMake Error at cmake/FindRust.cmake:412 (message):
  Your Rust toolchain is to old to build this project:

      1.85.0 < 1.100.0
Call Stack (most recent call first):
  CMakeLists.txt:144 (find_package)

-- Configuring incomplete, errors occurred!

Fixes: #1480

I have also updated the min Rust version in clamav-documentation where it talks about installing Rust: Cisco-Talos/clamav-documentation@02f6902

@val-ms val-ms force-pushed the issue-1480-min-rust-version branch from 3e8b463 to 9caa738 Compare April 8, 2025 12:24
@val-ms val-ms force-pushed the issue-1480-min-rust-version branch from 9caa738 to 4f361f2 Compare April 8, 2025 22:39
@val-ms val-ms force-pushed the issue-1480-min-rust-version branch 5 times, most recently from 51f37c2 to 30703cd Compare May 27, 2025 20:40
It isn't obvious if a build fails because the Rust version is too low.

The FindRust.cmake module already has logic to check the min supported
Rus version. This commit make use of that, adding a Rust version var at
the top of CMakeLists.txt. We will have to update it any time we run
`cargo update`, before releasing a new feature version.

If your Rust version is too low (or you artificially crank up the min
version for testing, the error will look like this:

-- Rust tool `cargo` found: /home/micah/.cargo/bin/cargo, 1.85.0
-- Rust tool `rustc` found: /home/micah/.cargo/bin/rustc, 1.85.0
-- Rust tool `rustup` found: /home/micah/.cargo/bin/rustup, 1.28.1
-- Rust tool `rust-gdb` found: /home/micah/.cargo/bin/rust-gdb, 9.2
-- Rust tool `rust-lldb` not found: Failed to determine version.
-- Rust tool `rustdoc` found: /home/micah/.cargo/bin/rustdoc, 1.85.0
-- Rust tool `rustfmt` found: /home/micah/.cargo/bin/rustfmt, 1.8.0
-- Rust tool `bindgen` not found.
CMake Error at cmake/FindRust.cmake:412 (message):
  Your Rust toolchain is to old to build this project:

      1.85.0 < 1.100.0
Call Stack (most recent call first):
  CMakeLists.txt:144 (find_package)

-- Configuring incomplete, errors occurred!

Fixes: Cisco-Talos#1480
@val-ms val-ms force-pushed the issue-1480-min-rust-version branch from 30703cd to 2320326 Compare May 27, 2025 20:57
@val-ms
Copy link
Copy Markdown
Contributor Author

val-ms commented Aug 19, 2025

This PR's new test hangs in the github runner and I have no idea why. Will mark it as a draft until I can revisit and figure it out.

@val-ms val-ms marked this pull request as draft August 19, 2025 18:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Build fail without significant message on old linux distros .

2 participants