View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0007860CMakeCMakepublic2008-10-27 13:422008-12-16 09:20
Reporterwcesario 
Assigned ToBrad King 
PrioritynormalSeverityblockReproducibilityalways
StatusclosedResolutionfixed 
PlatformOSOS Version
Product VersionCMake-2-6 
Target VersionFixed in Version 
Summary0007860: CMAKE_OBJECT_PATH_MAX does not take into account current path lenght in Windows
DescriptionWhen I run cmake in Windows XP, the name of my base directory path (the one where CMakeLists.txt is) is already 168 characters long.
Even if I set CMAKE_OBJECT_PATH_MAX to the minimum (128), cmake tries to duplicate the absolute path of some sources (not all of them) in the build tree CMakeFiles\Application.dir\C_\... which adds another 168 characters the path of some object files.
For two out of three files in a given source directoy cmakes correctly detected a long path and generated an object path with the hash number.
The generation goes to the end without any error message, but of course compilation fails as some of the object files cannot be created.
Additional InformationI have tried most recent CVS build: cmake-2.7.20081025-win32-x86.exe with the same result.
TagsNo tags attached.
Attached Files

 Relationships

  Notes
(0014075)
Brad King (manager)
2008-11-09 10:11

Yes, it does account for the current dir, but only if the current dir is not already longer than the maximum. It assumes if the user has created a current dir longer than the supposed filesystem max, then the max is bogus. Here is the code:

static
bool cmLocalGeneratorCheckObjectName(std::string& objName,
                                     std::string::size_type dir_len,
                                     std::string::size_type max_total_len)
{
  // Enforce the maximum file name length if possible.
  std::string::size_type max_obj_len = max_total_len;
  if(dir_len < max_total_len)
    {
    max_obj_len = max_total_len - dir_len;
    if(objName.size() > max_obj_len)
      {
      // The current object file name is too long. Try to shorten it.
      return cmLocalGeneratorShortenObjectName(objName, max_obj_len);
      }
    else
      {
      // The object file name is short enough.
      return true;
      }
    }
  else
    {
    // The build directory in which the object will be stored is
    // already too deep.
    return false;
    }
}
(0014076)
Brad King (manager)
2008-11-09 10:15

In the above code, dir_len is the length of the build directory under which the object will be placed. It consists of the top-level build tree created by the user, plus the subdirectory names configured by the project. If your project is creating subdirectory names in the build tree that push past the 254 character limit on windows when placed under a build tree that is already 168 characters long, then you just can't build the project there because there is nothing CMake can do about it.
(0014108)
wcesario (reporter)
2008-11-14 05:12

That's right, in fact, the real issue is that cmake terminates without an error.
I was tricked by the fact that some of the files have the hash number but not others in the same directory.
If the file name is too long then even with the hash number the object will surpass the 254 character limit. You are right, there is nothing CMake can do in this situation, but it could stop the generation with an error.
What it does instead, is that it generates the makefiles with the full paths without tha hash number, even if it knows that it will be impossible to compile.
(0014363)
Brad King (manager)
2008-12-16 09:19

Okay, first some refactoring:

/cvsroot/CMake/CMake/Source/cmLocalGenerator.cxx,v <-- Source/cmLocalGenerator.cxx
new revision: 1.287; previous revision: 1.286
/cvsroot/CMake/CMake/Source/cmLocalGenerator.h,v <-- Source/cmLocalGenerator.h
new revision: 1.107; previous revision: 1.106
/cvsroot/CMake/CMake/Source/cmLocalUnixMakefileGenerator3.cxx,v <-- Source/cmLocalUnixMakefileGenerator3.cxx
new revision: 1.256; previous revision: 1.255
/cvsroot/CMake/CMake/Source/cmLocalVisualStudio6Generator.cxx,v <-- Source/cmLocalVisualStudio6Generator.cxx
new revision: 1.150; previous revision: 1.149
/cvsroot/CMake/CMake/Source/cmLocalVisualStudio7Generator.cxx,v <-- Source/cmLocalVisualStudio7Generator.cxx
new revision: 1.235; previous revision: 1.234

Now add a warning:

/cvsroot/CMake/CMake/Source/cmLocalGenerator.cxx,v <-- Source/cmLocalGenerator.cxx
new revision: 1.288; previous revision: 1.287
/cvsroot/CMake/CMake/Source/cmLocalGenerator.h,v <-- Source/cmLocalGenerator.h
new revision: 1.108; previous revision: 1.107

It should probably be an error but I'm going with a warning first in case the test has false positives.

 Issue History
Date Modified Username Field Change
2008-10-27 13:42 wcesario New Issue
2008-11-08 17:48 Bill Hoffman Status new => assigned
2008-11-08 17:48 Bill Hoffman Assigned To => Brad King
2008-11-09 10:11 Brad King Note Added: 0014075
2008-11-09 10:15 Brad King Note Added: 0014076
2008-11-14 05:12 wcesario Note Added: 0014108
2008-12-16 09:19 Brad King Note Added: 0014363
2008-12-16 09:20 Brad King Status assigned => closed
2008-12-16 09:20 Brad King Resolution open => fixed


Copyright © 2000 - 2018 MantisBT Team