View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0014492CMakeCMakepublic2013-10-17 16:072014-06-02 08:37
ReporterNick Hutchinson 
Assigned ToBrad King 
PrioritynormalSeveritymajorReproducibilityalways
StatusclosedResolutionfixed 
PlatformWindowsOSWindows 7OS Version
Product VersionCMake 2.8.12 
Target VersionCMake 2.8.12.1Fixed in VersionCMake 2.8.12.1 
Summary0014492: Visual Studio 2013 breaks parallel command-line builds
DescriptionYou get the following error:
fatal error C1041: cannot open program database 'XXXX.pdb'; if multiple CL.EXE write to the same .PDB file, please use /FS

Adding `add_compile_options(/FS)` to a CMakeLists.txt works around the issue, but CMake should probably add it in by default. Infuriatingly, Microsoft don't appear to have documented this flag on MSDN[1].

1: http://msdn.microsoft.com/en-us/library/vstudio/fwkeyyhe(v=vs.120).aspx [^]
Steps To ReproduceWith Ninja and Visual Studio 2013 installed (I tested with the Express edition), open a vcvarsall.bat command prompt, and configure and build any CMake project.

E.g.
> cmake -GNinja -DCMAKE_C_COMPILER=cl -DCMAKE_CXX_COMPILER=cl [PATH_TO_SOURCE_TREE]
> ninja -j2
TagsNo tags attached.
Attached Files

 Relationships

  Notes
(0034144)
Brad King (manager)
2013-10-17 16:14

According to "cl /?":

 /FS force to use MSPDBSRV.EXE
(0034145)
Brad King (manager)
2013-10-17 16:20

Is there a "/Fd<something>" option in the generated compile command lines? Does it refer to a directory?
(0034147)
Nick Hutchinson (reporter)
2013-10-17 16:37

There is, and it does. Sample error:

FAILED: "C:/opt/cmake/bin/cmcldeps.exe" C y:\the_silver_searcher\third_party\pthread-win32\attr.c "CMakeFiles/pthreadsC2.dir/attr.c.obj.d" CMakeFiles\pthreadsC2.dir\attr.c.obj "Note: including file: " "C:/Program Files (x86)/Microsoft Visual Studio 12.0/VC/bin/x86_amd64/cl.exe" C:\PROGRA~2\MICROS~2.0\VC\bin\X86_AM~1\cl.exe /nologo /DWIN32 /D_WINDOWS /W3 /D_DEBUG /MDd /Zi /Ob0 /Od /RTC1 -Iy:\the_silver_searcher\third_party\pthread-win32\. -DHAVE_PTW32_CONFIG_H -DPTW32_ARCH=\"x64\" -DPTW32_RC_MSC -DPTW32_STATIC_LIB /FoCMakeFiles\pthreadsC2.dir\attr.c.obj /FdCMakeFiles\pthreadsC2.dir/ -c y:\the_silver_searcher\third_party\pthread-win32\attr.c
y:\the_silver_searcher\third_party\pthread-win32\attr.c : fatal error C1041: cannot open program database 'c:\dev\ag-ninja\third_party\build\vendor_pthreads_win32\cmakefiles\pthreadsc2.dir\vc120.pdb'; if multiple CL.EXE write to the same .PDB file, please use /FS
(0034148)
Brad King (manager)
2013-10-17 16:43

Thanks.

Interestingly the IDE project files never seem to build /FS even when using /MP, so it must be that "cl /MP" handles the PDB access itself somehow. It is only when some outside party starts multiple "cl" processes with the same /Fd that this happens (i.e. for sources in the same lib or exe).
(0034156)
Brad King (manager)
2013-10-18 10:34

This should fix it:

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=216afc8a [^]
(0034169)
Peter Kuemmel (developer)
2013-10-18 18:05

http://msdn.microsoft.com/en-us/library/vstudio/dn502518.aspx [^]

"The /MP option enables /FS by default."

So adding /FS should be the right fix.
(0036001)
Robert Maynard (manager)
2014-06-02 08:37

Closing resolved issues that have not been updated in more than 4 months.

 Issue History
Date Modified Username Field Change
2013-10-17 16:07 Nick Hutchinson New Issue
2013-10-17 16:14 Brad King Note Added: 0034144
2013-10-17 16:20 Brad King Note Added: 0034145
2013-10-17 16:37 Nick Hutchinson Note Added: 0034147
2013-10-17 16:43 Brad King Note Added: 0034148
2013-10-18 10:34 Brad King Note Added: 0034156
2013-10-18 10:34 Brad King Assigned To => Brad King
2013-10-18 10:34 Brad King Status new => assigned
2013-10-18 10:34 Brad King Target Version => CMake 3.0
2013-10-18 18:05 Peter Kuemmel Note Added: 0034169
2013-10-21 09:20 Brad King Status assigned => resolved
2013-10-21 09:20 Brad King Resolution open => fixed
2013-10-21 09:20 Brad King Fixed in Version => CMake 3.0
2013-11-05 07:44 Brad King Fixed in Version CMake 3.0 => CMake 2.8.12.1
2013-11-05 07:44 Brad King Target Version CMake 3.0 => CMake 2.8.12.1
2014-06-02 08:37 Robert Maynard Note Added: 0036001
2014-06-02 08:37 Robert Maynard Status resolved => closed


Copyright © 2000 - 2018 MantisBT Team