aws / aws-lc-rs

aws-lc-rs is a cryptographic library using AWS-LC for its cryptographic operations. The library strives to be API-compatible with the popular Rust library named ring.
Other
318 stars 49 forks source link

Build failure when targeting `x86_64-pc-windows-gnu` and path contains spaces #616

Open justsmth opened 1 day ago

justsmth commented 1 day ago

Problem:

When using the prebuilt NASM binaries and the path contains spaces, builds targeting x86_64-pc-windows-gnu fail.

Reported by @s-mayrh here.

Relevant details

AWS-LC for Rust versions or commit: aws-lc-sys@0.23.0

System information:

Build log:

 Copying platform assembly files from C:/Users/User Name/.cargo/registry/src/index.crates.io-6f17d22bba15001f/aws-lc-sys-0.23.1/aws-lc/generated-src/win-x86_64/crypto/ to C:/Users/User Name/AppData/Local/Temp/cargo-installuzDzUy/release/build/aws-lc-sys-14bf4d230e867451/out/build/aws-lc/crypto
  Der Befehl "C:\Users\User" ist entweder falsch geschrieben oder
  konnte nicht gefunden werden. (Command misspelled or not found)
  make[2]: *** [aws-lc/crypto/fipsmodule/CMakeFiles/fipsmodule.dir/build.make:123: aws-lc/crypto/fipsmodule/CMakeFiles/fipsmodule.dir/aesni-gcm-avx512.asm.obj] Error 1
  make[2]: *** Waiting for unfinished jobs....
  Der Befehl "C:\Users\User" ist entweder falsch geschrieben oder
  konnte nicht gefunden werden. (Command misspelled or not found)
  make[2]: *** [aws-lc/crypto/fipsmodule/CMakeFiles/fipsmodule.dir/build.make:128: aws-lc/crypto/fipsmodule/CMakeFiles/fipsmodule.dir/aesni-gcm-x86_64.asm.obj] Error 1
  make[1]: *** [CMakeFiles/Makefile2:301: aws-lc/crypto/fipsmodule/CMakeFiles/fipsmodule.dir/all] Error 2
  make[1]: *** Waiting for unfinished jobs....
  Der Befehl "C:\Users\User" ist entweder falsch geschrieben oder
  konnte nicht gefunden werden. (Command misspelled or not found)
  make[2]: *** [aws-lc/crypto/CMakeFiles/crypto_objects.dir/build.make:3708: aws-lc/crypto/CMakeFiles/crypto_objects.dir/chacha/chacha-x86_64.asm.obj] Error 1
  make[2]: *** Waiting for unfinished jobs....
  Der Befehl "C:\Users\User" ist entweder falsch geschrieben oder
  konnte nicht gefunden werden. (Command misspelled or not found)
  make[2]: *** [aws-lc/crypto/CMakeFiles/crypto_objects.dir/build.make:3713: aws-lc/crypto/CMakeFiles/crypto_objects.dir/cipher_extra/chacha20_poly1305_x86_64.asm.obj] Error 1
  Der Befehl "C:\Users\User" ist entweder falsch geschrieben oder
  konnte nicht gefunden werden. (Command misspelled or not found)
  make[2]: *** [aws-lc/crypto/CMakeFiles/crypto_objects.dir/build.make:3718: aws-lc/crypto/CMakeFiles/crypto_objects.dir/cipher_extra/aes128gcmsiv-x86_64.asm.obj] Error 1
  make[1]: *** [CMakeFiles/Makefile2:237: aws-lc/crypto/CMakeFiles/crypto_objects.dir/all] Error 2
  make: *** [Makefile:136: all] Error 2
  thread 'main' panicked at C:\Users\User Name\.cargo\registry\src\index.crates.io-6f17d22bba15001f\cmake-0.1.51\src/lib.rs:1100:5:

  command did not execute successfully, got: exit code: 2

  build script failed, must exit now
justsmth commented 9 hours ago

I've dug into this some more. The failure only occurs when using the prebuilt NASM objects. This type of build invokes a batch script to retrieve the prebuilt objects. However, I think the build fails just before the script gets executed.

Here's the command and some output:

% AWS_LC_SYS_PREBUILT_NASM=1 cargo build --target x86_64-pc-windows-gnu
...
  Copying platform assembly files from C:/Users/Administrator/tmp/has some spaces/aws-lc-rs/aws-lc-sys/aws-lc/generated-src/win-x86_64/crypto/ to C:/Users/Administrator/tmp/has some spaces/aws-lc-rs/target/x86_64-pc-windows-gnu/debug/build/aws-lc-sys-3bcdfcf12c78d2e3/out/build/aws-lc/crypto
  'C:\Users\Administrator\tmp\has' is not recognized as an internal or external command,
  operable program or batch file.
  make[2]: *** [aws-lc/crypto/fipsmodule/CMakeFiles/fipsmodule.dir/build.make:117: aws-lc/crypto/fipsmodule/CMakeFiles/fipsmodule.dir/aesni-gcm-avx512.asm.obj] Error 1
  make[2]: *** Waiting for unfinished jobs....
...

Unless I'm reading this wrong, Make is choking on line 117 of build.make (the last line listed below):

aws-lc/crypto/fipsmodule/CMakeFiles/fipsmodule.dir/aesni-gcm-avx512.asm.obj: aws-lc/crypto/fipsmodule/aesni-gcm-avx512.asm
        @$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --green --progress-dir="/C/Users/Administrator/tmp/has some spaces/aws-lc-rs/target/x86_64-pc-windows-gnu/debug/build/aws-lc-sys-3bcdfcf12c78d2e3/out/build/CMakeFiles" --progress-num=$(CMAKE_PROGRESS_4) "Building ASM_NASM object aws-lc/crypto/fipsmodule/CMakeFiles/fipsmodule.dir/aesni-gcm-avx512.asm.obj"
        cd "/C/Users/Administrator/tmp/has some spaces/aws-lc-rs/target/x86_64-pc-windows-gnu/debug/build/aws-lc-sys-3bcdfcf12c78d2e3/out/build/aws-lc/crypto/fipsmodule" && "/C/Users/Administrator/tmp/has some spaces/aws-lc-rs/aws-lc-sys/builder/prebuilt-nasm.bat" $(ASM_NASM_DEFINES) $(ASM_NASM_INCLUDES) $(ASM_NASM_FLAGS) -f win64 -o CMakeFiles/fipsmodule.dir/aesni-gcm-avx512.asm.obj "/C/Users/Administrator/tmp/has some spaces/aws-lc-rs/target/x86_64-pc-windows-gnu/debug/build/aws-lc-sys-3bcdfcf12c78d2e3/out/build/aws-lc/crypto/fipsmodule/aesni-gcm-avx512.asm"