LNK1201 Visual C ++ 2010大型项目无法生成PDB [英] LNK1201 Visual C++ 2010 Large project failing to generate PDB

查看:218
本文介绍了LNK1201 Visual C ++ 2010大型项目无法生成PDB的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们详细介绍了 MSDN 上列出的要点WRT到此错误(#5除外)。三个不同的人在不同的机器上都得到同样的问题。

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.

详情:


  • > 67个静态库

  • 4.27 GB静态库

  • 1048575字节 - 链接器失败时PDB的大小

  • PDB的最后几兆字节为空(零)

  • 发布构建成功,生成一个PDB(我们打开它,在exe中没有调试信息)

  • 发布版本PDB刚刚低于1 GB。

  • 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.

我们已经禁用病毒扫描程序。使用procmon.exe观察并在链接器失败时看不到与PDB的交互。

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

相关问题建议PDB的〜1 GB限制 - 任何人/方式来确认?

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

UPDATE&解决方案:

@Barry和铬团队提出了解决方案。 此处是实施解决方案的Chromium构建系统的修补程序。

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

详细

PDB在内部使用虚拟文件系统: MSF 。当链接器创建PDB文件时,它默认为2 kB页面大小(显然不可配置)。显然&幸运的是当编译器创建它的PDB时,它默认页面大小为4 kB。该编译器PDB可以被提升并用作链接器PDB的基础。

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.

更好的解决方案
作为 Pre -Link事件在链接您的exe或dll的项目上,我们可以提升编译器生成所需的初始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" 

原始解决方案

使用空cpp文件创建C ++静态库项目,配置Porgram数据库文件名以输出默认值以外的内容。使用一些项目构建事件(我使用预链接事件)在先前创建的PDB中复制到链接器期望的任何位置(请参阅链接程序 - >生成程序数据库文件)以创建其PDB。幸运的是,链接器将采用在PDB中复制的,并使用其4 kB页大小。

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.

推荐答案

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

There is indeed a max limit of 1GB for the pdb size. There is some trick to extend this to 2GB (more info about that can be found Here). Basically you have to generate the initial pdb file yourself instead of the compiler.

你可以做的其他事情是在你的模板代码上做一些主动提升,因为这可能会影响你的pdb尺寸也。

Other things you could do is do some active hoisting on your template code as this might effect your pdb sizes also.

这篇关于LNK1201 Visual C ++ 2010大型项目无法生成PDB的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆