[CMake] Maximum path length in CMakeFiles
Frans.Fuerst at elektrobit.com
Frans.Fuerst at elektrobit.com
Wed Aug 6 10:59:22 EDT 2008
Hi Brad,
hm, it does'nt seem to be the maximum file name length alone. Many files which have only the full pathname length in common (about 250) throw an error.
But files with some more characters don't produce errors.
For me it looks like something like a string resize problem in nmake :)
Here is a directory layout example which produces errors for me (actual names replaced for confidence reasons)
C:\aaaaa\bbbbbbbbbb\CMake_Environment\ccccccccccccccccccccc\CMakeLists.txt
mentions
C:\aaaaa\bbbbbbbbbb\dddddddddddd\eeeeeeeeeeeeee\fffffffffffffffffff\gggggggggggggggggg\hhhhhhhhhhhhhhhhhhhhhhh\iiiiiiiiiiiiiiii\jjjjjjjjjjjjjjjjjjjjj.cpp
producing
C:\aaaaa\bbbbbbbbbb\CMake_Environment\ccccccccccccccccccccc\CMakeFiles\libraryname_xxxxxx.dir\C_\aaaaa\bbbbbbbbbb\dddddddddddd\eeeeeeeeeeeeee\fffffffffffffffffff\gggggggggggggggggg\hhhhhhhhhhhhhhhhhhhhhhh\iiiiiiiiiiiiiiii\jjjjjjjjjjjjjjjjjjjjj.cpp.o (250 characters!!)
and will make nmake crash. And so does _every_ file with about(!!) the same file name length (about +- 1)
Important: Compiling a file in the same directory as jjjjjjjjjjjjjjjjjjjjj.cpp but with a three characters longer filename will compile fine.
And here the proof of concept: renaming "CMake_Environment" to "CMake_Environm" (three characters shorter) will work fine for every file EXECPT the one that compiled before. obviously the critical part is the object file name length and it must not be near 250.
I renamed "CMake_Environment" to "CMake" and it works for me now..
hth,
Frans
-----Original Message-----
From: Brad King [mailto:brad.king at kitware.com]
Sent: Wednesday, August 06, 2008 3:02 PM
To: Fürst, Frans
Cc: cmake at cmake.org
Subject: Re: [CMake] Maximum path length in CMakeFiles
Frans.Fuerst at elektrobit.com wrote:
> might there be a maximum path length limitation in CMake (or perhaps
> in nmake)? Trying to compile a library I have to comment out every
> source file that leads to a CMakeFiles/... object file with a total
> path length of over 200.
>
> Is that a known problem and can I avoid it despite by shorten the path
> names?
It's not a CMake limitation, its a Windows limitation. We have run into many problems with path lengths in the past. However, CMake is now supposed to recognize when the path to an object file is too long and replace it with a shorter name by computing a hash (md5) of the original directory name. The limit is 250 characters.
See cmLocalGenerator.cxx:
http://www.cmake.org/cgi-bin/viewcvs.cgi/Source/cmLocalGenerator.cxx?revision=1.280&root=CMake&view=markup
and look for the function "cmLocalGeneratorCheckObjectName".
Perhaps your file system has a lower limit? Is this on any special kind of disk? Do you actually see any paths over 250 chars?
-Brad
> circumstances:
>
> * CMake 2.6.1
> * Windows XP
> * compiling on Windows command line
> * building for nmake
>
> error message:
>
> Assembler messages:
> FATAL: can't create CMakeFiles\\...\ [long path] \...\\File.cpp.o:
> No such file or directory
> C:\\ [long path] \\File.cpp:524: fatal error: error writing to -:
> Invalid argument
> compilation terminated.
> NMAKE : fatal error U1077: 'C:\PROGRA~1\CSLARM~1\bin\AR014C~1.EXE' :
> return code '0x1'
> Stop.
> NMAKE : fatal error U1077: '"C:\Program Files\Microsoft Visual Studio
> 8\VC\BIN\nmake.exe"' : return code '0x2'
> Stop.
> NMAKE : fatal error U1077: '"C:\Program Files\Microsoft Visual Studio
> 8\VC\BIN\nmake.exe"' : return code '0x2'
> Stop.
>
> ----------------------------------------------------------------
> Please note: This e-mail may contain confidential information intended
> solely for the addressee. If you have received this e-mail in error,
> please do not disclose it to anyone, notify the sender promptly, and
> delete the message from your system.
> Thank you.
>
>
> ----------------------------------------------------------------------
> --
>
> _______________________________________________
> CMake mailing list
> CMake at cmake.org
> http://www.cmake.org/mailman/listinfo/cmake
----------------------------------------------------------------
Please note: This e-mail may contain confidential information
intended solely for the addressee. If you have received this
e-mail in error, please do not disclose it to anyone, notify
the sender promptly, and delete the message from your system.
Thank you.
More information about the CMake
mailing list