Skip to content

fix: build precompiled headers after generated inputs - #360

Open
kevin-sellers wants to merge 1 commit into
nodejs:mainfrom
kevin-sellers:fix-pch-order-only
Open

fix: build precompiled headers after generated inputs#360
kevin-sellers wants to merge 1 commit into
nodejs:mainfrom
kevin-sellers:fix-pch-order-only

Conversation

@kevin-sellers

Copy link
Copy Markdown

Object files get a target's dependencies, and its actions and rules outputs, as
order-only prerequisites. The .gch built from a prefix header gets neither, so
a prefix header that reaches a generated header races code generation: make
starts the .gch as soon as the prefix header itself exists, and a clean build
fails on the missing generated header.

This gives the .gch targets the same order-only prerequisites the object files
get.

Motivation

I was attempting to enable precompiled headers for V8's largest targets in a
Node.js build. The prefix header includes isolate-inl.h, which reaches
builtins-definitions.h, which includes the generated
builtins-generated/bytecodes-builtins-list.h. A clean build died with:

../deps/v8/src/builtins/builtins-definitions.h:8:10: fatal error:
    builtins-generated/bytecodes-builtins-list.h: No such file or directory

Any target whose GCC_PREFIX_HEADER transitively includes generated code hits
this today, independently of how the prefix header was configured.

Testing

Adds TestGypMac.test_make_prefix_header_waits_for_generated_inputs, driving
the existing GCC_PREFIX_HEADER / GCC_PRECOMPILE_PREFIX_HEADER path with a
fixture whose target both names a prefix header and has an action producing a
generated header. It asserts the object depends on the .gch and that the
.gch carries the order-only edge on the action output.

Object files get a target's dependencies, and its actions and rules
outputs, as order-only prerequisites. The .gch built from a prefix
header got neither, so a prefix header that reaches a generated header
races code generation: make starts the .gch as soon as the prefix header
itself exists, and a clean build fails on the missing generated header.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant