RustCrypto / asm-hashes

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

CI: test on 64-bit Windows (GNU) #19

Closed tarcieri closed 4 years ago

tarcieri commented 4 years ago

Seems 32-bit is a bit tricky (see below).

Testing on MSVC reproduced the error reported in #17.

newpavlov commented 4 years ago

Can you try the GNU toolchain?

tarcieri commented 4 years ago

Guess we need to install MinGW or something to make GNU work?

linker `i686-w64-mingw32-gcc` not found
tarcieri commented 4 years ago

Hmmm, this is odd:

https://github.com/RustCrypto/asm-hashes/pull/19/checks?check_run_id=1281623236

   Compiling md5-asm v0.4.3 (D:\a\asm-hashes\asm-hashes\md5)
error: linking with `gcc` failed: exit code: 1
  |
  = note: "gcc" "-fno-use-linker-plugin" "-Wl,--nxcompat" "-nostdlib" "-Wl,--large-address-aware" "C:\\Rust\\.rustup\\toolchains\\1.41.0-x86_64-pc-windows-msvc\\lib\\rustlib\\i686-pc-windows-gnu\\lib\\crt2.o" "C:\\Rust\\.rustup\\toolchains\\1.41.0-x86_64-pc-windows-msvc\\lib\\rustlib\\i686-pc-windows-gnu\\lib\\rsbegin.o" "-L" "C:\\Rust\\.rustup\\toolchains\\1.41.0-x86_64-pc-windows-msvc\\lib\\rustlib\\i686-pc-windows-gnu\\lib" "D:\\a\\asm-hashes\\asm-hashes\\target\\i686-pc-windows-gnu\\release\\deps\\md5_asm-d19db745816a8321.md5_asm.4zggfnky-cgu.0.rcgu.o" "D:\\a\\asm-hashes\\asm-hashes\\target\\i686-pc-windows-gnu\\release\\deps\\md5_asm-d19db745816a8321.md5_asm.4zggfnky-cgu.1.rcgu.o" "-o" "D:\\a\\asm-hashes\\asm-hashes\\target\\i686-pc-windows-gnu\\release\\deps\\md5_asm-d19db745816a8321.exe" "D:\\a\\asm-hashes\\asm-hashes\\target\\i686-pc-windows-gnu\\release\\deps\\md5_asm-d19db745816a8321.56acw0ez4fz0pp1x.rcgu.o" "-Wl,--gc-sections" "-nodefaultlibs" "-L" "D:\\a\\asm-hashes\\asm-hashes\\target\\i686-pc-windows-gnu\\release\\deps" "-L" "D:\\a\\asm-hashes\\asm-hashes\\target\\release\\deps" "-L" "D:\\a\\asm-hashes\\asm-hashes\\target\\i686-pc-windows-gnu\\release\\build\\md5-asm-d793530e91a79f1e\\out" "-L" "C:\\Rust\\.rustup\\toolchains\\1.41.0-x86_64-pc-windows-msvc\\lib\\rustlib\\i686-pc-windows-gnu\\lib" "-Wl,-Bstatic" "-Wl,--whole-archive" "-lmd5" "-Wl,--no-whole-archive" "C:\\Rust\\.rustup\\toolchains\\1.41.0-x86_64-pc-windows-msvc\\lib\\rustlib\\i686-pc-windows-gnu\\lib\\libtest-6fb8dee5da8fd51b.rlib" "C:\\Rust\\.rustup\\toolchains\\1.41.0-x86_64-pc-windows-msvc\\lib\\rustlib\\i686-pc-windows-gnu\\lib\\libterm-44f946979850a39d.rlib" "C:\\Rust\\.rustup\\toolchains\\1.41.0-x86_64-pc-windows-msvc\\lib\\rustlib\\i686-pc-windows-gnu\\lib\\libgetopts-1ede4ac20c009740.rlib" "C:\\Rust\\.rustup\\toolchains\\1.41.0-x86_64-pc-windows-msvc\\lib\\rustlib\\i686-pc-windows-gnu\\lib\\libunicode_width-ae33122183e4e153.rlib" "C:\\Rust\\.rustup\\toolchains\\1.41.0-x86_64-pc-windows-msvc\\lib\\rustlib\\i686-pc-windows-gnu\\lib\\librustc_std_workspace_std-ad99504a34ebe13d.rlib" "-Wl,--start-group" "C:\\Rust\\.rustup\\toolchains\\1.41.0-x86_64-pc-windows-msvc\\lib\\rustlib\\i686-pc-windows-gnu\\lib\\libstd-319c66d95f163cfa.rlib" "C:\\Rust\\.rustup\\toolchains\\1.41.0-x86_64-pc-windows-msvc\\lib\\rustlib\\i686-pc-windows-gnu\\lib\\libpanic_unwind-1a1fb2d4d34efaf8.rlib" "C:\\Rust\\.rustup\\toolchains\\1.41.0-x86_64-pc-windows-msvc\\lib\\rustlib\\i686-pc-windows-gnu\\lib\\libhashbrown-d427c26d6ee540f6.rlib" "C:\\Rust\\.rustup\\toolchains\\1.41.0-x86_64-pc-windows-msvc\\lib\\rustlib\\i686-pc-windows-gnu\\lib\\librustc_std_workspace_alloc-d57a946752c9dbe0.rlib" "C:\\Rust\\.rustup\\toolchains\\1.41.0-x86_64-pc-windows-msvc\\lib\\rustlib\\i686-pc-windows-gnu\\lib\\libbacktrace-3aac111d9e75f9b6.rlib" "C:\\Rust\\.rustup\\toolchains\\1.41.0-x86_64-pc-windows-msvc\\lib\\rustlib\\i686-pc-windows-gnu\\lib\\libbacktrace_sys-a6930c64c4de4d00.rlib" "C:\\Rust\\.rustup\\toolchains\\1.41.0-x86_64-pc-windows-msvc\\lib\\rustlib\\i686-pc-windows-gnu\\lib\\librustc_demangle-b50cb3c05c89c847.rlib" "C:\\Rust\\.rustup\\toolchains\\1.41.0-x86_64-pc-windows-msvc\\lib\\rustlib\\i686-pc-windows-gnu\\lib\\libunwind-60ed44205c3c5009.rlib" "C:\\Rust\\.rustup\\toolchains\\1.41.0-x86_64-pc-windows-msvc\\lib\\rustlib\\i686-pc-windows-gnu\\lib\\libcfg_if-adf5cf96a1b5cae5.rlib" "C:\\Rust\\.rustup\\toolchains\\1.41.0-x86_64-pc-windows-msvc\\lib\\rustlib\\i686-pc-windows-gnu\\lib\\liblibc-a7dbed86c78763ca.rlib" "C:\\Rust\\.rustup\\toolchains\\1.41.0-x86_64-pc-windows-msvc\\lib\\rustlib\\i686-pc-windows-gnu\\lib\\liballoc-3f311c7fee9215e7.rlib" "C:\\Rust\\.rustup\\toolchains\\1.41.0-x86_64-pc-windows-msvc\\lib\\rustlib\\i686-pc-windows-gnu\\lib\\librustc_std_workspace_core-e7fe638b0e960749.rlib" "C:\\Rust\\.rustup\\toolchains\\1.41.0-x86_64-pc-windows-msvc\\lib\\rustlib\\i686-pc-windows-gnu\\lib\\libcore-f6794ed3da403dd0.rlib" "-Wl,--end-group" "C:\\Rust\\.rustup\\toolchains\\1.41.0-x86_64-pc-windows-msvc\\lib\\rustlib\\i686-pc-windows-gnu\\lib\\libcompiler_builtins-33bdd2acd606fd31.rlib" "-Wl,-Bdynamic" "-lkernel32" "-ladvapi32" "-lws2_32" "-luserenv" "-Wl,-Bstatic" "-lgcc_eh" "-lpthread" "-Wl,-Bdynamic" "-lmingwex" "-lmingw32" "-lgcc" "-lmsvcrt" "-lmsvcrt" "-luser32" "-lkernel32" "C:\\Rust\\.rustup\\toolchains\\1.41.0-x86_64-pc-windows-msvc\\lib\\rustlib\\i686-pc-windows-gnu\\lib\\rsend.o"
  = note: C:/ProgramData/Chocolatey/lib/mingw/tools/install/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: unrecognized option '--large-address-aware'
          C:/ProgramData/Chocolatey/lib/mingw/tools/install/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: use the --help option for usage information
          collect2.exe: error: ld returned 1 exit status

Notably:

x86_64-w64-mingw32/bin/ld.exe: unrecognized option '--large-address-aware'
tarcieri commented 4 years ago

Aha, here's an explanation:

https://github.com/rust-lang/rust/issues/33535#issuecomment-218527623

The compiler only assumes that it can run executables for its own platform, which in this case is x86_64-pc-windows-gnu. That means that the compiler is running a 64-bit mingw gcc trying to generate a 32-bit executable. The mingw gcc builds, however, do not support this.

...so we can't test 32-bit builds on a 64-bit Windows host. Unfortunate.

I can still try testing 64-bit builds.

tarcieri commented 4 years ago

Different error trying to link on 64-bit windows:

https://github.com/RustCrypto/asm-hashes/pull/19/checks?check_run_id=1281689904

  = note: C:\Rust\.rustup\toolchains\1.41.0-x86_64-pc-windows-msvc\lib\rustlib\x86_64-pc-windows-gnu\lib\crt2.o:crtexe.c:(.rdata$.refptr.__onexitbegin[.refptr.__onexitbegin]+0x0): undefined reference to `__onexitbegin'
          C:\Rust\.rustup\toolchains\1.41.0-x86_64-pc-windows-msvc\lib\rustlib\x86_64-pc-windows-gnu\lib\crt2.o:crtexe.c:(.rdata$.refptr.__onexitend[.refptr.__onexitend]+0x0): undefined reference to `__onexitend'
newpavlov commented 4 years ago

...so we can't test 32-bit builds on a 64-bit Windows host. Unfortunate.

It looks you have found a way? I wonder if we should add a compilation error for MSVC targets, after short search I could not find a clear instruction on how to compile S files using it.

Different error trying to link on 64-bit windows:

Since it works on stable, simply bump MSRV?

tarcieri commented 4 years ago

It looks you have found a way?

I removed the 32-bit Windows build

Since it works on stable, simply bump MSRV?

Huh, interesting. Guess I can start from 1.46.0 and work backwards until it breaks.

Edit: looks like 1.43 is the minimum supported version