Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ffile-prefix-map argument not quoted #599

Closed
s-mayrh opened this issue Nov 16, 2024 · 7 comments
Closed

ffile-prefix-map argument not quoted #599

s-mayrh opened this issue Nov 16, 2024 · 7 comments
Assignees

Comments

@s-mayrh
Copy link

s-mayrh commented Nov 16, 2024

Problem:

I tried to build trunk on windows-gnu toolchain using the rustls feature flag. This added the aws-lc-sys crate which tries to test the C compiler via cmake, but fails because the argument -ffile-prefix-map is not properly quoted when there are backslashes and spaces in the path.

See the running: "cmake.exe" arguments below where the ffile-prefix-map argument is correctly quoted (except the space) but cmake seems to have removed the quotation when passed to cc.exe. I was about to report this to CMake, but their rules say

If you are having trouble building a specific third-party project
that uses CMake, ask for help in that project's forums first.

Relevant details

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

System information:

  • CPU architecture: x86-64
  • CPU name: Intel Atom
  • OS: Windows 10
  • CMake: 3.31.0
  • Toolchain: stable-x86_64-pc-windows-gnu with MSYS2

Build log:

[..]
running: "cmake.exe" "C:\\Users\\User Name\\.cargo\\registry\\src\\index.crates.io-6f17d22bba15001f\\aws-lc-sys-0.23.0" "-G" "MSYS Makefiles" "-DBUILD_SHARED_LIBS=0" "-DCMAKE_BUILD_TYPE=release" "-DBORINGSSL_PREFIX=aws_lc_0_23_0_" "-DBORINGSSL_PREFIX_HEADERS=C:\\Users\\User Name\\.cargo\\registry\\src\\index.crates.io-6f17d22bba15001f\\aws-lc-sys-0.23.0\\generated-include" "-DBUILD_TESTING=OFF" "-DBUILD_LIBSSL=OFF" "-DDISABLE_PERL=ON" "-DDISABLE_GO=ON" "-DCMAKE_ASM_NASM_COMPILER=C:/Users/User Name/.cargo/registry/src/index.crates.io-6f17d22bba15001f/aws-lc-sys-0.23.0/builder/prebuilt-nasm.bat" "-DCMAKE_INSTALL_PREFIX=C:\\Users\\ANDIGE~1\\AppData\\Local\\Temp\\cargo-installOwihJl\\release\\build\\aws-lc-sys-1b7c6c9a5b906e49\\out" "-DCMAKE_C_FLAGS= -ffunction-sections -fdata-sections -m64 -ffunction-sections -fdata-sections -m64 -std=c11 -I C:\\Users\\User Name\\.cargo\\registry\\src\\index.crates.io-6f17d22bba15001f\\aws-lc-sys-0.23.0\\generated-include -I C:\\Users\\User Name\\.cargo\\registry\\src\\index.crates.io-6f17d22bba15001f\\aws-lc-sys-0.23.0\\include -I C:\\Users\\User Name\\.cargo\\registry\\src\\index.crates.io-6f17d22bba15001f\\aws-lc-sys-0.23.0\\aws-lc\\include -I C:\\Users\\User Name\\.cargo\\registry\\src\\index.crates.io-6f17d22bba15001f\\aws-lc-sys-0.23.0\\aws-lc\\third_party\\s2n-bignum\\include -Wall -Wextra -Wno-unused-parameter -pthread -ffile-prefix-map=C:\\Users\\User Name\\.cargo\\registry\\src\\index.crates.io-6f17d22bba15001f\\aws-lc-sys-0.23.0= -D_XOPEN_SOURCE=700 -DBORINGSSL_IMPLEMENTATION=1 -DBORINGSSL_PREFIX=aws_lc_0_23_0" "-DCMAKE_CXX_FLAGS= -ffunction-sections -fdata-sections -m64" "-DCMAKE_ASM_FLAGS= -ffunction-sections -fdata-sections -m64 -ffunction-sections -fdata-sections -m64 -std=c11 -I C:\\Users\\User Name\\.cargo\\registry\\src\\index.crates.io-6f17d22bba15001f\\aws-lc-sys-0.23.0\\generated-include -I C:\\Users\\User Name\\.cargo\\registry\\src\\index.crates.io-6f17d22bba15001f\\aws-lc-sys-0.23.0\\include -I C:\\Users\\User Name\\.cargo\\registry\\src\\index.crates.io-6f17d22bba15001f\\aws-lc-sys-0.23.0\\aws-lc\\include -I C:\\Users\\User Name\\.cargo\\registry\\src\\index.crates.io-6f17d22bba15001f\\aws-lc-sys-0.23.0\\aws-lc\\third_party\\s2n-bignum\\include -Wall -Wextra -Wno-unused-parameter -pthread -ffile-prefix-map=C:\\Users\\User Name\\.cargo\\registry\\src\\index.crates.io-6f17d22bba15001f\\aws-lc-sys-0.23.0= -D_XOPEN_SOURCE=700 -DBORINGSSL_IMPLEMENTATION=1 -DBORINGSSL_PREFIX=aws_lc_0_23_0" "--no-warn-unused-cli"
  Not searching for unused variables given on the command line.
  -- The C compiler identification is GNU 13.1.0
  -- Detecting C compiler ABI info
  -- Detecting C compiler ABI info - failed
  -- Check for working C compiler: C:/msys64/ucrt64/bin/cc.exe
  -- Check for working C compiler: C:/msys64/ucrt64/bin/cc.exe - broken
  -- Configuring incomplete, errors occurred!

  --- stderr
  Evaluating: AWS_LC_SYS_PREBUILT_NASM='true'
  Parsed: AWS_LC_SYS_PREBUILT_NASM=true
  CMake Deprecation Warning at CMakeLists.txt:4 (cmake_minimum_required):
    Compatibility with CMake < 3.10 will be removed from a future version of
    CMake.

    Update the VERSION argument <min> value or use a ...<max> suffix to tell
    CMake that the project does not need compatibility with older versions.


  CMake Error at C:/Program Files/CMake/share/cmake-3.31/Modules/CMakeTestCCompiler.cmake:67 (message):
    The C compiler

      "C:/msys64/ucrt64/bin/cc.exe"

    is not able to compile a simple test program.

    It fails with the following output:

      Change Dir: 'C:/Users/User Name/AppData/Local/Temp/cargo-installOwihJl/release/build/aws-lc-sys-1b7c6c9a5b906e49/out/build/CMakeFiles/CMakeScratch/TryCompile-fwrd68'

      Run Build Command(s): "C:/Program Files/CMake/bin/cmake.exe" -E env VERBOSE=1 C:/msys64/usr/bin/make.exe -f Makefile cmTC_4d6b5/fast
      /usr/bin/make  -f CMakeFiles/cmTC_4d6b5.dir/build.make CMakeFiles/cmTC_4d6b5.dir/build
      make[1]: Entering directory '/c/Users/User Name/AppData/Local/Temp/cargo-installOwihJl/release/build/aws-lc-sys-1b7c6c9a5b906e49/out/build/CMakeFiles/CMakeScratch/TryCompile-fwrd68'
      Building C object CMakeFiles/cmTC_4d6b5.dir/testCCompiler.c.obj
      /C/msys64/ucrt64/bin/cc.exe   -ffunction-sections -fdata-sections -m64 -ffunction-sections -fdata-sections -m64 -std=c11 -I C:\Users\User Name\.cargo\registry\src\index.crates.io-6f17d22bba15001f\aws-lc-sys-0.23.0\generated-include -I C:\Users\User Name\.cargo\registry\src\index.crates.io-6f17d22bba15001f\aws-lc-sys-0.23.0\include -I C:\Users\User Name\.cargo\registry\src\index.crates.io-6f17d22bba15001f\aws-lc-sys-0.23.0\aws-lc\include -I C:\Users\User Name\.cargo\registry\src\index.crates.io-6f17d22bba15001f\aws-lc-sys-0.23.0\aws-lc\third_party\s2n-bignum\include -Wall -Wextra -Wno-unused-parameter -pthread -ffile-prefix-map=C:\Users\User Name\.cargo\registry\src\index.crates.io-6f17d22bba15001f\aws-lc-sys-0.23.0= -D_XOPEN_SOURCE=700 -DBORINGSSL_IMPLEMENTATION=1 -DBORINGSSL_PREFIX=aws_lc_0_23_0  -o CMakeFiles/cmTC_4d6b5.dir/testCCompiler.c.obj -c "/C/Users/User Name/AppData/Local/Temp/cargo-installOwihJl/release/build/aws-lc-sys-1b7c6c9a5b906e49/out/build/CMakeFiles/CMakeScratch/TryCompile-fwrd68/testCCompiler.c"
      cc1.exe: error: invalid argument 'C:UsersUser' to '-ffile-prefix-map'
      cc1.exe: error: invalid argument 'C:UsersUser' to '-ffile-prefix-map'
      cc1.exe: error: invalid argument 'C:UsersUser' to '-ffile-prefix-map'
      make[1]: *** [CMakeFiles/cmTC_4d6b5.dir/build.make:81: CMakeFiles/cmTC_4d6b5.dir/testCCompiler.c.obj] Error 1
      make[1]: Leaving directory '/c/Users/User Name/AppData/Local/Temp/cargo-installOwihJl/release/build/aws-lc-sys-1b7c6c9a5b906e49/out/build/CMakeFiles/CMakeScratch/TryCompile-fwrd68'
      make: *** [Makefile:133: cmTC_4d6b5/fast] Error 2
[..]
@s-mayrh
Copy link
Author

s-mayrh commented Nov 16, 2024

I made contradicting statements before during edits about what gets quoted correctly

I saw in the cmake.exe arguments that spaces are not backslash quoted while backslashes were, that got me confused. Nevertheless according to the errors neither spaces nor backslashes were correctly passed to cc.exe

@justsmth
Copy link
Contributor

justsmth commented Nov 18, 2024

Hello!

I've started looking into this. From my initial testing, the issue appears to be (more generally) that the CMake build for AWS-LC doesn't tolerate spaces in the path of the source files. (I believe you're also correct that the compiler options also need to be quoted.) But I need to do some more digging to better understand what the best fix should be.

Thanks for letting us know about this! We hope to have a fix for this build issue soon.

@justsmth
Copy link
Contributor

justsmth commented Nov 22, 2024

We have now released aws-lc-rs v1.11.1 that addresses this problem. This issue will now be closed. Feel free to reopen this issue or open a new issue if you have any problems after upgrading. Thanks again for reporting this to us!

@s-mayrh
Copy link
Author

s-mayrh commented Nov 23, 2024

Thank you! It's one step closer

I was building with aws-lc-sys@0.23.1 now – is this the new version? CMake test succeeds, but when the build process reaches 91%
Building ASM_NASM object … aes128gcmsiv-x86_64.asm.obj
it fails again with a similarly truncated path

 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
Copy link
Contributor

justsmth commented Nov 23, 2024

Hello! Sorry about this. One thing our test coverage appears be missing is testing without NASM installed (when spaces are in the path). If you install NASM (then optionally set AWS_LC_SYS_PREBUILT_NASM to 0) in the environment, this might(?) address the issue.

I'll take a closer look on Monday. Thanks for following up with us on this!

@justinwsmith
Copy link
Contributor

Ok, I was able to reproduce this on Windows -- the issue seems to be specific to the x86_64-pc-windows-gnu target, as I couldn't reproduce it when targeting x86_64-pc-windows-msvc (with or without use of prebuilt NASM binaries) even when using the same workspace. I'll try to reproduce this with our CI, so we can verify a fix.

@justsmth
Copy link
Contributor

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants