Skip to content

[Bug]: corrosion breaks due to new rustup toolchain list format in rustup v1.28.0 #590

@rami3l

Description

@rami3l

Current Behavior

Hi! @rami3l from the rustup team here.

After announcing rustup v1.28.0 beta, we have received a bug report that goes like so:

(After upgrading rustup from v1.27.1 to v1.28.0, corrosion is no longer able to find the toolchain it needs:)

CMake Warning (dev) at build/_deps/corrosion-src/cmake/FindRust.cmake:363 (message):
  Unexpected output from `rustc --version` for Toolchain
  `stable-x86_64-unknown-linux-gnu`: ``.

  Ignoring this toolchain.
Call Stack (most recent call first):
  build/_deps/corrosion-src/cmake/Corrosion.cmake:63 (find_package)
  build/_deps/corrosion-src/CMakeLists.txt:73 (include)
This warning is for project developers.  Use -Wno-dev to suppress it.

-- Rust Toolchain: 
CMake Error at build/_deps/corrosion-src/cmake/FindRust.cmake:23 (message):
  Could not find toolchain ''

  Available toolchains:

    `nightly-x86_64-unknown-linux-gnu`
    `nightly-2024-03-10-x86_64-unknown-linux-gnu`
    `1.70-x86_64-unknown-linux-gnu`
    `1.77-x86_64-unknown-linux-gnu`

Call Stack (most recent call first):
  build/_deps/corrosion-src/cmake/FindRust.cmake:469 (_findrust_failed)
  build/_deps/corrosion-src/cmake/Corrosion.cmake:63 (find_package)
  build/_deps/corrosion-src/CMakeLists.txt:73 (include)

rust-lang/rustup#4127

Expected Behavior

The project builds correctly.

Steps To Reproduce

Build any corrosion project with rustup v1.28.0.

The direct cause of this issue is the interaction between rust-lang/rustup#3225 and the following section of corrosion:

if (_TOOLCHAIN_RAW MATCHES "([a-zA-Z0-9\\._\\-]+)[ \t\r\n]?(\\(default\\) \\(override\\)|\\(default\\)|\\(override\\))?[ \t\r\n]+(.+)")
set(_TOOLCHAIN "${CMAKE_MATCH_1}")
set(_TOOLCHAIN_TYPE "${CMAKE_MATCH_2}")
set(_TOOLCHAIN_PATH "${CMAKE_MATCH_3}")
set(_TOOLCHAIN_${_TOOLCHAIN}_PATH "${CMAKE_MATCH_3}")
if (_TOOLCHAIN_TYPE MATCHES ".*\\(default\\).*")
set(_TOOLCHAIN_DEFAULT "${_TOOLCHAIN}")
endif()
if (_TOOLCHAIN_TYPE MATCHES ".*\\(override\\).*")
set(_TOOLCHAIN_OVERRIDE "${_TOOLCHAIN}")
endif()

Environment

- OS: Fedora 41

(However, this error should be platform-independent.)

Remarks

We can do a silent fix on our side, however, we would prefer informing you of this issue in advance so that we can figure out the best way forward together. I will be happy to work on a patch to corrosion if you'd like.

The original motivation of rust-lang/rustup#3225 is that it might not be immediately clear to the end user what the active toolchain is, I wonder if you have the same issue in this project in that respect.

Also, we are interested in providing a machine-facing output mode. Please feel free to provide suggestions WRT how you'd expect this to be done.

Many thanks in advance, and happy holidays :)

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions