Skip to content

build: allow linking shared dependencies in the GN build - #65797

Open
codebytere wants to merge 1 commit into
nodejs:mainfrom
codebytere:build-gn-unbundle-deps
Open

build: allow linking shared dependencies in the GN build#65797
codebytere wants to merge 1 commit into
nodejs:mainfrom
codebytere:build-gn-unbundle-deps

Conversation

@codebytere

Copy link
Copy Markdown
Member

The GN build always compiles the bundled copies of brotli, c-ares, HdrHistogram, llhttp, libuv, nghttp2, SQLite and zstd, so distributions that package a GN-built Node.js have no equivalent of configure --shared-* and end up carrying their own changes to link the system libraries.

This adds node_shared_brotli, node_shared_cares, node_shared_hdr_histogram, node_shared_http_parser, node_shared_libuv, node_shared_nghttp2, node_shared_sqlite and node_shared_zstd to node.gni, named after the GYP variables. When one is set, that dependency's own GN template defines deps/<name> as a group whose public config comes from pkg-config (libbrotlidec/libbrotlienc, libcares, hdr_histogram, libllhttp, libuv, libnghttp2, sqlite3, libzstd) instead of building the sources, so libnode, node_js2c, uvwasi and everything else that already depends on deps/<name> links the system copy with no other edits; shared SQLite keeps SQLITE_ENABLE_SESSION defined since sqlite3.h gates the session API on it. generate_config_gypi.py now reports these in process.config instead of hard-coding false. zlib, ICU and OpenSSL are left to the existing //third_party / node_openssl_path mechanisms, and ada, simdjson and simdutf are left bundled because of the libc++/libstdc++ ABI mismatch raised on the earlier attempt.

This replaces #55903, which stalled on review (its pkg-config configs were declared but never applied and some bundled deps were dropped without a replacement) and was closed as stale; doing the switch inside each dep's template is what avoids that here. Most of the diff is re-indentation, ?w=1 shows the substance. There is no GN coverage in CI, so this is by inspection against the current unofficial.gni; defaults are unchanged.

Refs: #55903


Disclosure: the code and this description were written by Claude Code, directed and reviewed by @codebytere.

The GN build always compiles the bundled copies of brotli, c-ares,
HdrHistogram, llhttp, libuv, nghttp2, SQLite and zstd, so anyone
packaging a GN-built Node.js for a Linux distribution has no
counterpart to configure's --shared-* options.

Add node_shared_* args named after the GYP variables. When one is set,
that dependency's GN template defines its target as a group carrying a
pkg-config config instead of the bundled sources, so every existing
"deps/<name>" reference picks up the system library without further
changes, and config.gypi reports the choice like a GYP build does.

Refs: nodejs#55903
Signed-off-by: Shelley Vohr <shelley.vohr@gmail.com>
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Review requested:

  • @nodejs/http
  • @nodejs/http2
  • @nodejs/net
  • @nodejs/security-wg
  • @nodejs/sqlite

@nodejs-github-bot nodejs-github-bot added brotli Issues and PRs related to the Brotli dependency. cares Issues and PRs related to the c-ares dependency or the cares_wrap binding. dependencies PRs that add, update, or configure Node.js dependencies. http2 Issues and PRs related to the http2 subsystem. libuv Issues and PRs related to the libuv dependency or the uv binding. needs-ci PRs that need a full CI run. sqlite Issues and PRs related to the SQLite subsystem. tools Issues and PRs related to the tools directory. labels Sep 4, 2026
@nodejs-github-bot

This comment was marked as outdated.

@bjohansebas bjohansebas added the request-ci Add this label to start a Jenkins CI on a PR. label Sep 5, 2026
@panva panva removed the request-ci Add this label to start a Jenkins CI on a PR. label Sep 5, 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

brotli Issues and PRs related to the Brotli dependency. cares Issues and PRs related to the c-ares dependency or the cares_wrap binding. dependencies PRs that add, update, or configure Node.js dependencies. http2 Issues and PRs related to the http2 subsystem. libuv Issues and PRs related to the libuv dependency or the uv binding. needs-ci PRs that need a full CI run. sqlite Issues and PRs related to the SQLite subsystem. tools Issues and PRs related to the tools directory.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants