RustCrypto / asm-hashes

Assembly implementations of cryptographic hash functions
46 stars 26 forks source link

Fix deprecated use of `cc::Build::compile` in `build.rs` #59

Closed NobodyXu closed 1 year ago

NobodyXu commented 1 year ago

and fixed the path to assemblies on windows.

I encountered link time failure when compiling on Windows locally and on CI:

  error occurred: Command "C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\VC\\Tools\\MSVC\\14.36.32532\\bin\\HostX86\\arm64\\lib.exe" "-out:C:\\Users\\nobodyxu\\cargo-binstall\\target\\aarch64-pc-windows-msvc\\debug\\build\\sha1-asm-600eae65c368c0c1\\out\\libsha1.a" "-nologo" "C:\\Users\\nobodyxu\\cargo-binstall\\target\\aarch64-pc-windows-msvc\\debug\\build\\sha1-asm-600eae65c368c0c1\\out\\src/aarch64.o" with args "lib.exe" did not execute successfully (status code exit code: 1181).

I think this might have something to do with use of deprecated feature of cc::Build::compile:

For backwards compatibility, if output starts with “lib” and ends with “.a”, a second “lib” prefix and “.a” suffix do not get added on, but this usage is deprecated; please omit lib and .a in the argument that you pass.

It should pass just a name instead and msvc would deal with that:

The output string argument determines the file name for the compiled library. The Rust compiler will create an assembly named “lib”+output+“.a”. MSVC will create a file named output+“.lib”.

Also, the build.rs are using / on windows, this might also be the cause of failure.

Related issue https://github.com/Byron/gitoxide/issues/917#

Signed-off-by: Jiahao XU Jiahao_XU@outlook.com

newpavlov commented 1 year ago

Looks good! Could you fix the MacOS CI failure by bumping its MSRV? Also, it would be nice to check if Windows builds are indeed fixed, otherwise we can remove the MAIN_SEPARATOR workaround.

NobodyXu commented 1 year ago

Looks good! Could you fix the MacOS CI failure by bumping its MSRV?

I've bumped the MacOS MSRV to 1.54.0 to fix the error.

It's unfortunate that bumping it to other 1.4x.0 versions doesn't work.

Also, it would be nice to check if Windows builds are indeed fixed, otherwise we can remove the MAIN_SEPARATOR workaround.

I've tested it in CI and it doesn't fix the error, so I've reverted it.