[CMake] "Cannot restore timestamp" error on Windows
Raffi Enficiaud
raffi.enficiaud at free.fr
Mon Apr 29 16:37:27 EDT 2013
Hi Brad,
Thank you for your reply.
As you pointed out, the problem seems to come from a race condition on the
file "generate.stamp". Now the operations being atomic, the problem should
be solved, in practice.
However, I do not fully understand in what extent the atomicity of renaming
a file would solve this. The log says:
"Write the stamp file to a random temporary name and then atomically rename
it to the real stamp file."
The operations take basically less time; hence the problem should occur
less. However:
- process 1 is accessing generate.stamp for reading
- process 2 is moving some "tmpfile" to generate.stamp -> race
The probability of race increases with the number of projects in
CMakeList.txt (since they share "generate.stamp") and the number of cores
used for building (and of course the structure and dependencies among the
projects).
What if, in .\Source\cmLocalVisualStudio7Generator.cxx, we replace:
cmSourceFile* cmLocalVisualStudio7Generator::CreateVCProjBuildRule()
{
std::string stampName = this->Makefile->GetCurrentOutputDirectory();
stampName += "/";
stampName += cmake::GetCMakeFilesDirectoryPostSlash();
stampName += "generate.stamp";
const char* dsprule =
this->Makefile->GetRequiredDefinition("CMAKE_COMMAND");
by
cmSourceFile* cmLocalVisualStudio7Generator::CreateVCProjBuildRule()
{
std::string stampName = this->Makefile->GetCurrentOutputDirectory();
stampName += "/";
stampName += cmake::GetCMakeFilesDirectoryPostSlash();
stampName += std::string(this->Makefile->GetProjectName()) +
"_generate.stamp";
const char* dsprule =
this->Makefile->GetRequiredDefinition("CMAKE_COMMAND");
I do not know the code that much, but I guess "Makefile::SetProjectName" is
called much earlier than
cmLocalVisualStudio7Generator::CreateVCProjBuildRule, right?
What do you think?
Best,
Raffi Enficiaud
-----Original Message-----
From: Brad King [mailto:brad.king at kitware.com]
Sent: lundi 29 avril 2013 18:56
To: Raffi Enficiaud
Cc: cmake at cmake.org
Subject: Re: [CMake] "Cannot restore timestamp" error on Windows
On 04/29/2013 10:53 AM, Raffi Enficiaud wrote:
> I read the content of the change in the link you provided, and I have
> a newbie question:
> Why not using one timestamp (different filename) per
library/binary/project?
The current approach evolved historically. A per-target approach would
probably work too but things should be working now anyway.
> Looking forward to having this issue solved in the next official release!
It is already solved in 2.8.11-rc*.
-Brad
More information about the CMake
mailing list