Skip to content

Windows build failed if the build path location is too long  #1733

@stormshield-gt

Description

@stormshield-gt

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:

  • CPU architecture: x86-64
  • OS: Windows 10
Build log
 -- 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 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.30/Modules/CMakeTestCCompiler.cmake:67 (message):
    The C compiler

      "C:/Program Files (x86)/Microsoft Visual Studio/2022/BuildTools/VC/Tools/MSVC/14.40.33807/bin/Hostx64/x64/cl.exe"

    is not able to compile a simple test program.

    It fails with the following output:

      Change Dir: 'C:/Users/stormshield/Documents/Git/my-project/build/target/target-x86_64-pc-windows-msvc/x86_64-pc-windows-msvc/debug/build/aws-lc-sys-7068532a0b4ccf5c/out/build/CMakeFiles/C
MakeScratch/TryCompile-an6xjf'

      Run Build Command(s): "C:/Program Files (x86)/Microsoft Visual Studio/2022/BuildTools/MSBuild/Current/Bin/amd64/MSBuild.exe" cmTC_8400d.vcxproj /p:Configuration=Debug /p:Platform=x64 /
p:VisualStudioVersion=17.0 /v:n
      MSBuild version 17.10.4+10fbfbf2e for .NET Framework
      Build started 8/1/2024 10:06:36 AM.

      Project "C:\Users\stormshield\Documents\Git\my-project\build\target\target-x86_64-pc-windows-msvc\x86_64-pc-windows-msvc\debug\build\aws-lc-sys-7068532a0b4ccf5c\out\build\CMakeFiles\CMake
Scratch\TryCompile-an6xjf\cmTC_8400d.vcxproj" on node 1 (default targets).
      PrepareForBuild:
        Creating directory "cmTC_8400d.dir\Debug\".
        Structured output is enabled. The formatting of compiler diagnostics will reflect the error hierarchy. See https://aka.ms/cpp/structured-output for more details.
        Creating directory "C:\Users\stormshield\Documents\Git\my-project\build\target\target-x86_64-pc-windows-msvc\x86_64-pc-windows-msvc\debug\build\aws-lc-sys-7068532a0b4ccf5c\out\build\CMa
keFiles\CMakeScratch\TryCompile-an6xjf\Debug\".
        Creating directory "cmTC_8400d.dir\Debug\cmTC_8400d.tlog\".
      InitializeBuildStatus:
        Creating "cmTC_8400d.dir\Debug\cmTC_8400d.tlog\unsuccessfulbuild" because "AlwaysCreate" was specified.
        Touching "cmTC_8400d.dir\Debug\cmTC_8400d.tlog\unsuccessfulbuild".
      ClCompile:
        C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.40.33807\bin\HostX64\x64\CL.exe /c /Zi /nologo /W1 /WX- /diagnostics:column /Od /Ob0 /D _MBCS /D "CMAK
E_INTDIR=\"Debug\"" /RTC1 /MDd /GS /fp:precise /Zc:wchar_t /Zc:forScope /Zc:inline /Fo"cmTC_8400d.dir\Debug\\" /Fd"cmTC_8400d.dir\Debug\vc143.pdb" /external:W1 /Gd /TC /errorReport:queue  -B
repro "C:\Users\stormshield\Documents\Git\my-project\build\target\target-x86_64-pc-windows-msvc\x86_64-pc-windows-msvc\debug\build\aws-lc-sys-7068532a0b4ccf5c\out\build\CMakeFiles\CMakeScratch\
TryCompile-an6xjf\testCCompiler.c"
        testCCompiler.c
      Link:
        C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.40.33807\bin\HostX64\x64\link.exe /ERRORREPORT:QUEUE /OUT:"C:\Users\stormshield\Documents\Git\my-project\
build\target\target-x86_64-pc-windows-msvc\x86_64-pc-windows-msvc\debug\build\aws-lc-sys-7068532a0b4ccf5c\out\build\CMakeFiles\CMakeScratch\TryCompile-an6xjf\Debug\cmTC_8400d.exe" /INCREMENT
AL /ILK:"cmTC_8400d.dir\Debug\cmTC_8400d.ilk" /NOLOGO kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib /MANIFEST /MANIFEST
UAC:"level='asInvoker' uiAccess='false'" /manifest:embed /DEBUG /PDB:"C:/Users/stormshield/Documents/Git/my-project/build/target/target-x86_64-pc-windows-msvc/x86_64-pc-windows-msvc/debug/build
/aws-lc-sys-7068532a0b4ccf5c/out/build/CMakeFiles/CMakeScratch/TryCompile-an6xjf/Debug/cmTC_8400d.pdb" /SUBSYSTEM:CONSOLE /TLBID:1 /DYNAMICBASE /NXCOMPAT /IMPLIB:"C:/Users/stormshield/Docume
nts/Git/my-project/build/target/target-x86_64-pc-windows-msvc/x86_64-pc-windows-msvc/debug/build/aws-lc-sys-7068532a0b4ccf5c/out/build/CMakeFiles/CMakeScratch/TryCompile-an6xjf/Debug/cmTC_8400d
.lib" /MACHINE:X64  /machine:x64 cmTC_8400d.dir\Debug\testCCompiler.obj
      FileTracker : error FTK1011: could not create the new file tracking log file: C:\Users\stormshield\Documents\Git\my-project\build\target\target-x86_64-pc-windows-msvc\x86_64-pc-windows-ms
vc\debug\build\aws-lc-sys-7068532a0b4ccf5c\out\build\CMakeFiles\CMakeScratch\TryCompile-an6xjf\cmTC_8400d.dir\Debug\cmTC_8400d.tlog\link-cvtres.read.1.tlog. The system cannot find the path s
pecified. [C:\Users\stormshield\Documents\Git\my-project\build\target\target-x86_64-pc-windows-msvc\x86_64-pc-windows-msvc\debug\build\aws-lc-sys-7068532a0b4ccf5c\out\build\CMakeFiles\CMakeScra
tch\TryCompile-an6xjf\cmTC_8400d.vcxproj]



      FileTracker : error FTK1011: could not create the new file tracking log file: C:\Users\stormshield\Documents\Git\my-project\build\target\target-x86_64-pc-windows-msvc\x86_64-pc-windows-ms
vc\debug\build\aws-lc-sys-7068532a0b4ccf5c\out\build\CMakeFiles\CMakeScratch\TryCompile-an6xjf\cmTC_8400d.dir\Debug\cmTC_8400d.tlog\link-cvtres.write.1.tlog. The system cannot find the path
specified. [C:\Users\stormshield\Documents\Git\my-project\build\target\target-x86_64-pc-windows-msvc\x86_64-pc-windows-msvc\debug\build\aws-lc-sys-7068532a0b4ccf5c\out\build\CMakeFiles\CMakeScr
atch\TryCompile-an6xjf\cmTC_8400d.vcxproj]



      Done Building Project "C:\Users\stormshield\Documents\Git\my-project\build\target\target-x86_64-pc-windows-msvc\x86_64-pc-windows-msvc\debug\build\aws-lc-sys-7068532a0b4ccf5c\out\build\CM
akeFiles\CMakeScratch\TryCompile-an6xjf\cmTC_8400d.vcxproj" (default targets) -- FAILED.

      Build FAILED.

      "C:\Users\stormshield\Documents\Git\my-project\build\target\target-x86_64-pc-windows-msvc\x86_64-pc-windows-msvc\debug\build\aws-lc-sys-7068532a0b4ccf5c\out\build\CMakeFiles\CMakeScratch\
TryCompile-an6xjf\cmTC_8400d.vcxproj" (default target) (1) ->
      (Link target) ->
        FileTracker : error FTK1011: could not create the new file tracking log file: C:\Users\stormshield\Documents\Git\my-project\build\target\target-x86_64-pc-windows-msvc\x86_64-pc-windows-
msvc\debug\build\aws-lc-sys-7068532a0b4ccf5c\out\build\CMakeFiles\CMakeScratch\TryCompile-an6xjf\cmTC_8400d.dir\Debug\cmTC_8400d.tlog\link-cvtres.read.1.tlog. The system cannot find the path
 specified. [C:\Users\stormshield\Documents\Git\my-project\build\target\target-x86_64-pc-windows-msvc\x86_64-pc-windows-msvc\debug\build\aws-lc-sys-7068532a0b4ccf5c\out\build\CMakeFiles\CMakeSc
ratch\TryCompile-an6xjf\cmTC_8400d.vcxproj]
        FileTracker : error FTK1011: could not create the new file tracking log file: C:\Users\stormshield\Documents\Git\my-project\build\target\target-x86_64-pc-windows-msvc\x86_64-pc-windows-
msvc\debug\build\aws-lc-sys-7068532a0b4ccf5c\out\build\CMakeFiles\CMakeScratch\TryCompile-an6xjf\cmTC_8400d.dir\Debug\cmTC_8400d.tlog\link-cvtres.write.1.tlog. The system cannot find the pat
h specified. [C:\Users\stormshield\Documents\Git\my-project\build\target\target-x86_64-pc-windows-msvc\x86_64-pc-windows-msvc\debug\build\aws-lc-sys-7068532a0b4ccf5c\out\build\CMakeFiles\CMakeS
cratch\TryCompile-an6xjf\cmTC_8400d.vcxproj]

          0 Warning(s)
          2 Error(s)

      Time Elapsed 00:00:00.79


    CMake will not be able to correctly generate this project.
  Call Stack (most recent call first):
    CMakeLists.txt:7 (enable_language)

From my understanding, they are several solutions to this problem:

Please let me know what is your thought on this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions