-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Windows] Long paths issue with Ninja >=1.12 #2442
Comments
What is your problem? |
Hi @jhasse, sorry, the initial was not clear at all... I edited it with the actual error. |
I just did a test: building with ninja vs directly with arm-gcc. |
It would be useful to give us something we can use to reproduce the problem, or more information about the paths themselves (i.e. are they properly printed in the error message vs what is in the Ninja build plan). For the record, I have uploaded a PR to get rid of remaining Win32 long path issues in Ninja at PR #2410. Can you try the binary from the "Ninja binaries archive" link on https://github.com/ninja-build/ninja/actions/runs/8950181908 on your machine to see if this fixes your issue. Otherwise, there is probably very little we can do without more information from you. |
Ok so I did something to reproduce the problem with a simpler and obfuscated env (I cannot share my actual project) /c/aaa/aaaaaa_aaaaaa/aaaaaaaaaa/aaaaaaaa/aaaaaa/aaaaaaaa/aaaaaa_aaaaaaaaaaa/build_cmake This CMake project builds a library with a single C file located here (sorry for the name of the file, just wanted to make it stupidly long to reproduce the problem): C:/aaa/aaaaaa_aaaaaaa/bbbbbbbbbb/bbb_bbb/bbb/bbbbb/bbbbbbbbb/bbb/bbbbbbbbb_bbbbb_bbbbbbbb_bbbbbbbbbbbbbbb_bbbbbbbbbbbbb_bbb_bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb.c During the CMake configuration, a warning is displayed saying the path is still too long after hashing it: CMake Warning in CMakeLists.txt:
The object file directory
C:/aaa/aaaaaa_aaaaaa/aaaaaaaaaa/aaaaaaaa/aaaaaa/aaaaaaaa/aaaaaa_aaaaaaaaaaa/build_cmake/build/CMakeFiles/mylib.dir/./
has 117 characters. The maximum full path to an object file is 250
characters (see CMAKE_OBJECT_PATH_MAX). Object file
8e1e25dad068f8d0a92cb8c1e5e287b9/bbbbbbbbb_bbbbb_bbbbbbbb_bbbbbbbbbbbbbbb_bbbbbbbbbbbbb_bbb_bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb.c.obj
cannot be safely placed under this directory. The build may not work
correctly. Now, here is the output of Ninja (I'm using the ninja binary from #2410 ): $ ninja -C build
ninja: Entering directory `build'
[1/2] Building C object CMakeFiles/mylib.dir/8e1e25dad068f8d0a92cb8c1e5e287b9/bbbbbbbbb_bbbbb_bbbbbbbb_bbbbbbbbbbbbbbb_bbbbbbbbbbbbb_bbb_bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb.c.obj
FAILED: CMakeFiles/mylib.dir/8e1e25dad068f8d0a92cb8c1e5e287b9/bbbbbbbbb_bbbbb_bbbbbbbb_bbbbbbbbbbbbbbb_bbbbbbbbbbbbb_bbb_bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb.c.obj
C:\MCUXpressoIDE_11.9.0_2144\ide\tools\bin\arm-none-eabi-gcc.exe -Wall -Wno-expansion-to-defined -Wno-endif-labels -fmessage-length=0 -fdata-sections -ffunction-sections -std=gnu99 -MD -MT CMakeFiles/mylib.dir/8e1e25dad068f8d0a92cb8c1e5e287b9/bbbbbbbbb_bbbbb_bbbbbbbb_bbbbbbbbbbbbbbb_bbbbbbbbbbbbb_bbb_bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb.c.obj -MF CMakeFiles\mylib.dir\8e1e25dad068f8d0a92cb8c1e5e287b9\bbbbbbbbb_bbbbb_bbbbbbbb_bbbbbbbbbbbbbbb_bbbbbbbbbbbbb_bbb_bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb.c.obj.d -o CMakeFiles/mylib.dir/8e1e25dad068f8d0a92cb8c1e5e287b9/bbbbbbbbb_bbbbb_bbbbbbbb_bbbbbbbbbbbbbbb_bbbbbbbbbbbbb_bbb_bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb.c.obj -c C:/aaa/aaaaaa_aaaaaaa/bbbbbbbbbb/bbb_bbb/bbb/bbbbb/bbbbbbbbb/bbb/bbbbbbbbb_bbbbb_bbbbbbbb_bbbbbbbbbbbbbbb_bbbbbbbbbbbbb_bbb_bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb.c
C:/aaa/aaaaaa_aaaaaaa/bbbbbbbbbb/bbb_bbb/bbb/bbbbb/bbbbbbbbb/bbb/bbbbbbbbb_bbbbb_bbbbbbbb_bbbbbbbbbbbbbbb_bbbbbbbbbbbbb_bbb_bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb.c:1: fatal error: opening dependency file CMakeFiles\mylib.dir\8e1e25dad068f8d0a92cb8c1e5e287b9\bbbbbbbbb_bbbbb_bbbbbbbb_bbbbbbbbbbbbbbb_bbbbbbbbbbbbb_bbb_bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb.c.obj.d: No such file or directory
compilation terminated.
ninja: build stopped: subcommand failed. I ran the command directly with arm-gcc, and now I get the same error, which contradicts what I observed yesterday, I'm a bit confused... |
Thanks for the investigation! The original error message also hints at this being a bug in |
hello bro.I met the same problem as you. How you solved this issue finally? Thanks. |
I haven't found a solution unfortunately, seems like the issue is not due to ninja but to armgcc. |
When building
So just building |
Oh, that seems to be a different issue, the only place where this error may come from is |
Interestingly, my testing shows that even when using dynamically allocated buffers,
I'll fix it, but this is clearly a case of a ANSI function not supporting long paths properly! |
Do not use fixed-size buffers in order to properly support long file paths. This should get rid of the failure described at [1]. This leverages the Win32 Unicode/UTF-8 conversions functions introduced in a previous commit to call GetFullPathnameW() which is required here, since GetFullPathNameA() will fail with long input paths, even when long path support is enabled! [1] ninja-build#2442 (comment)
I uploaded #2552 with a candidate fix. |
Hi,
I'm working with a cross-compile (arm gcc) CMake project which can generate long paths.
When building, I get errors like the following one:
I enabled the long path support in the registry like documented by Microsoft.
I also updated my Ninja version to the latest one, 1.12 which seems to bring support of long paths. I also tried the builds from master from this link, without success.
I came accross several GitHub issues like #1900 which was closed mentioning there was still issues with this.
I tried to build from MinGW (Git bash env), cmd and PowerShell, without success.
I'm running on Windows 10 19045.
Thanks !
The text was updated successfully, but these errors were encountered: