Skip to content

build: build codecache and snapshot with libnode#63626

Open
legendecas wants to merge 4 commits into
nodejs:mainfrom
legendecas:static-intermediate
Open

build: build codecache and snapshot with libnode#63626
legendecas wants to merge 4 commits into
nodejs:mainfrom
legendecas:static-intermediate

Conversation

@legendecas
Copy link
Copy Markdown
Member

@legendecas legendecas commented May 28, 2026

This refactors the node and libnode targets, splitting the node_mksnapshot action from the node exe target, and adding a (always) static node_base target, allowing libnode to depend on node_mksnapshot exe, enabling the node startup snapshot when building with flag --shared.

The new dependency graph would be like:

node (executable)
└── libnode (static or shared)
    ├── node_base (static, whole-archived by `node` when not `--shared`)
    │   ├── node_js2c#host
    │   └── <all C++ sources + js2c generated source>
    ├── node_mksnapshot (executable, build-time)
    │   └── node_base
    └── node_snapshot.cc (generated by `node_mksnapshot`)
        OR node_snapshot_stub.cc

cctest, fuzz_*, embedtest, etc.
└── libnode

@nodejs-github-bot
Copy link
Copy Markdown
Collaborator

Review requested:

  • @nodejs/gyp

@nodejs-github-bot nodejs-github-bot added build Issues and PRs related to build files or the CI. needs-ci PRs that need a full CI run. labels May 28, 2026
@legendecas legendecas force-pushed the static-intermediate branch 2 times, most recently from adf769d to fac4309 Compare May 28, 2026 20:16
Signed-off-by: Chengzhong Wu <cwu631@bloomberg.net>
@legendecas legendecas force-pushed the static-intermediate branch from fac4309 to e880392 Compare May 28, 2026 20:17
Copy link
Copy Markdown
Member

@joyeecheung joyeecheung left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. LGTM if CI is happy!

Comment thread configure.py
else:
o['variables']['node_use_node_snapshot'] = b(
not cross_compiling and not options.shared)
o['variables']['node_use_node_snapshot'] = b(not cross_compiling)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Non-blocking but a couple of lines above, there's also another guard that errors out on --shared for node_snapshot_main, which I think is also fixed by this PR and can be removed?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Technically yeah, but I haven't tested with node_snapshot_main. Will give it a shot.

@joyeecheung joyeecheung added the request-ci Add this label to start a Jenkins CI on a PR. label May 28, 2026
@github-actions github-actions Bot removed the request-ci Add this label to start a Jenkins CI on a PR. label May 28, 2026
@nodejs-github-bot
Copy link
Copy Markdown
Collaborator

@nodejs-github-bot
Copy link
Copy Markdown
Collaborator

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

build Issues and PRs related to build files or the CI. needs-ci PRs that need a full CI run.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants