Opened 5 months ago

Closed 4 months ago

Last modified 2 months ago

#16177 closed build error (fixed)

Compilation occasionally fails when build on multiple CPUs

Reported by: ConfusedSushi Owned by: VZ
Priority: normal Milestone:
Component: build Version: dev-latest
Keywords: Cc:
Blocked By: Blocking:
Patch: yes

Description

Compilation occasionally fails when build on multiple CPUs using Visual Studio 2013.

The problem is the creation of rcdefs.h and setup.h which are used by all projects.

Some excerpts of the log:

<snip>
8> fswatcherg.cpp
8> extended.c
8> wx_vc12_base.vcxproj -> D:\c\pkg\wx\build\msw\..\..\lib\vc_lib\wxbase30ud.lib
9>------ Rebuild All started: Project: core, Configuration: Debug Win32 ------
10>------ Rebuild All started: Project: xml, Configuration: Debug Win32 ------
11>------ Rebuild All started: Project: net, Configuration: Debug Win32 ------
10> Creating ..\..\lib\vc_lib\mswud\wx\setup.h
11> Creating ..\..\lib\vc_lib\mswud\wx\setup.h
10> 1 file(s) copied.
10> Creating ..\..\lib\vc_lib\mswud\wx\msw\rcdefs.h
11> 1 file(s) copied.
11> Creating ..\..\lib\vc_lib\mswud\wx\msw\rcdefs.h
11> The process cannot access the file because it is being used by another process.
10> genrcdefs.h
11> dummy.cpp
10> dummy.cpp
10>D:\c\pkg\wx\include\wx/platform.h(189): fatal error C1083: Cannot open include file: 'wx/setup.h': No such file or directory
11>D:\c\pkg\wx\include\wx/platform.h(189): fatal error C1083: Cannot open include file: 'wx/setup.h': No such file or directory
9> Creating ..\..\lib\vc_lib\mswud\wx\setup.h
9> 1 file(s) copied.
9> Creating ..\..\lib\vc_lib\mswud\wx\msw\rcdefs.h
9> genrcdefs.h
9> dummy.cpp
9> accelcmn.cpp
9> accesscmn.cpp
<snip>
9> toolbar.cpp
9> statusbr.cpp
9> wx_vc12_core.vcxproj -> D:\c\pkg\wx\build\msw\..\..\lib\vc_lib\wxmsw30ud_core.lib
12>------ Rebuild All started: Project: adv, Configuration: Debug Win32 ------
13>------ Rebuild All started: Project: html, Configuration: Debug Win32 ------
14>------ Rebuild All started: Project: media, Configuration: Debug Win32 ------
15>------ Rebuild All started: Project: webview, Configuration: Debug Win32 ------
16>------ Rebuild All started: Project: qa, Configuration: Debug Win32 ------
17>------ Rebuild All started: Project: stc, Configuration: Debug Win32 ------
15> Creating ..\..\lib\vc_lib\mswud\wx\setup.h
15> 1 file(s) copied.
15> Creating ..\..\lib\vc_lib\mswud\wx\msw\rcdefs.h
14> Creating ..\..\lib\vc_lib\mswud\wx\setup.h
17> Creating ..\..\lib\vc_lib\mswud\wx\setup.h
15> genrcdefs.h
14> 1 file(s) copied.
17> The process cannot access the file because it is being used by another process.
14> Creating ..\..\lib\vc_lib\mswud\wx\msw\rcdefs.h
17> 0 file(s) copied.
14> The process cannot access the file because it is being used by another process.
17> Creating ..\..\lib\vc_lib\mswud\wx\msw\rcdefs.h
17> The process cannot access the file because it is being used by another process.
17>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V120\Microsoft.CppCommon.targets(170,5): error MSB6006: "cmd.exe" exited with code 1.
16> Creating ..\..\lib\vc_lib\mswud\wx\setup.h
16> 1 file(s) copied.
16> Creating ..\..\lib\vc_lib\mswud\wx\msw\rcdefs.h
13> Creating ..\..\lib\vc_lib\mswud\wx\setup.h
13> 1 file(s) copied.
13> Creating ..\..\lib\vc_lib\mswud\wx\msw\rcdefs.h
13> The process cannot access the file because it is being used by another process.
12>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V120\Microsoft.CppClean.targets(76,5): warning : The process cannot access the file 'd:\c\pkg\wx\lib\vc_lib\mswud\wx\msw\rcdefs.h' because it is being used by another process.
16> genrcdefs.h
15> dummy.cpp
12> Creating ..\..\lib\vc_lib\mswud\wx\setup.h
12> 1 file(s) copied.
12> Creating ..\..\lib\vc_lib\mswud\wx\msw\rcdefs.h
13> dummy.cpp
16> dummy.cpp
12> genrcdefs.h
18>------ Rebuild All started: Project: gl, Configuration: Debug Win32 ------
14> dummy.cpp
12> dummy.cpp
12>D:\c\pkg\wx\include\wx/platform.h(189): fatal error C1083: Cannot open include file: 'wx/setup.h': No such file or directory
18> Creating ..\..\lib\vc_lib\mswud\wx\setup.h
18> 1 file(s) copied.
18> Creating ..\..\lib\vc_lib\mswud\wx\msw\rcdefs.h
18> genrcdefs.h
19>------ Rebuild All started: Project: xrc, Configuration: Debug Win32 ------
19> Creating ..\..\lib\vc_lib\mswud\wx\setup.h
19> 1 file(s) copied.
19> Creating ..\..\lib\vc_lib\mswud\wx\msw\rcdefs.h
19> genrcdefs.h
19> dummy.cpp
18> dummy.cpp
16> debugrpt.cpp
16> dbgrptg.cpp
16> wx_vc12_qa.vcxproj -> D:\c\pkg\wx\build\msw\..\..\lib\vc_lib\wxmsw30ud_qa.lib
20>------ Rebuild All started: Project: ribbon, Configuration: Debug Win32 ------
20> Creating ..\..\lib\vc_lib\mswud\wx\setup.h
20> 1 file(s) copied.
20> Creating ..\..\lib\vc_lib\mswud\wx\msw\rcdefs.h
20> genrcdefs.h
20> dummy.cpp
13> helpbest.cpp
13> htmllbox.cpp
13> helpctrl.cpp

Attachments (4)

wx_vc11.patch download (86.4 KB) - added by awi 5 months ago.
Patch replacing copy command with robocopy utility (VS2012).
wx_vc12.patch download (86.4 KB) - added by awi 5 months ago.
Patch replacing copy command with robocopy utility (VS2013).
vc11-custom-project.patch download (208.9 KB) - added by awi 4 months ago.
Patch adding custom build project (VS2012).
vc12-custom-project.patch download (208.7 KB) - added by awi 4 months ago.
Patch adding custom build project (VS2013).

Download all attachments as: .zip

Change History (9)

comment:1 Changed 5 months ago by awi

  • Patch set
  • Version changed from 3.0.0 to dev-latest

Apparently VS 2012 is also affected by this issue so it seems that both IDE's have problems with synchronizing compilation tasks.
Fortunately, it can practically happen only if whole solution is rebuilt. Re-launching of build process solves the problem and target files are OK.

In order to suppress annoying messages and to avoid unnecessary copying of the same file (setup.h) it is possible to use robocopy utility instead of plain copy command. Robocopy by default can copy files if they don't exist or are newer so setup.h file would be copied only once, if necessary.
Robocopy is bundled with Windows 7, 8, 2008 etc. so it can be called from VS 2012 & 2013 projects with no problems.
Patches replacing copy command with robocopy utility in project files are attached.

Problem with rcdefs.h file cannot be solved by using robocopy because it is not copied directly but first preprocessed by compiler.

Changed 5 months ago by awi

Patch replacing copy command with robocopy utility (VS2012).

Changed 5 months ago by awi

Patch replacing copy command with robocopy utility (VS2013).

comment:2 Changed 4 months ago by awi

Alternative solution could be to create a separate project containing custom build files only (setup.h, genrcdefs.h) and make all projects having custom build steps regarding these files dependent on this special project instead of perform the same custom build steps for every single project.
This way custom files would be created only once and concurrent compilation tasks shouldn't lock each other.

Patches applying this approach attached:
attachment:ticket:16177:vc11-custom-project.patch
attachment:ticket:16177:vc12-custom-project.patch

Changed 4 months ago by awi

Patch adding custom build project (VS2012).

Changed 4 months ago by awi

Patch adding custom build project (VS2013).

comment:3 Changed 4 months ago by vadz

I don't like that this makes VC11+ projects diverge even more from the auto-generated ones but OTOH they are already so different that it's probably a losing battle to ever hope to merge them anyhow... So I'm going to apply the (second version of the) patch, thanks for fixing this!

Just one question: why the ugly (IMHO) "_custom_build" name? I'd use something like "wxsetup" instead, would there be a problem with changing this?

comment:4 Changed 4 months ago by VZ

  • Owner set to VZ
  • Resolution set to fixed
  • Status changed from new to closed

In 76419:

Extract setup.h copying into a separate project for MSVC11+.

This fixes problems with parallel builds in Visual Studio 2012 or 2013 IDE as
multiple projects may try to copy setup.h file at once, resulting in errors.

Use _custom_build project as a common dependency to ensure that the copy step
is done only once.

Closes #16177.

comment:5 Changed 2 months ago by VZ

In 76819:

Extract setup.h copying into a separate project for MSVC11+.

This fixes problems with parallel builds in Visual Studio 2012 or 2013 IDE as
multiple projects may try to copy setup.h file at once, resulting in errors.

Use _custom_build project as a common dependency to ensure that the copy step
is done only once.

This is a backport of r76419 from trunk, see #16177.

Note: See TracTickets for help on using tickets.