You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Windows long path issues with the exported depfile #1162
Hi! I'm not sure if this is an issue from cbindgen or from make itself, but while using corrosion-rs with a CMake project, corrosion is capable of creating CMake targets to automatically generate C bindings using cbindgen. However the --depfile option used outputs Windows long paths, which generates errors when using the MinGW Makefiles as a generator.
If this is a make limitation that cbindgen can't bypass, maybe a workaround would to only use long paths when the outputted files needs it, and use regular path by default.
The depfile case sounds like it needs a generator-specific path normalization decision. If MinGW Makefiles cannot consume \\?\ long paths, cbindgen could either emit ordinary Windows paths when writing Make-compatible depfiles, or provide an option to control long-path syntax in depfile output. A regression fixture with a long Windows path and a dependency containing spaces would make the behavior much easier to lock down.
This doesn't only affect MinGW Makefiles. It also affects the Ninja generator.
Sample error message:
ninja: error: FindFirstFileExA(/C:/some/path/to/a/project): The filename, directory name, or volume label syntax is incorrect.
Also all cbindgen tests in tests/tests.rs fail on Windows for me (doesn't matter if long path support enabled or not).
For example:
thread 'test_abi_string' (36580) panicked at tests\tests.rs:306:9:
assertion failed: `(left == right)`
Diff < left / right > :
<\\?\C
>C:\xxx\cbindgen-0.29.4\tests\expectations\abi_string.compat.c
Edit: After a bit of digging:
The long path syntax is the expected result of std::fs::canonicalize.
So the tests on Windows need fixing in any case.
The change might be easy to implement, but I don't know if cbindgen should get an option to control the long path syntax output. That option wouldn't do anything on any other platform than windows (which would be ok with me).
Doesn't seem hard to do. If nobody else wants, I could draft something.
Activity
emilio commentedon May 29, 2026
I mean changing the path syntax seems ok-ish, but it seems like it might be a mingw issue right? Do they just not understand those paths?
hiSandog commentedon Jun 29, 2026
The depfile case sounds like it needs a generator-specific path normalization decision. If MinGW Makefiles cannot consume
\\?\long paths, cbindgen could either emit ordinary Windows paths when writing Make-compatible depfiles, or provide an option to control long-path syntax in depfile output. A regression fixture with a long Windows path and a dependency containing spaces would make the behavior much easier to lock down.invarispsc commentedon Sep 29, 2026
This doesn't only affect MinGW Makefiles. It also affects the Ninja generator.
Sample error message:
Also all cbindgen tests in tests/tests.rs fail on Windows for me (doesn't matter if long path support enabled or not).
For example:
Edit: After a bit of digging:
The long path syntax is the expected result of std::fs::canonicalize.
So the tests on Windows need fixing in any case.
The change might be easy to implement, but I don't know if cbindgen should get an option to control the long path syntax output. That option wouldn't do anything on any other platform than windows (which would be ok with me).
Doesn't seem hard to do. If nobody else wants, I could draft something.