使用 Cmake、Ninja、PREFast 和 MSVC 时出现日志文件写入错误
打开 /analyze
标志以使用 MSVC 非确定性地运行 Windows 版本的 PREFast 会引发以下错误。我认为这是因为 ninja 试图通过同时编译来自同一目标的文件来优化构建,但由于每个目标都记录到单个文件,因此当另一个进程写入同一日志文件时,MSVC 无法编辑该文件,因为该文件正在编译的另一个进程属于同一目标。
fatal error C1258: Failed to save XML Log file '<path to log file>.xml'. The process cannot access the file because it is being used by another process.
- 我可以为每个目标写入不同的文件吗?
- 我可以让 MSVC 更智能并强制它尝试写入,尽管另一个进程正在写入它吗?
- 我不想将并行作业设置为 1,那么我还有其他选择吗?
Turning on the /analyze
flag to run PREFast for Windows builds using MSVC non deterministically throws the below error. I think this is because ninja is trying to optimize builds by compiling files from the same target simultaneously but since each target logs to a single file, MSVC is not able to edit the file while another process is writing to the same log file because the file the other process is compiling belongs to the same target.
fatal error C1258: Failed to save XML Log file '<path to log file>.xml'. The process cannot access the file because it is being used by another process.
- Can I write to different files per target ?
- Can I make MSVC smarter and force it to attempt to write despte another process writing to it ?
- I don't want to set paralell jobs to 1 , so do I have any other options ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论