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

Open
s-mayrh opened this issue Nov 16, 2024 · 2 comments
Open

ffile-prefix-map argument not quoted #599

s-mayrh opened this issue Nov 16, 2024 · 2 comments
Assignees
Labels
build problem Build failure

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: [email protected]

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 justsmth self-assigned this Nov 19, 2024
@justsmth justsmth added the build problem Build failure label Nov 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build problem Build failure
Projects
None yet
Development

No branches or pull requests

2 participants