Bug 16542

Summary: Toolchain SDK built with mingw does not support long paths
Product: [Build System, Metadata & Runtime] Other YP Layers Reporter: Mark Hatle <mark.hatle>
Component: meta-mingwAssignee: Joshua Watt <JPEWhacker>
Status: NEW --- QA Contact:
Severity: normal    
Priority: Undecided    
Version: 6.0.9   
Target Milestone: 0.0.0   
Hardware: All   
OS: Multiple   
Whiteboard:
OS type for building Yocto: --- Type of Regression: ---
Verified: Documentation change: Don't know

Description Mark Hatle 2026-12-01 17:08:47 UTC
Installing a mingw built toolchain in a deep windows path can fail to function.  There is apparently some sort of value called "LongPathsEnabled=1" that can be set in the windows registry.

I do not currently have a Windows machine, so I'm attempting to transcribe the report for a user of the SDK I build.

Reported issue:

The GCC cross-compilers are built against the legacy MSVCRT C runtime and do not carry a longPathAware application manifest. As a result cc1.exe / cc1plus.exe / ar.exe cannot open source, dependency, or object files when the absolute path exceeds the Windows MAX_PATH limit of 260 characters — even though LongPathsEnabled=1 is set in the registry. This breaks the CMake/Ninja-based embeddedsw BSP build for any moderately nested workspace.

Environment:

Windows 10/11 with HKLM\SYSTEM\CurrentControlSet\Control\FileSystem\LongPathsEnabled = 0x1 (verified)
CMake 4.0.1 — longPathAware, works
Upstream Ninja 1.12.1 — longPathAware, works

(note I don't think the cmake or ninja they are using is coming from the SDK.)

Steps to Reproduce:

Enable Windows long paths (LongPathsEnabled=1), reboot.
Create a source file test.c (int main(void){return 0;}) at a path 348 characters long.
Confirm the file exists (type "\\?\<longpath>\test.c" prints it).
Compile directly, no CMake/Ninja:
aarch64-none-elf-gcc.exe -c "<longpath>\test.c" -o "<longpath>\test.o"

Result:

cc1.exe: fatal error: C:\...\longpath_compile_test\test.c: No such file or directory
compilation terminated.

Root Cause:

The compiler back-end binaries (cc1.exe, cc1plus.exe) and binutils (ar.exe, ranlib.exe) are linked against MSVCRT, whose fopen()/open()/stat() truncate at MAX_PATH. Neither the LongPathsEnabled registry key nor an added longPathAware manifest fixes MSVCRT file I/O — the manifest only affects Win32 CreateProcess. This is GCC Bugzilla 
#107974 (still open) and MSYS2 issue #29471, where the fix was to rebuild against UCRT (MSYS2 UCRT64 works; MINGW64/MSVCRT does not).

References:

GCC Bugzilla 
#107974 — https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107974
MSYS2 mingw-packages #29471 — https://github.com/msys2/mingw-packages/issues/29471
Ninja v1.12.0 long path support — https://github.com/ninja-build/ninja/releases/tag/v1.12.0