Closed stormshield-gt closed 2 weeks ago
If I force the CMake Generator to be Ninja instead of CMake's Visual Studio generator, it compiles but I get a linker error
The linker error was due to the fact that the CRT was embedded both by my rust internal library and by aws-lc
.
So compiling with ninja works for me. Sorry for the noise.
I guess there is still the problem of max path with the CMake's Visual Studio generator, but the docs suggest that it's not well tested so it's fine.
Maybe this should be reported to aws-lc-rs
that use this generator by default on windows to not force the install of ninja ?
Thanks for the detailed write up.
I guess there is still the problem of max path with the CMake's Visual Studio generator, but the docs suggest that it's not well tested so it's fine.
Do you have a link for this documentation?
Maybe this should be reported to aws-lc-rs that use this generator by default on windows to not force the install of ninja ?
We updated our documentation in https://github.com/aws/aws-lc-rs/pull/465 and the aws-lc-rs build only requires Ninja for the FIPS build.
I did some googling on this. The "MSBuild" (i.e., CMake generator) part of the problem has been resolved, but other tooling around MSVC might still fail when path names exceed 260 chars. This link appears to be the relevant top-level tracking issue for Visual Studio.
Do you have a link for this documentation?
I was referring to this part of the documentation that mention that the CMake's Visual Studio generator is not tested regularly:
On Windows, CMake's Visual Studio generator may also work, but it not tested regularly and requires recent versions of CMake for assembly support.
I did some googling on this. The "MSBuild" (i.e., CMake generator) part of the problem has https://github.com/dotnet/msbuild/issues/53#issuecomment-459062618, but other tooling around MSVC might still fail when path names exceed 260 chars. This link appears to be the relevant top-level tracking issue for Visual Studio.
Thanks a lot for digging this up! So it's an upstream problem that we cannot fix here. Note that might happen more frequently with aws-lc-rs
, because how nested build artifacts are by default in the Rust target directory, creating long paths.
The workaround of using Ninja
, by setting the environment variable $env:CMAKE_GENERATOR="Ninja"
and make sure we have not embedded the CRT twice is fine for us. Feel free to close the issue. Thanks a lot for your help
Edit: For completion, overriding the CMake
generator used by aws-lc-rs
is possible because the cmake crate used in the build script support this natively. That's why it's possible to do so even if there is no logic for it inside the build script of the aws-lc-sys
crate.
Problem:
On every Windows target, the project doesn't compile if the path to the build directory is too long, because of the Windows maximum path length limitation. To reproduce you have to build inside several nested folders, so the path will be greater than 260 characters.
The current workaround is to set the build directory closer to the root of the file system, but this is not easily discoverable and reliable enough.
Relevant details
AWS-LC commit: (47333e1) (through
aws-lc-sys
0.20.0)System information:
Build log
```text -- Selecting Windows SDK version 10.0.22621.0 to target Windows 10.0.19045. -- The C compiler identification is MSVC 19.40.33813.0 -- Detecting C compiler ABI info -- Detecting C compiler ABI info - failed -- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2022/BuildTools/VC/Tools/MSVC/14.40.33807/bin/Hostx64/x64/cl.exe -- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2022/BuildTools/VC/Tools/MSVC/14.40.33807/bin/Hostx64/x64/cl.exe - broken -- Configuring incomplete, errors occurred! --- stderr CMake Deprecation Warning at CMakeLists.txt:4 (cmake_minimum_required): Compatibility with CMake < 3.5 will be removed from a future version of CMake. Update the VERSION argumentFrom my understanding, they are several solutions to this problem:
\\?\
" to every path to remove the limitation. For instance, this was added to the rust standard library in https://github.com/rust-lang/rust/pull/89174aws-lc-rs
, as described in Windows doc.CMake
since version 3.4 know how to handle*.manifest
files listed as source filesPlease let me know what is your thought on this.