16

We have gone through the points listed on MSDN WRT to this error ( except for #5 ). Three different people on different machines are getting the same problem. The PDB is created, but fails somewhere in the middle.

Details:

  • 67 static libraries
  • 4.27 GB of static libraries
  • 1048575 bytes - size of PDB when linker fails
  • The last couple of megabytes of the PDB are null ( zero's )
  • Release build succeeds & produces a PDB ( we have it turn on, with no debugging info in the exe )
  • Release build PDB is just under 1 GB.

We have disabled virus scanners. Watched with procmon.exe and saw no suspicions interactions with the PDB when the linker failed.

Related question suggests ~1 GB limit on PDB's - anyone/way to confirm that?

UPDATE & SOLUTION:

@Barry and the chromium team have come up with the solution. Here is the patch to the Chromium build system that implements the resolution.

Details
The PDB uses a virtual filesystem internally: MSF. When the linker creates the PDB file it defaults to an ( apparently non-configurable ) 2 kB page size. Apparently & fortunately when the compiler creates its PDB it defaults the page size to 4 kB. This compiler PDB can be hoisted and used as a base for the linker PDB.

Better solution As a Pre-Link Event on the project that is linking your exe or dll we can hoist the compiler to generate our required initial PDB:

cl -c "dummy_empty.cpp" /Zi /Fd"$(TargetDir)$(TargetName).pdb" 

Original Solution
Make a C++ static library project with an empty cpp file, configure the 'Porgram Database File Name' to output something other than the default. Use some project build events ( I used 'Pre-Link Event') to copy in the previously created PDB into wherever you linker is expecting ( see Linker->Generate Program Database File ) to create its PDB. Fortunately the linker will adopt the copied in PDB and use its 4 kB page size. This will buy some time, and some space allowing up to a 2GB PDB.

4

3 回答 3

7

pdb 大小确实有一个最大限制1GB。有一些技巧可以将其扩展到2GB(更多信息可以在这里找到)。基本上,您必须自己生成初始 pdb 文件,而不是编译器。

您可以做的其他事情是对您的模板代码进行一些主动提升,因为这也可能会影响您的 pdb 大小。

于 2013-12-06T10:03:51.350 回答
5

我编写了一个包含 1000 个 cpp 文件的测试程序,每个 cpp 都有一个函数,它实例化了 500 个独特的模板类型。

当 PDB 文件达到:1048575 KB 时,Link.exe 失败。

在 PDB 格式或 LINK.exe 中似乎是 1 GB 的某种硬限制。

于 2013-04-30T23:27:14.490 回答
0

您是否尝试过减少并行构建的数量。IDE 中某处的设置。在 VC9 上,我们遇到了类似的问题,我们唯一的解决方案是减少本地构建的数量。会不会也是内存问题?您使用的是 VC 10 SP1 吗?

于 2013-04-30T21:08:43.897 回答