Skip to content

Commit

Permalink
Windows: fix build issue with newer version of Rust
Browse files Browse the repository at this point in the history
Newer versions of Rust appear to include '/defaultlib:msvcrt' in
the list of native static libs when you run '--print=native-static-libs'.

MSVC doesn't know what to do with this when passed as a linker dependency.

Since msvcrt.lib is ALSO listed, the solution seems to be to strip this
item from the list.
  • Loading branch information
micahsnyder committed Jul 10, 2024
1 parent 1d30588 commit ad2bb89
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions cmake/FindRust.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -428,6 +428,10 @@ foreach(LINE ${LINE_LIST})
endif()

string(REPLACE "native-static-libs: " "" LINE "${LINE}")

# Some Rust versions have a defaultlib:msvcrt; in the output, which we don't want.
string(REGEX REPLACE " /defaultlib:msvcrt" "" LINE "${LINE}")

string(REGEX REPLACE " " "" LINE "${LINE}")
string(REGEX REPLACE " " ";" LINE "${LINE}")

Expand Down

0 comments on commit ad2bb89

Please sign in to comment.