GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix: restore externalized Node.js dep compatibility by richardlau · Pull Request #3421 · nodejs/undici

Conversation

@richardlau

@richardlau richardlau commented Jul 26, 2024

Copy link
Copy Markdown
Member

This relates to...

Fixes: #3345
Refs: #2643

Rationale

Changes were previously accepted to allow Undici to be built to work with Node.js' --shared-builtin-undici/undici-path configure option. This allows Undici to exist on disk instead of being compiled into the Node.js binary. This is used by downstream Node.js packagers (e.g. Linux distributions, such as Fedora) that require the ability to build everything from source (including all dependencies and tooling).

This functionality was regressed by #3074 and was not noticed as nothing in this repository broke.

Changes

Restore the ability to build Undici compatible with Node.js' configure --shared-builtin-undici/undici-path ... build option and adds a workflow to test this configuration.

Scopes the hasApk conditional to only cover the part that requires apk. This allows build/wasm.js to be run on a non-Alpine based Linux distribution.

Makes the WASM optimizer (binaryen) optional to allow building on Linux distributions that do not package binaryen and must be able to rebuild everything (including tooling) from source.

Features

N/A

Bug Fixes

  • Restore the ability to build Undici usable with Node.js built with configure --shared-builtin-undici/undici-path ....

Breaking Changes and Deprecations

N/A

Status

  • I have read and agreed to the Developer's Certificate of Origin
  • Tested
  • Benchmarked (optional)
  • Documented
  • Review ready
  • In review
  • Merge ready

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@richardlau richardlau mentioned this pull request Jul 26, 2024
Ability to externalize WASM was broken #3345
Closed
github-advanced-security[bot]
github-advanced-security AI found potential problems Jul 26, 2024
View reviewed changes
Comment thread build/wasm.js Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread build/wasm.js Resolved

Uh oh!

There was an error while loading. Please reload this page.

richardlau
richardlau commented Jul 26, 2024
View reviewed changes
Comment thread .github/workflows/nodejs.yml Outdated

- name: Run tests
working-directory: ./node-${{ steps.release.outputs.result }}
run: tools/test.py -p dots --flaky-tests=dontcare

@richardlau richardlau Jul 26, 2024

Copy link
Copy Markdown
Member Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

This seems to take about 10 mins on GitHub runners. We could run less, but I wasn't able to easily identify a subset of Node.js tests that cover the functionality that Undici provides to Node.js.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
richardlau
richardlau commented Jul 26, 2024
View reviewed changes
Comment thread .github/workflows/nodejs.yml Outdated
runs-on: ubuntu-latest
timeout-minutes: 120
steps:
# Checkout into a subdirectory otherwise Node.js tests will break due to finding Undici's package.json in a parent directory.

@richardlau richardlau Jul 26, 2024

Copy link
Copy Markdown
Member Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

FWIW Node.js tests that break if a package.json is found in a parent directory of Node.js' tests:

  • Node.js 20: test-policy-*. The policy feature is removed from Node.js 22 and main so the tests don't exist there.
  • Node.js 22: test-node-run.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
richardlau
richardlau commented Jul 26, 2024
View reviewed changes
Comment thread CONTRIBUTING.md
To enable this, pass `EXTERNAL_PATH=/path/to/global/node_modules/undici` to `build/wasm.js`.
You shall also pass this path to `--shared-builtin-undici/undici-path` in Node.js's `configure.py`.
Pass this path with `loader.js` appended to `--shared-builtin-undici/undici-path` in Node.js's `configure.py`.
If building on a non-Alpine Linux distribution, you may need to also set the `WASM_CC`, `WASM_CFLAGS`, `WASM_LDFLAGS` and `WASM_LDLIBS` environment variables before running `build/wasm.js`.

@richardlau richardlau Jul 26, 2024

Copy link
Copy Markdown
Member Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

The exact value of what to set the environment variables to differ by Linux distribution.

See the workflow file for the Ubuntu 22.04 settings, and https://src.fedoraproject.org/rpms/nodejs-undici/blob/rawhide/f/nodejs-undici.spec for Fedora.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
metcoder95
metcoder95 approved these changes Jul 26, 2024
View reviewed changes

@metcoder95 metcoder95 left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Overall LGTM, but prefer to wait for either @Uzlopak or @mcollina review

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@mcollina

mcollina commented Jul 26, 2024

Copy link
Copy Markdown
Member

Can you please create a separate action for this? It'll be easy to backport and maintain long term.

(main is currently targeting v7, what will hopefully be included in Node v23).

richardlau reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

richardlau added 2 commits July 26, 2024 11:38
@richardlau
fix: restore externalized Node.js dep compatibility
25547d6
Restore the ability to build Undici compatible with Node.js'
`configure --shared-builtin-undici/undici-path ...` build option.

Scopes the `hasApk` conditional to only cover the part that requires
`apk`.

Makes the WASM optimizer (binaryen) optional to allow building on
Linux distributions that do not package `binaryen` and must be able
to rebuild everything (including tooling) from source.
@richardlau
ci: add workflow for externalized Node.js dep
989fbf5
Add a workflow to test building Undici in a way compatible with Node.js
built with `configure --shared-builtin-undici/undici-path ...`.

This configuration is used by downstream Node.js packagers (e.g. Fedora)
who require the ability to be able to build everything from source.
@richardlau
richardlau force-pushed the external branch from 88ee741 to 989fbf5 Compare July 26, 2024 12:09
@richardlau

richardlau commented Jul 26, 2024

Copy link
Copy Markdown
Member Author

Can you please create a separate action for this? It'll be easy to backport and maintain long term.

@mcollina I've split off the added CI into a separate workflow and commit.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

mcollina
mcollina approved these changes Jul 26, 2024
View reviewed changes

@mcollina mcollina left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

lgtm

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@mcollina
mcollina merged commit 69825dc into main Jul 29, 2024
@mcollina

mcollina commented Jul 29, 2024

Copy link
Copy Markdown
Member

@richardlau do you need a release of v6 with this change? So it can easily be backported down to Node.js v20 and v22?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@richardlau

richardlau commented Jul 29, 2024

Copy link
Copy Markdown
Member Author

@richardlau do you need a release of v6 with this change? So it can easily be backported down to Node.js v20 and v22?

If possible, yes, otherwise @khardix is going to have to float a patch for Fedora/RHEL.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

mcollina pushed a commit that referenced this pull request Jul 31, 2024
@richardlau @mcollina
fix: restore externalized Node.js dep compatibility (#3421)
93605ab
* fix: restore externalized Node.js dep compatibility

Restore the ability to build Undici compatible with Node.js'
`configure --shared-builtin-undici/undici-path ...` build option.

Scopes the `hasApk` conditional to only cover the part that requires
`apk`.

Makes the WASM optimizer (binaryen) optional to allow building on
Linux distributions that do not package `binaryen` and must be able
to rebuild everything (including tooling) from source.

* ci: add workflow for externalized Node.js dep

Add a workflow to test building Undici in a way compatible with Node.js
built with `configure --shared-builtin-undici/undici-path ...`.

This configuration is used by downstream Node.js packagers (e.g. Fedora)
who require the ability to be able to build everything from source.
@Uzlopak
Uzlopak deleted the external branch August 1, 2024 09:57
@khardix khardix mentioned this pull request Aug 13, 2024
build: parametrize the location of wasm-opt #3454
Merged
3 of 6 tasks
@github-actions github-actions Bot mentioned this pull request Dec 3, 2024
[Release] v7.1.0 #3922
Merged
This was referenced Dec 16, 2024
[Release] v7.1.1 #3952
Closed
[Release] v7.2.0 #3962
Merged
@github-actions github-actions Bot mentioned this pull request Mar 12, 2025
[Release] v6.21.2 #4092
Closed
@github-actions github-actions Bot mentioned this pull request May 12, 2025
[Release] v6.21.3 #4211
Closed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@mcollina mcollina mcollina approved these changes
@metcoder95 metcoder95 metcoder95 approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Ability to externalize WASM was broken

Uh oh!

There was an error while loading. Please reload this page.

4 participants

@richardlau @mcollina @metcoder95 @github-advanced-security
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.