Long git directory name causes error C1083 when building coreclr tests (cl.exe)

Open
#110,407 17 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
42/100
Issue type
Bug
Clarity
Needs clarification
Activity status
Quiet
Tech stack
cmake, cpp

Research direction

Reproduce the Windows x64 failure with a long checkout path using src\tests\build.cmd /p:LibrariesConfiguration=Debug, then inspect the generated CMake/Ninja command for the ForeignThreadRevPInvokeUnhandled test. The work is done when the coreclr tests build successfully from the reported path without the cl.exe C1083 error.

Written by the indexing model from the issue text.

Description

area-Infrastructure

Having a long directory name causes issues when building the coreclr tests. I verified that long paths are enabled in both git and the registry.

Repro (Windows x64)

  • Create a long directory name such as C:\git\ThisIsSomewhatOfaLongName
  • Clone runtime repo into that
  • build -s clr+libs (this works)
  • src\tests\build.cmd /p:LibrariesConfiguration=Debug (this fails with the error below)

Error:

[219/384] Building CXX object baseservices\exceptions\UnhandledExceptionHandler\ForeignThreadRevPInvokeUnhandled\CMakeFiles\ForeignThreadRevPInvokeUnhandledNative.dir\ForeignThreadRevPInvokeUnhandledNative.cpp.obj
FAILED: baseservices/exceptions/UnhandledExceptionHandler/ForeignThreadRevPInvokeUnhandled/CMakeFiles/ForeignThreadRevPInvokeUnhandledNative.dir/ForeignThreadRevPInvokeUnhandledNative.cpp.obj
C:\PROGRA~1\MIB055~1\2022\Preview\VC\Tools\MSVC\1443~1.346\bin\Hostx64\x64\cl.exe  /nologo /TP -DForeignThreadRevPInvokeUnhandledNative_EXPORTS -DHOST_64BIT -DHOST_AMD64 -DHOST_WINDOWS -DNDEBUG -DTARGET_64BIT -DTARGET_AMD64 -DTARGET_WINDOWS -DURTBLDENV_FRIENDLY=Retail -DWINDOWS -D_FILE_OFFSET_BITS=64 -D_TIME_BITS=64 -IC:\git\ThisIsSomewhatOfaLongName\src\native -IC:\git\ThisIsSomewhatOfaLongName\src\tests\Common\Platform /DWIN32 /D_WINDOWS  /GR- /O2 /Ob2 /DNDEBUG -MT /GL /Ox /EHa /nologo /W4 /WX /Oi /Oy- /Gm- /Zp8 /Gy /GS /fp:precise /FC /MP /Zm200 /Zc:strictStrings /Zc:wchar_t /Zc:inline /Zc:forScope /wd4065 /wd4100 /wd4127 /wd4131 /wd4189 /wd4200 /wd4201 /wd4206 /wd4239 /wd4245 /wd4291 /wd4310 /wd4324 /wd4366 /wd4456 /wd4457 /wd4458 /wd4459 /wd4463 /wd4505 /wd4702 /wd4706 /wd4733 /wd4815 /wd4838 /wd4918 /wd4960 /wd4961 /wd5105 /wd5205 /we4007 /we4013 /we4102 /we4551 /we4640 /we4806 /we4055 /we4146 /we4242 /we4244 /we4267 /we4302 /we4308 /we4509 /we4510 /we4532 /we4533 /we4610 /we4611 /we4700 /we4701 /we4703 /we4789 /we4995 /we4996 /w34092 /w34121 /w34125 /w34130 /w34132 /w34212 /w34530 /w35038 /w44177 /Zi /ZH:SHA_256 /source-charset:utf-8 /guard:cf /guard:ehcont -wd4100 -wd4242 -wd4244 -wd4514 -wd4625 -wd4626 -wd4668 -wd4710 -wd4711 -wd4774 -wd4820 -wd5025 -wd5026 -wd5027 -wd5039 /showIncludes /Fobaseservices\exceptions\UnhandledExceptionHandler\ForeignThreadRevPInvokeUnhandled\CMakeFiles\ForeignThreadRevPInvokeUnhandledNative.dir\ForeignThreadRevPInvokeUnhandledNative.cpp.obj /Fdbaseservices\exceptions\UnhandledExceptionHandler\ForeignThreadRevPInvokeUnhandled\CMakeFiles\ForeignThreadRevPInvokeUnhandledNative.dir\ /FS -c C:\git\ThisIsSomewhatOfaLongName\src\tests\baseservices\exceptions\UnhandledExceptionHandler\ForeignThreadRevPInvokeUnhandled\ForeignThreadRevPInvokeUnhandledNative.cpp
C:\git\ThisIsSomewhatOfaLongName\src\tests\baseservices\exceptions\UnhandledExceptionHandler\ForeignThreadRevPInvokeUnhandled\ForeignThreadRevPInvokeUnhandledNative.cpp : fatal error C1083: Cannot open compiler generated file: '': Invalid argument
[240/384] Building CXX object profiler\native\CMakeFiles\Profiler.dir\rejitprofiler\rejitprofiler.cpp.obj
ninja: build stopped: subcommand failed.
BUILDTEST: Error: native test build failed.

I did not attempt to diagnose the root cause but note that the path C:\git\ThisIsSomewhatOfaLongName\src\tests\baseservices\exceptions\UnhandledExceptionHandler\ForeignThreadRevPInvokeUnhandled\ForeignThreadRevPInvokeUnhandledNative.cpp is 169 characters, short of MAX_PATH (260).

Dominant language
C#
Stars
18.3k
Forks
5.6k
PR merge metrics
PR metrics pending

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from dotnet/runtime

All issues in dotnet/runtime

Similar issues

More C# issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.