New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 628615 link

Starred by 3 users

Issue metadata

Status: Untriaged
Owner: ----
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Windows
Pri: 2
Type: Bug



Sign in to add a comment

pch in Windows consists of two files but gn only lists one of them in the ninja file

Project Member Reported by brat...@opera.com, Jul 15 2016

Issue description

When you build a pch file in Visual Studio, the compiler generates one "Precompiled.obj" and one "Precompiled.pch" file, but only one of them is included as dependency in the generated ninja file.

Looking at the source code of gn I wonder if the problem is GetPCHOutputFiles() in ninja_binary_target_writer.cc. It will only return one file.

Most times this will not be a problem, but if you delete the "forgotten" of the two files, and recompile, ninja will not know to regenerate it.

This turned up as a problem from a tool reading ninja files and I don't know if this ever cause real problems in a compilation.
 
Cc: brucedaw...@chromium.org
Labels: -Pri-3 Pri-2
Seems worth fixing, just so that forcing a rebuild by deleting files will work correctly.

Which file is listed in the .ninja files?

Comment 3 by brat...@opera.com, Jul 27 2016

It is the .obj file that is listed in the .ninja file, and the .pch that is never listed.

There is also no rule to generate the pch file. The rule for building the .obj looks like:

build obj/third_party/WebKit/Source/core/dom/Precompile-core.cc.obj: cxx ../../third_party/WebKit/Source/core/win/Precompile-core.cpp || obj/third_party/WebKit/Source/core/dom.inputdeps.stamp
  cflags_cc = ${cflags_cc} /Yc../../third_party/WebKit/Source/core/win/Precompile-core.h


Is there a way to specify more than one output file? There ought to be.

Anyway, if you delete the pch file (in the example below obj/third_party/WebKit/Source/core/html_cc.pch) and force a recompile of some cpp file using that pch file you will get this:

[1/28] CXX obj/third_party/WebKit/Source/core/html/BackgroundHTMLParser.obj
FAILED: obj/third_party/WebKit/Source/core/html/BackgroundHTMLParser.obj
ninja -t msvc -e environment.x86 -- "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\amd64_x86/cl.exe" /nologo /showIncludes /FC @obj/third_party/WebKit/Source/core/html/BackgroundHTMLParser.obj.rsp /c ../../third_party/WebKit/Source/core/html/parser/BackgroundHTMLParser.cpp /Foobj/third_party/WebKit/Source/core/html/BackgroundHTMLParser.obj /Fd"obj/third_party/WebKit/Source/core/html_cc.pdb"
l:\src\opera\chromium\src\third_party\webkit\source\core\html\parser\backgroundhtmlparser.cpp: fatal error C1083: Cannot open precompiled header file: 'obj/third_party/WebKit/Source/core/html_cc.pch': No such file or directory
ninja: build stopped: subcommand failed.

Components: Build
Cc: thakis@chromium.org brat...@opera.com zturner@chromium.org
 Issue 361651  has been merged into this issue.

Sign in to add a comment