project-slippi / Ishiiruka

GNU General Public License v2.0
329 stars 140 forks source link

Build breaks after Cargo 1.79 #423

Closed pylasnier closed 1 month ago

pylasnier commented 2 months ago

Cargo 1.79 has changed behaviour where dashes are replaced with underscores in lib names, as listed in their changelog. This appears to have broken the Ishiiruka build by causing CMake to generate an incorrectly hyphenated arguments, with it failing at linking for not finding the slippi_rust_extensions lib. I have not tried to build for any version beyond Rust 1.79, but the linker argument generated (listed below) is still hyphenated in nightly.

Expected Behavior

Build (normal behaviour with Cargo 1.78). -lslippi_rust_extensions with underscores is passed to the linker.

Current Behavior

With Cargo 1.79, build fails with:

[100%] Linking CXX executable ../../../Binaries/dolphin-emu
/nix/store/qsx2xqqm0lp6d8hi86r4y0rz5v9m62wn-binutils-2.42/bin/ld: cannot find -lslippi-rust-extensions: No such file or directory
collect2: error: ld returned 1 exit status
make[2]: *** [Source/Core/DolphinWX/CMakeFiles/dolphin-emu.dir/build.make:1434: Binaries/dolphin-emu] Error 1
make[1]: *** [CMakeFiles/Makefile2:1426: Source/Core/DolphinWX/CMakeFiles/dolphin-emu.dir/all] Error 2
make: *** [Makefile:166: all] Error 2

where -lslippi-rust-extensions with hyphens is passed to the linker.

Steps to Reproduce

  1. Install rustc and Cargo with Rust version 1.79
  2. Follow Ishiiruka build instructions

Environment

NixOS, built in nix-shell environment.

pylasnier commented 2 months ago

A note that this Cargo change introduces swaps of hyphens and underscores for the lib file in many places throughout the generate CMake files, and simply changing the linker argument back is not enough to fix the build.

ryanmcgrath commented 2 months ago

Huh, it's likely a simple-ish fix of just changing the crate name to use underscores for consistency. It's not like it gets uploaded or distributed outside the project.

I'll see about poking at this over the weekend since the way Windows finds the lib is a bit custom.

(I don't suppose there's a way to force the Cargo 1.78 behavior anywhere, is there?)

pylasnier commented 2 months ago

(I don't suppose there's a way to force the Cargo 1.78 behavior anywhere, is there?)

This comment from the offending pull request implies that backwards compatibility is retained, but that isn't the case for Ishiiruka or even other projects, it seems.

it's likely a simple-ish fix of just changing the crate name to use underscores for consistency.

This seems to be what other projects with similar failures are doing, though corrosion (which seems to be where the mismatch arises from) also fixes this in v0.5.0 without requiring a name change.

I can confirm that replacing all (non-URL) instances of slippi-rust-extensions with slippi_rust_extensions in the main repo and the Rust submodule (there's not many instances, only 2 total) builds successfully with Cargo 1.79.0 on Linux.

pylasnier commented 2 months ago

I can confirm that replacing all (non-URL) instances of slippi-rust-extensions with slippi_rust_extensions in the main repo and the Rust submodule (there's not many instances, only 2 total) builds successfully with Cargo 1.79.0 on Linux.

I've written a small PR which adds these changes