2016-09-20 06:54:35 +02:00
|
|
|
# Building Node.js
|
2016-03-10 00:41:52 +01:00
|
|
|
|
2018-10-08 18:24:37 +02:00
|
|
|
Depending on what platform or features you need, the build process may
|
|
|
|
differ. After you've built a binary, running the
|
|
|
|
test suite to confirm that the binary works as intended is a good next step.
|
2016-03-10 00:41:52 +01:00
|
|
|
|
2018-10-08 18:24:37 +02:00
|
|
|
If you can reproduce a test failure, search for it in the
|
2016-03-10 00:41:52 +01:00
|
|
|
[Node.js issue tracker](https://github.com/nodejs/node/issues) or
|
|
|
|
file a new issue.
|
|
|
|
|
2021-02-06 17:14:25 +01:00
|
|
|
## Table of contents
|
2018-09-28 16:45:44 +02:00
|
|
|
|
2018-10-20 03:33:00 +02:00
|
|
|
* [Supported platforms](#supported-platforms)
|
|
|
|
* [Input](#input)
|
|
|
|
* [Strategy](#strategy)
|
2019-03-17 12:31:29 +01:00
|
|
|
* [Platform list](#platform-list)
|
2018-10-20 03:33:00 +02:00
|
|
|
* [Supported toolchains](#supported-toolchains)
|
2019-03-17 12:31:29 +01:00
|
|
|
* [Official binary platforms and toolchains](#official-binary-platforms-and-toolchains)
|
2018-10-20 03:33:00 +02:00
|
|
|
* [OpenSSL asm support](#openssl-asm-support)
|
2019-03-17 12:31:29 +01:00
|
|
|
* [Previous versions of this document](#previous-versions-of-this-document)
|
2018-10-20 03:33:00 +02:00
|
|
|
* [Building Node.js on supported platforms](#building-nodejs-on-supported-platforms)
|
2020-12-30 15:09:52 +01:00
|
|
|
* [Note about Python](#note-about-python)
|
2019-06-28 10:01:02 +02:00
|
|
|
* [Unix and macOS](#unix-and-macos)
|
|
|
|
* [Unix prerequisites](#unix-prerequisites)
|
|
|
|
* [macOS prerequisites](#macos-prerequisites)
|
2019-11-06 12:49:27 +01:00
|
|
|
* [Building Node.js](#building-nodejs-1)
|
2020-10-19 20:27:32 +02:00
|
|
|
* [Installing Node.js](#installing-nodejs)
|
2018-10-20 03:33:00 +02:00
|
|
|
* [Running Tests](#running-tests)
|
2018-10-29 06:59:56 +01:00
|
|
|
* [Running Coverage](#running-coverage)
|
2018-10-20 03:33:00 +02:00
|
|
|
* [Building the documentation](#building-the-documentation)
|
|
|
|
* [Building a debug build](#building-a-debug-build)
|
2020-03-23 13:07:29 +01:00
|
|
|
* [Building an ASAN build](#building-an-asan-build)
|
2020-12-09 13:29:15 +01:00
|
|
|
* [Speeding up frequent rebuilds when developing](#speeding-up-frequent-rebuilds-when-developing)
|
2020-01-28 01:58:07 +01:00
|
|
|
* [Troubleshooting Unix and macOS builds](#troubleshooting-unix-and-macos-builds)
|
2019-03-17 12:31:29 +01:00
|
|
|
* [Windows](#windows)
|
2019-07-06 07:35:56 +02:00
|
|
|
* [Prerequisites](#prerequisites)
|
2019-06-28 10:01:02 +02:00
|
|
|
* [Option 1: Manual install](#option-1-manual-install)
|
2019-11-06 12:49:27 +01:00
|
|
|
* [Option 2: Automated install with Boxstarter](#option-2-automated-install-with-boxstarter)
|
2020-01-28 01:58:07 +01:00
|
|
|
* [Building Node.js](#building-nodejs-2)
|
2022-08-12 12:29:23 +02:00
|
|
|
* [Android](#android)
|
2019-06-28 10:01:02 +02:00
|
|
|
* [`Intl` (ECMA-402) support](#intl-ecma-402-support)
|
|
|
|
* [Build with full ICU support (all locales supported by ICU)](#build-with-full-icu-support-all-locales-supported-by-icu)
|
|
|
|
* [Unix/macOS](#unixmacos)
|
|
|
|
* [Windows](#windows-1)
|
2019-09-30 20:17:49 +02:00
|
|
|
* [Trimmed: `small-icu` (English only) support](#trimmed-small-icu-english-only-support)
|
2019-06-28 10:01:02 +02:00
|
|
|
* [Unix/macOS](#unixmacos-1)
|
|
|
|
* [Windows](#windows-2)
|
2019-09-30 20:17:49 +02:00
|
|
|
* [Building without Intl support](#building-without-intl-support)
|
2019-06-28 10:01:02 +02:00
|
|
|
* [Unix/macOS](#unixmacos-2)
|
|
|
|
* [Windows](#windows-3)
|
2020-01-28 01:58:07 +01:00
|
|
|
* [Use existing installed ICU (Unix/macOS only)](#use-existing-installed-icu-unixmacos-only)
|
2019-09-30 20:17:49 +02:00
|
|
|
* [Build with a specific ICU](#build-with-a-specific-icu)
|
|
|
|
* [Unix/macOS](#unixmacos-3)
|
|
|
|
* [Windows](#windows-4)
|
2022-05-14 10:04:48 +02:00
|
|
|
* [Configuring OpenSSL config appname](#configure-openssl-appname)
|
2018-10-20 03:33:00 +02:00
|
|
|
* [Building Node.js with FIPS-compliant OpenSSL](#building-nodejs-with-fips-compliant-openssl)
|
|
|
|
* [Building Node.js with external core modules](#building-nodejs-with-external-core-modules)
|
2019-09-30 20:17:49 +02:00
|
|
|
* [Unix/macOS](#unixmacos-4)
|
|
|
|
* [Windows](#windows-5)
|
2019-03-17 12:31:29 +01:00
|
|
|
* [Note for downstream distributors of Node.js](#note-for-downstream-distributors-of-nodejs)
|
2018-09-28 16:45:44 +02:00
|
|
|
|
2017-03-17 22:34:54 +01:00
|
|
|
## Supported platforms
|
|
|
|
|
2018-01-05 00:37:53 +01:00
|
|
|
This list of supported platforms is current as of the branch/release to
|
2018-10-30 05:51:55 +01:00
|
|
|
which it belongs.
|
2017-03-17 22:34:54 +01:00
|
|
|
|
|
|
|
### Input
|
|
|
|
|
2018-10-12 02:15:15 +02:00
|
|
|
Node.js relies on V8 and libuv. We adopt a subset of their supported platforms.
|
2017-03-17 22:34:54 +01:00
|
|
|
|
|
|
|
### Strategy
|
|
|
|
|
2018-10-30 05:51:55 +01:00
|
|
|
There are three support tiers:
|
2017-03-17 22:34:54 +01:00
|
|
|
|
2019-03-17 12:31:29 +01:00
|
|
|
* **Tier 1**: These platforms represent the majority of Node.js users. The
|
|
|
|
Node.js Build Working Group maintains infrastructure for full test coverage.
|
2019-12-02 15:13:57 +01:00
|
|
|
Test failures on tier 1 platforms will block releases.
|
2019-03-17 12:31:29 +01:00
|
|
|
* **Tier 2**: These platforms represent smaller segments of the Node.js user
|
|
|
|
base. The Node.js Build Working Group maintains infrastructure for full test
|
2019-12-09 15:19:36 +01:00
|
|
|
coverage. Test failures on tier 2 platforms will block releases.
|
|
|
|
Infrastructure issues may delay the release of binaries for these platforms.
|
2019-03-17 12:31:29 +01:00
|
|
|
* **Experimental**: May not compile or test suite may not pass. The core team
|
|
|
|
does not create releases for these platforms. Test failures on experimental
|
|
|
|
platforms do not block releases. Contributions to improve support for these
|
|
|
|
platforms are welcome.
|
|
|
|
|
|
|
|
Platforms may move between tiers between major release lines. The table below
|
2019-12-23 16:17:40 +01:00
|
|
|
will reflect those changes.
|
2019-03-17 12:31:29 +01:00
|
|
|
|
|
|
|
### Platform list
|
|
|
|
|
2019-12-11 16:03:05 +01:00
|
|
|
Node.js compilation/execution support depends on operating system, architecture,
|
|
|
|
and libc version. The table below lists the support tier for each supported
|
|
|
|
combination. A list of [supported compile toolchains](#supported-toolchains) is
|
|
|
|
also supplied for tier 1 platforms.
|
2019-03-17 12:31:29 +01:00
|
|
|
|
|
|
|
**For production applications, run Node.js on supported platforms only.**
|
2017-04-26 18:59:53 +02:00
|
|
|
|
2019-01-30 23:53:21 +01:00
|
|
|
Node.js does not support a platform version if a vendor has expired support
|
2019-03-05 00:32:34 +01:00
|
|
|
for it. In other words, Node.js does not support running on End-of-Life (EoL)
|
2019-01-30 23:53:21 +01:00
|
|
|
platforms. This is true regardless of entries in the table below.
|
|
|
|
|
2022-04-14 16:57:28 +02:00
|
|
|
| Operating System | Architectures | Versions | Support Type | Notes |
|
|
|
|
| ---------------- | ---------------- | --------------------------------- | ----------------------------------------------- | ------------------------------------ |
|
|
|
|
| GNU/Linux | x64 | kernel >= 4.18[^1], glibc >= 2.28 | Tier 1 | e.g. Ubuntu 20.04, Debian 10, RHEL 8 |
|
|
|
|
| GNU/Linux | x64 | kernel >= 3.10, musl >= 1.1.19 | Experimental | e.g. Alpine 3.8 |
|
|
|
|
| GNU/Linux | x86 | kernel >= 3.10, glibc >= 2.17 | Experimental | Downgraded as of Node.js 10 |
|
|
|
|
| GNU/Linux | arm64 | kernel >= 4.18[^1], glibc >= 2.28 | Tier 1 | e.g. Ubuntu 20.04, Debian 10, RHEL 8 |
|
|
|
|
| GNU/Linux | armv7 | kernel >= 4.18[^1], glibc >= 2.28 | Tier 1 | e.g. Ubuntu 20.04, Debian 10 |
|
|
|
|
| GNU/Linux | armv6 | kernel >= 4.14, glibc >= 2.24 | Experimental | Downgraded as of Node.js 12 |
|
|
|
|
| GNU/Linux | ppc64le >=power8 | kernel >= 4.18[^1], glibc >= 2.28 | Tier 2 | e.g. Ubuntu 20.04, RHEL 8 |
|
|
|
|
| GNU/Linux | s390x | kernel >= 4.18[^1], glibc >= 2.28 | Tier 2 | e.g. RHEL 8 |
|
|
|
|
| Windows | x64, x86 (WoW64) | >= Windows 10/Server 2016 | Tier 1 | [^2],[^3] |
|
|
|
|
| Windows | x86 (native) | >= Windows 10/Server 2016 | Tier 1 (running) / Experimental (compiling)[^4] | |
|
|
|
|
| Windows | x64, x86 | Windows 8.1/Server 2012 | Experimental | |
|
|
|
|
| Windows | arm64 | >= Windows 10 | Tier 2 (compiling) / Experimental (running) | |
|
|
|
|
| macOS | x64 | >= 10.15 | Tier 1 | For notes about compilation see [^5] |
|
|
|
|
| macOS | arm64 | >= 11 | Tier 1 | |
|
|
|
|
| SmartOS | x64 | >= 18 | Tier 2 | |
|
|
|
|
| AIX | ppc64be >=power8 | >= 7.2 TL04 | Tier 2 | |
|
|
|
|
| FreeBSD | x64 | >= 12.2 | Experimental | |
|
2022-04-13 08:36:08 +02:00
|
|
|
|
|
|
|
[^1]: Older kernel versions may work. However official Node.js release
|
|
|
|
binaries are [built on RHEL 8 systems](#official-binary-platforms-and-toolchains)
|
|
|
|
with kernel 4.18.
|
|
|
|
|
|
|
|
[^2]: On Windows, running Node.js in Windows terminal emulators
|
2021-10-16 04:52:13 +02:00
|
|
|
like `mintty` requires the usage of [winpty](https://github.com/rprichard/winpty)
|
|
|
|
for the tty channels to work (e.g. `winpty node.exe script.js`).
|
|
|
|
In "Git bash" if you call the node shell alias (`node` without the `.exe`
|
|
|
|
extension), `winpty` is used automatically.
|
|
|
|
|
2022-04-13 08:36:08 +02:00
|
|
|
[^3]: The Windows Subsystem for Linux (WSL) is not
|
2021-10-16 04:52:13 +02:00
|
|
|
supported, but the GNU/Linux build process and binaries should work. The
|
|
|
|
community will only address issues that reproduce on native GNU/Linux
|
|
|
|
systems. Issues that only reproduce on WSL should be reported in the
|
|
|
|
[WSL issue tracker](https://github.com/Microsoft/WSL/issues). Running the
|
2021-11-25 22:13:17 +01:00
|
|
|
Windows binary (`node.exe`) in WSL will not work without workarounds such as
|
|
|
|
stdio redirection.
|
2021-10-16 04:52:13 +02:00
|
|
|
|
2022-04-14 16:57:28 +02:00
|
|
|
[^4]: Running Node.js on x86 Windows should work and binaries
|
|
|
|
are provided. However, tests in our infrastructure only run on WoW64.
|
|
|
|
Furthermore, compiling on x86 Windows is Experimental and
|
|
|
|
may not be possible.
|
2021-10-16 04:52:13 +02:00
|
|
|
|
2022-04-13 08:36:08 +02:00
|
|
|
[^5]: Our macOS x64 Binaries are compiled with 10.15 as a target. Xcode11 is
|
2021-10-16 04:52:13 +02:00
|
|
|
required to compile.
|
2021-07-30 12:05:50 +02:00
|
|
|
|
2017-03-17 22:34:54 +01:00
|
|
|
### Supported toolchains
|
|
|
|
|
2018-10-30 18:31:18 +01:00
|
|
|
Depending on the host platform, the selection of toolchains may vary.
|
2017-03-17 22:34:54 +01:00
|
|
|
|
2019-03-17 12:31:29 +01:00
|
|
|
| Operating System | Compiler Versions |
|
|
|
|
| ---------------- | -------------------------------------------------------------- |
|
2021-03-23 10:33:08 +01:00
|
|
|
| Linux | GCC >= 8.3 |
|
2020-06-02 11:04:17 +02:00
|
|
|
| Windows | Visual Studio >= 2019 with the Windows 10 SDK on a 64-bit host |
|
2021-03-23 10:48:45 +01:00
|
|
|
| macOS | Xcode >= 11 (Apple LLVM >= 11) |
|
2019-03-17 12:31:29 +01:00
|
|
|
|
|
|
|
### Official binary platforms and toolchains
|
|
|
|
|
|
|
|
Binaries at <https://nodejs.org/download/release/> are produced on:
|
|
|
|
|
2021-04-13 17:10:15 +02:00
|
|
|
| Binary package | Platform and Toolchain |
|
2021-10-05 05:36:45 +02:00
|
|
|
| ----------------------- | ------------------------------------------------------------------------------------------------------------- |
|
2021-04-13 17:10:15 +02:00
|
|
|
| aix-ppc64 | AIX 7.2 TL04 on PPC64BE with GCC 8 |
|
2022-03-18 17:53:27 +01:00
|
|
|
| darwin-x64 | macOS 10.15, Xcode Command Line Tools 11 with -mmacosx-version-min=10.15 |
|
|
|
|
| darwin-arm64 (and .pkg) | macOS 11 (arm64), Xcode Command Line Tools 12 with -mmacosx-version-min=10.15 |
|
2022-04-13 08:36:08 +02:00
|
|
|
| linux-arm64 | RHEL 8 with GCC 8[^6] |
|
2021-04-13 17:10:15 +02:00
|
|
|
| linux-armv7l | Cross-compiled on Ubuntu 18.04 x64 with [custom GCC toolchain](https://github.com/rvagg/rpi-newer-crosstools) |
|
2022-04-13 08:36:08 +02:00
|
|
|
| linux-ppc64le | RHEL 8 with GCC 8[^6] |
|
|
|
|
| linux-s390x | RHEL 8 with GCC 8[^6] |
|
|
|
|
| linux-x64 | RHEL 8 with GCC 8[^6] |
|
2021-04-13 17:10:15 +02:00
|
|
|
| win-x64 and win-x86 | Windows 2012 R2 (x64) with Visual Studio 2019 |
|
2019-03-17 12:31:29 +01:00
|
|
|
|
2022-04-13 08:36:08 +02:00
|
|
|
[^6]: Binaries produced on these systems are compatible with glibc >= 2.28
|
|
|
|
and libstdc++ >= 6.0.25 (`GLIBCXX_3.4.25`). These are available on
|
|
|
|
distributions natively supporting GCC 8.1 or higher, such as Debian 10,
|
|
|
|
RHEL 8 and Ubuntu 20.04.
|
2017-03-17 22:34:54 +01:00
|
|
|
|
2018-03-07 14:31:05 +01:00
|
|
|
#### OpenSSL asm support
|
|
|
|
|
2018-11-10 02:54:00 +01:00
|
|
|
OpenSSL-1.1.1 requires the following assembler version for use of asm
|
2021-09-18 02:23:11 +02:00
|
|
|
support on x86\_64 and ia32.
|
2018-03-07 14:31:05 +01:00
|
|
|
|
2018-11-10 02:54:00 +01:00
|
|
|
For use of AVX-512,
|
|
|
|
|
|
|
|
* gas (GNU assembler) version 2.26 or higher
|
|
|
|
* nasm version 2.11.8 or higher in Windows
|
|
|
|
|
2019-06-20 21:19:27 +02:00
|
|
|
AVX-512 is disabled for Skylake-X by OpenSSL-1.1.1.
|
2018-11-10 02:54:00 +01:00
|
|
|
|
|
|
|
For use of AVX2,
|
|
|
|
|
2018-03-07 14:31:05 +01:00
|
|
|
* gas (GNU assembler) version 2.23 or higher
|
2018-11-08 07:43:45 +01:00
|
|
|
* Xcode version 5.0 or higher
|
2018-03-07 14:31:05 +01:00
|
|
|
* llvm version 3.3 or higher
|
|
|
|
* nasm version 2.10 or higher in Windows
|
|
|
|
|
2018-11-10 02:54:00 +01:00
|
|
|
Please refer to
|
2021-09-18 02:23:11 +02:00
|
|
|
<https://www.openssl.org/docs/man1.1.1/man3/OPENSSL_ia32cap.html> for details.
|
2018-03-07 14:31:05 +01:00
|
|
|
|
2021-09-18 02:23:11 +02:00
|
|
|
If compiling without one of the above, use `configure` with the
|
2018-11-10 02:54:00 +01:00
|
|
|
`--openssl-no-asm` flag. Otherwise, `configure` will fail.
|
|
|
|
|
2019-03-17 12:31:29 +01:00
|
|
|
### Previous versions of this document
|
|
|
|
|
|
|
|
Supported platforms and toolchains change with each major version of Node.js.
|
|
|
|
This document is only valid for the current major version of Node.js.
|
|
|
|
Consult previous versions of this document for older versions of Node.js:
|
|
|
|
|
2022-01-22 20:09:01 +01:00
|
|
|
* [Node.js 17](https://github.com/nodejs/node/blob/v17.x/BUILDING.md)
|
|
|
|
* [Node.js 16](https://github.com/nodejs/node/blob/v16.x/BUILDING.md)
|
2021-01-26 17:44:33 +01:00
|
|
|
* [Node.js 14](https://github.com/nodejs/node/blob/v14.x/BUILDING.md)
|
2019-11-22 15:32:52 +01:00
|
|
|
* [Node.js 12](https://github.com/nodejs/node/blob/v12.x/BUILDING.md)
|
2019-03-17 12:31:29 +01:00
|
|
|
|
2017-03-17 22:34:54 +01:00
|
|
|
## Building Node.js on supported platforms
|
2016-03-10 00:41:52 +01:00
|
|
|
|
2020-12-30 15:09:52 +01:00
|
|
|
### Note about Python
|
2019-06-28 10:01:02 +02:00
|
|
|
|
2020-12-30 15:09:52 +01:00
|
|
|
The Node.js project supports Python >= 3 for building and testing.
|
2021-09-18 02:23:11 +02:00
|
|
|
|
2019-06-28 10:01:02 +02:00
|
|
|
### Unix and macOS
|
|
|
|
|
|
|
|
#### Unix prerequisites
|
2016-03-10 00:41:52 +01:00
|
|
|
|
2021-10-30 12:55:20 +02:00
|
|
|
* `gcc` and `g++` >= 8.3 or newer
|
2016-03-10 00:41:52 +01:00
|
|
|
* GNU Make 3.81 or newer
|
2021-10-04 09:01:04 +02:00
|
|
|
* Python 3.6, 3.7, 3.8, 3.9, or 3.10 (see note above)
|
2021-10-30 12:55:20 +02:00
|
|
|
* For test coverage, your Python installation must include pip.
|
2019-06-28 10:01:02 +02:00
|
|
|
|
|
|
|
Installation via Linux package manager can be achieved with:
|
|
|
|
|
2021-10-30 12:55:20 +02:00
|
|
|
* Ubuntu, Debian: `sudo apt-get install python3 g++ make python3-pip`
|
|
|
|
* Fedora: `sudo dnf install python3 gcc-c++ make python3-pip`
|
|
|
|
* CentOS and RHEL: `sudo yum install python3 gcc-c++ make python3-pip`
|
|
|
|
* OpenSUSE: `sudo zypper install python3 gcc-c++ make python3-pip`
|
|
|
|
* Arch Linux, Manjaro: `sudo pacman -S python gcc make python-pip`
|
2016-04-20 19:48:22 +02:00
|
|
|
|
2019-06-28 10:01:02 +02:00
|
|
|
FreeBSD and OpenBSD users may also need to install `libexecinfo`.
|
|
|
|
|
|
|
|
#### macOS prerequisites
|
|
|
|
|
2021-04-16 23:40:58 +02:00
|
|
|
* Xcode Command Line Tools >= 11 for macOS
|
2021-10-04 09:01:04 +02:00
|
|
|
* Python 3.6, 3.7, 3.8, 3.9, or 3.10 (see note above)
|
2021-10-30 12:55:20 +02:00
|
|
|
* For test coverage, your Python installation must include pip.
|
2019-06-28 10:01:02 +02:00
|
|
|
|
|
|
|
macOS users can install the `Xcode Command Line Tools` by running
|
2017-05-28 12:57:35 +02:00
|
|
|
`xcode-select --install`. Alternatively, if you already have the full Xcode
|
|
|
|
installed, you can find them under the menu `Xcode -> Open Developer Tool ->
|
|
|
|
More Developer Tools...`. This step will install `clang`, `clang++`, and
|
|
|
|
`make`.
|
2016-12-03 07:56:01 +01:00
|
|
|
|
2019-06-28 10:01:02 +02:00
|
|
|
#### Building Node.js
|
|
|
|
|
2018-02-12 08:31:55 +01:00
|
|
|
If the path to your build directory contains a space, the build will likely
|
|
|
|
fail.
|
2017-07-18 21:03:43 +02:00
|
|
|
|
2016-09-03 05:23:21 +02:00
|
|
|
To build Node.js:
|
2016-04-20 19:48:22 +02:00
|
|
|
|
2016-07-14 11:55:30 +02:00
|
|
|
```console
|
2016-03-10 00:41:52 +01:00
|
|
|
$ ./configure
|
2016-12-01 17:47:46 +01:00
|
|
|
$ make -j4
|
2016-03-10 00:41:52 +01:00
|
|
|
```
|
|
|
|
|
2022-02-25 04:20:41 +01:00
|
|
|
We can speed up the builds by using [Ninja](https://ninja-build.org/). For more
|
|
|
|
information, see
|
|
|
|
[Building Node.js with Ninja](doc/contributing/building-node-with-ninja.md).
|
|
|
|
|
2018-11-08 07:43:45 +01:00
|
|
|
The `-j4` option will cause `make` to run 4 simultaneous compilation jobs which
|
|
|
|
may reduce build time. For more information, see the
|
2021-10-31 00:40:34 +02:00
|
|
|
[GNU Make Documentation](https://www.gnu.org/software/make/manual/html_node/Parallel.html).
|
2016-12-01 17:47:46 +01:00
|
|
|
|
2019-06-20 21:19:27 +02:00
|
|
|
The above requires that `python` resolves to a supported version of
|
2019-03-17 12:31:29 +01:00
|
|
|
Python. See [Prerequisites](#prerequisites).
|
2016-03-10 00:41:52 +01:00
|
|
|
|
2018-08-21 19:28:18 +02:00
|
|
|
After building, setting up [firewall rules](tools/macos-firewall.sh) can avoid
|
|
|
|
popups asking to accept incoming network connections when running tests.
|
|
|
|
|
|
|
|
Running the following script on macOS will add the firewall rules for the
|
|
|
|
executable `node` in the `out` directory and the symbolic `node` link in the
|
|
|
|
project's root directory.
|
|
|
|
|
|
|
|
```console
|
|
|
|
$ sudo ./tools/macos-firewall.sh
|
|
|
|
```
|
|
|
|
|
2020-10-19 20:27:32 +02:00
|
|
|
#### Installing Node.js
|
|
|
|
|
|
|
|
To install this version of Node.js into a system directory:
|
|
|
|
|
|
|
|
```bash
|
|
|
|
[sudo] make install
|
|
|
|
```
|
|
|
|
|
2021-02-06 17:14:25 +01:00
|
|
|
#### Running tests
|
2018-01-09 12:34:11 +01:00
|
|
|
|
|
|
|
To verify the build:
|
|
|
|
|
|
|
|
```console
|
|
|
|
$ make test-only
|
|
|
|
```
|
|
|
|
|
|
|
|
At this point, you are ready to make code changes and re-run the tests.
|
|
|
|
|
2021-11-25 22:13:17 +01:00
|
|
|
If you are running tests before submitting a pull request, use:
|
2016-03-10 00:41:52 +01:00
|
|
|
|
2017-05-28 22:20:21 +02:00
|
|
|
```console
|
2018-04-17 02:46:25 +02:00
|
|
|
$ make -j4 test
|
2016-03-10 00:41:52 +01:00
|
|
|
```
|
|
|
|
|
2018-04-17 02:46:25 +02:00
|
|
|
`make -j4 test` does a full check on the codebase, including running linters and
|
2018-01-09 12:34:11 +01:00
|
|
|
documentation tests.
|
|
|
|
|
2021-11-25 22:13:17 +01:00
|
|
|
To run the linter without running tests, use
|
2019-07-06 20:08:01 +02:00
|
|
|
`make lint`/`vcbuild lint`. It will lint JavaScript, C++, and Markdown files.
|
2018-10-29 06:59:56 +01:00
|
|
|
|
2019-05-04 13:45:48 +02:00
|
|
|
If you are updating tests and want to run tests in a single test file
|
|
|
|
(e.g. `test/parallel/test-stream2-transform.js`):
|
2018-10-12 20:06:32 +02:00
|
|
|
|
|
|
|
```text
|
2021-11-25 22:13:17 +01:00
|
|
|
$ tools/test.py test/parallel/test-stream2-transform.js
|
2018-10-12 20:06:32 +02:00
|
|
|
```
|
|
|
|
|
|
|
|
You can execute the entire suite of tests for a given subsystem
|
|
|
|
by providing the name of a subsystem:
|
|
|
|
|
|
|
|
```text
|
2022-04-21 19:41:38 +02:00
|
|
|
$ tools/test.py child-process
|
2021-11-25 22:13:17 +01:00
|
|
|
```
|
|
|
|
|
2022-04-21 20:14:25 +02:00
|
|
|
You can also execute the tests in a test suite directory
|
|
|
|
(such as `test/message`):
|
2021-11-25 22:13:17 +01:00
|
|
|
|
|
|
|
```text
|
2022-04-21 19:41:38 +02:00
|
|
|
$ tools/test.py test/message
|
2018-10-12 20:06:32 +02:00
|
|
|
```
|
|
|
|
|
|
|
|
If you want to check the other options, please refer to the help by using
|
2018-10-20 03:33:00 +02:00
|
|
|
the `--help` option:
|
2018-10-12 20:06:32 +02:00
|
|
|
|
|
|
|
```text
|
2021-11-25 22:13:17 +01:00
|
|
|
$ tools/test.py --help
|
2018-10-12 20:06:32 +02:00
|
|
|
```
|
|
|
|
|
|
|
|
You can usually run tests directly with node:
|
|
|
|
|
|
|
|
```text
|
|
|
|
$ ./node ./test/parallel/test-stream2-transform.js
|
|
|
|
```
|
|
|
|
|
2018-10-29 06:59:56 +01:00
|
|
|
Remember to recompile with `make -j4` in between test runs if you change code in
|
|
|
|
the `lib` or `src` directories.
|
|
|
|
|
2018-11-14 23:53:59 +01:00
|
|
|
The tests attempt to detect support for IPv6 and exclude IPv6 tests if
|
|
|
|
appropriate. If your main interface has IPv6 addresses, then your
|
|
|
|
loopback interface must also have '::1' enabled. For some default installations
|
2021-11-25 22:13:17 +01:00
|
|
|
on Ubuntu, that does not seem to be the case. To enable '::1' on the
|
2018-11-14 23:53:59 +01:00
|
|
|
loopback interface on Ubuntu:
|
|
|
|
|
|
|
|
```bash
|
|
|
|
sudo sysctl -w net.ipv6.conf.lo.disable_ipv6=0
|
|
|
|
```
|
|
|
|
|
2018-11-01 06:46:29 +01:00
|
|
|
You can use
|
|
|
|
[node-code-ide-configs](https://github.com/nodejs/node-code-ide-configs)
|
2021-11-25 22:13:17 +01:00
|
|
|
to run/debug tests if your IDE configs are present.
|
2018-11-01 06:46:29 +01:00
|
|
|
|
2021-02-06 17:14:25 +01:00
|
|
|
#### Running coverage
|
2017-10-06 19:42:35 +02:00
|
|
|
|
2018-10-29 06:59:56 +01:00
|
|
|
It's good practice to ensure any code you add or change is covered by tests.
|
|
|
|
You can do so by running the test suite with coverage enabled:
|
2017-09-05 00:10:05 +02:00
|
|
|
|
|
|
|
```console
|
|
|
|
$ ./configure --coverage
|
|
|
|
$ make coverage
|
|
|
|
```
|
|
|
|
|
2018-10-29 06:59:56 +01:00
|
|
|
A detailed coverage report will be written to `coverage/index.html` for
|
2020-10-23 04:56:28 +02:00
|
|
|
JavaScript coverage and to `coverage/cxxcoverage.html` for C++ coverage.
|
2018-10-29 06:59:56 +01:00
|
|
|
|
2020-10-23 04:56:28 +02:00
|
|
|
If you only want to run the JavaScript tests then you do not need to run
|
|
|
|
the first command (`./configure --coverage`). Run `make coverage-run-js`,
|
|
|
|
to execute JavaScript tests independently of the C++ test suite:
|
2018-10-29 06:59:56 +01:00
|
|
|
|
|
|
|
```text
|
2020-10-23 04:56:28 +02:00
|
|
|
$ make coverage-run-js
|
2018-10-29 06:59:56 +01:00
|
|
|
```
|
|
|
|
|
2020-10-26 11:35:56 +01:00
|
|
|
If you are updating tests and want to collect coverage for a single test file
|
2020-10-23 04:56:28 +02:00
|
|
|
(e.g. `test/parallel/test-stream2-transform.js`):
|
|
|
|
|
|
|
|
```text
|
|
|
|
$ make coverage-clean
|
2021-11-25 22:13:17 +01:00
|
|
|
$ NODE_V8_COVERAGE=coverage/tmp tools/test.py test/parallel/test-stream2-transform.js
|
2020-10-23 04:56:28 +02:00
|
|
|
$ make coverage-report-js
|
|
|
|
```
|
2017-09-05 00:10:05 +02:00
|
|
|
|
2020-10-23 04:56:28 +02:00
|
|
|
You can collect coverage for the entire suite of tests for a given subsystem
|
|
|
|
by providing the name of a subsystem:
|
2019-01-18 22:46:49 +01:00
|
|
|
|
|
|
|
```text
|
2020-10-23 04:56:28 +02:00
|
|
|
$ make coverage-clean
|
2021-11-24 06:30:04 +01:00
|
|
|
$ NODE_V8_COVERAGE=coverage/tmp tools/test.py --mode=release child-process
|
2020-10-23 04:56:28 +02:00
|
|
|
$ make coverage-report-js
|
2019-01-18 22:46:49 +01:00
|
|
|
```
|
|
|
|
|
|
|
|
The `make coverage` command downloads some tools to the project root directory.
|
|
|
|
To clean up after generating the coverage reports:
|
2017-09-05 00:10:05 +02:00
|
|
|
|
|
|
|
```console
|
2017-10-06 19:42:35 +02:00
|
|
|
$ make coverage-clean
|
2017-09-05 00:10:05 +02:00
|
|
|
```
|
|
|
|
|
2018-01-09 12:34:11 +01:00
|
|
|
#### Building the documentation
|
|
|
|
|
2016-03-10 00:41:52 +01:00
|
|
|
To build the documentation:
|
|
|
|
|
2015-11-18 23:40:03 +01:00
|
|
|
This will build Node.js first (if necessary) and then use it to build the docs:
|
|
|
|
|
2020-08-30 14:52:17 +02:00
|
|
|
```bash
|
|
|
|
make doc
|
2016-03-10 00:41:52 +01:00
|
|
|
```
|
|
|
|
|
2017-08-18 20:36:33 +02:00
|
|
|
If you have an existing Node.js build, you can build just the docs with:
|
2015-11-18 23:40:03 +01:00
|
|
|
|
2020-08-30 14:52:17 +02:00
|
|
|
```bash
|
|
|
|
NODE=/path/to/node make doc-only
|
2015-11-18 23:40:03 +01:00
|
|
|
```
|
|
|
|
|
2020-08-30 14:52:17 +02:00
|
|
|
To read the man page:
|
2016-03-10 00:41:52 +01:00
|
|
|
|
2020-08-30 14:52:17 +02:00
|
|
|
```bash
|
|
|
|
man doc/node.1
|
2016-03-10 00:41:52 +01:00
|
|
|
```
|
|
|
|
|
2020-08-30 14:52:17 +02:00
|
|
|
If you prefer to read the full documentation in a browser, run the following.
|
2018-03-13 16:12:40 +01:00
|
|
|
|
2020-08-30 14:52:17 +02:00
|
|
|
```bash
|
|
|
|
make docserve
|
2018-03-13 16:12:40 +01:00
|
|
|
```
|
|
|
|
|
2020-08-30 14:52:17 +02:00
|
|
|
This will spin up a static file server and provide a URL to where you may browse
|
|
|
|
the documentation locally.
|
|
|
|
|
|
|
|
If you're comfortable viewing the documentation using the program your operating
|
|
|
|
system has associated with the default web browser, run the following.
|
|
|
|
|
|
|
|
```bash
|
|
|
|
make docopen
|
|
|
|
```
|
|
|
|
|
|
|
|
This will open a file URL to a one-page version of all the browsable HTML
|
|
|
|
documents using the default browser.
|
2018-03-13 16:12:40 +01:00
|
|
|
|
2016-03-10 00:41:52 +01:00
|
|
|
To test if Node.js was built correctly:
|
|
|
|
|
2020-08-30 14:52:17 +02:00
|
|
|
```bash
|
|
|
|
./node -e "console.log('Hello from Node.js ' + process.version)"
|
2016-09-03 05:23:21 +02:00
|
|
|
```
|
|
|
|
|
2018-08-24 20:52:18 +02:00
|
|
|
#### Building a debug build
|
|
|
|
|
|
|
|
If you run into an issue where the information provided by the JS stack trace
|
|
|
|
is not enough, or if you suspect the error happens outside of the JS VM, you
|
|
|
|
can try to build a debug enabled binary:
|
|
|
|
|
|
|
|
```console
|
|
|
|
$ ./configure --debug
|
|
|
|
$ make -j4
|
|
|
|
```
|
|
|
|
|
|
|
|
`make` with `./configure --debug` generates two binaries, the regular release
|
|
|
|
one in `out/Release/node` and a debug binary in `out/Debug/node`, only the
|
|
|
|
release version is actually installed when you run `make install`.
|
|
|
|
|
|
|
|
To use the debug build with all the normal dependencies overwrite the release
|
|
|
|
version in the install directory:
|
|
|
|
|
2021-09-18 02:23:11 +02:00
|
|
|
```console
|
2019-11-17 12:15:21 +01:00
|
|
|
$ make install PREFIX=/opt/node-debug/
|
2018-08-24 20:52:18 +02:00
|
|
|
$ cp -a -f out/Debug/node /opt/node-debug/node
|
|
|
|
```
|
|
|
|
|
|
|
|
When using the debug binary, core dumps will be generated in case of crashes.
|
|
|
|
These core dumps are useful for debugging when provided with the
|
|
|
|
corresponding original debug binary and system information.
|
|
|
|
|
|
|
|
Reading the core dump requires `gdb` built on the same platform the core dump
|
2018-10-30 18:31:18 +01:00
|
|
|
was captured on (i.e. 64-bit `gdb` for `node` built on a 64-bit system, Linux
|
2018-08-24 20:52:18 +02:00
|
|
|
`gdb` for `node` built on Linux) otherwise you will get errors like
|
|
|
|
`not in executable format: File format not recognized`.
|
|
|
|
|
|
|
|
Example of generating a backtrace from the core dump:
|
|
|
|
|
2021-09-18 02:23:11 +02:00
|
|
|
```console
|
2018-08-24 20:52:18 +02:00
|
|
|
$ gdb /opt/node-debug/node core.node.8.1535359906
|
|
|
|
$ backtrace
|
|
|
|
```
|
2016-03-10 00:41:52 +01:00
|
|
|
|
2020-03-23 13:07:29 +01:00
|
|
|
#### Building an ASAN build
|
|
|
|
|
|
|
|
[ASAN](https://github.com/google/sanitizers) can help detect various memory
|
|
|
|
related bugs. ASAN builds are currently only supported on linux.
|
|
|
|
If you want to check it on Windows or macOS or you want a consistent toolchain
|
|
|
|
on Linux, you can try [Docker](https://www.docker.com/products/docker-desktop)
|
2021-09-18 02:23:11 +02:00
|
|
|
(using an image like `gengjiawen/node-build:2020-02-14`).
|
2020-03-23 13:07:29 +01:00
|
|
|
|
|
|
|
The `--debug` is not necessary and will slow down build and testing, but it can
|
|
|
|
show clear stacktrace if ASAN hits an issue.
|
|
|
|
|
2021-09-18 02:23:11 +02:00
|
|
|
```console
|
2020-03-23 13:07:29 +01:00
|
|
|
$ ./configure --debug --enable-asan && make -j4
|
|
|
|
$ make test-only
|
|
|
|
```
|
|
|
|
|
2020-12-09 13:29:15 +01:00
|
|
|
#### Speeding up frequent rebuilds when developing
|
|
|
|
|
|
|
|
If you plan to frequently rebuild Node.js, especially if using several branches,
|
|
|
|
installing `ccache` can help to greatly reduce build times. Set up with:
|
2021-09-18 02:23:11 +02:00
|
|
|
|
2021-10-21 19:06:49 +02:00
|
|
|
On GNU/Linux:
|
|
|
|
|
2021-10-21 20:06:05 +02:00
|
|
|
```bash
|
|
|
|
sudo apt install ccache # for Debian/Ubuntu, included in most Linux distros
|
|
|
|
export CC="ccache gcc" # add to your .profile
|
|
|
|
export CXX="ccache g++" # add to your .profile
|
2020-12-09 13:29:15 +01:00
|
|
|
```
|
2021-09-18 02:23:11 +02:00
|
|
|
|
2021-10-21 19:06:49 +02:00
|
|
|
On macOS:
|
|
|
|
|
2021-10-21 20:06:05 +02:00
|
|
|
```bash
|
|
|
|
brew install ccache # see https://brew.sh
|
|
|
|
export CC="ccache cc" # add to ~/.zshrc or other shell config file
|
|
|
|
export CXX="ccache c++" # add to ~/.zshrc or other shell config file
|
2021-10-21 19:06:49 +02:00
|
|
|
```
|
|
|
|
|
2020-12-09 13:29:15 +01:00
|
|
|
This will allow for near-instantaneous rebuilds even when switching branches.
|
|
|
|
|
|
|
|
When modifying only the JS layer in `lib`, it is possible to externally load it
|
|
|
|
without modifying the executable:
|
2021-09-18 02:23:11 +02:00
|
|
|
|
2020-12-09 13:29:15 +01:00
|
|
|
```console
|
2022-05-24 11:27:17 +02:00
|
|
|
$ ./configure --node-builtin-modules-path "$(pwd)"
|
2020-12-09 13:29:15 +01:00
|
|
|
```
|
2021-09-18 02:23:11 +02:00
|
|
|
|
2020-12-09 13:29:15 +01:00
|
|
|
The resulting binary won't include any JS files and will try to load them from
|
|
|
|
the specified directory. The JS debugger of Visual Studio Code supports this
|
|
|
|
configuration since the November 2020 version and allows for setting
|
|
|
|
breakpoints.
|
|
|
|
|
2020-01-28 01:58:07 +01:00
|
|
|
#### Troubleshooting Unix and macOS builds
|
|
|
|
|
|
|
|
Stale builds can sometimes result in `file not found` errors while building.
|
|
|
|
This and some other problems can be resolved with `make distclean`. The
|
|
|
|
`distclean` recipe aggressively removes build artifacts. You will need to
|
|
|
|
build again (`make -j4`). Since all build artifacts have been removed, this
|
|
|
|
rebuild may take a lot more time than previous builds. Additionally,
|
|
|
|
`distclean` removes the file that stores the results of `./configure`. If you
|
|
|
|
ran `./configure` with non-default options (such as `--debug`), you will need
|
|
|
|
to run it again before invoking `make -j4`.
|
|
|
|
|
2016-03-10 00:41:52 +01:00
|
|
|
### Windows
|
|
|
|
|
2019-06-28 10:01:02 +02:00
|
|
|
#### Prerequisites
|
|
|
|
|
|
|
|
##### Option 1: Manual install
|
2016-03-10 00:41:52 +01:00
|
|
|
|
2021-12-06 14:49:33 +01:00
|
|
|
* [Python 3.10](https://www.microsoft.com/en-us/p/python-310/9pjpw5ldxlz5)
|
2017-11-07 18:36:09 +01:00
|
|
|
* The "Desktop development with C++" workload from
|
2022-06-21 09:02:56 +02:00
|
|
|
[Visual Studio 2019](https://visualstudio.microsoft.com/vs/older-downloads/#visual-studio-2019-and-other-products) or
|
2021-05-01 20:14:58 +02:00
|
|
|
the "C++ build tools" workload from the
|
2022-06-21 09:02:56 +02:00
|
|
|
[Build Tools](https://aka.ms/vs/16/release/vs_buildtools.exe),
|
2020-08-20 04:16:44 +02:00
|
|
|
with the default optional components
|
2016-03-10 00:41:52 +01:00
|
|
|
* Basic Unix tools required for some tests,
|
2019-09-04 08:39:05 +02:00
|
|
|
[Git for Windows](https://git-scm.com/download/win) includes Git Bash
|
2016-03-10 00:41:52 +01:00
|
|
|
and tools which can be included in the global `PATH`.
|
2019-09-04 08:39:05 +02:00
|
|
|
* The [NetWide Assembler](https://www.nasm.us/), for OpenSSL assembler modules.
|
2018-04-11 14:11:36 +02:00
|
|
|
If not installed in the default location, it needs to be manually added
|
2019-01-03 01:44:23 +01:00
|
|
|
to `PATH`. A build with the `openssl-no-asm` option does not need this, nor
|
|
|
|
does a build targeting ARM64 Windows.
|
2019-06-28 10:01:02 +02:00
|
|
|
|
|
|
|
Optional requirements to build the MSI installer package:
|
|
|
|
|
2019-09-04 08:39:05 +02:00
|
|
|
* The [WiX Toolset v3.11](https://wixtoolset.org/releases/) and the
|
2020-08-20 04:16:44 +02:00
|
|
|
[Wix Toolset Visual Studio 2019 Extension](https://marketplace.visualstudio.com/items?itemName=WixToolset.WixToolsetVisualStudio2019Extension)
|
2020-06-22 11:22:42 +02:00
|
|
|
* The [WiX Toolset v3.14](https://wixtoolset.org/releases/) if
|
2020-08-20 04:16:44 +02:00
|
|
|
building for Windows 10 on ARM (ARM64)
|
2019-06-28 10:01:02 +02:00
|
|
|
|
|
|
|
Optional requirements for compiling for Windows 10 on ARM (ARM64):
|
|
|
|
|
|
|
|
* Visual Studio 15.9.0 or newer
|
|
|
|
* Visual Studio optional components
|
|
|
|
* Visual C++ compilers and libraries for ARM64
|
|
|
|
* Visual C++ ATL for ARM64
|
|
|
|
* Windows 10 SDK 10.0.17763.0 or newer
|
|
|
|
|
|
|
|
##### Option 2: Automated install with Boxstarter
|
|
|
|
|
2019-09-04 08:39:05 +02:00
|
|
|
A [Boxstarter](https://boxstarter.org/) script can be used for easy setup of
|
2019-06-28 10:01:02 +02:00
|
|
|
Windows systems with all the required prerequisites for Node.js development.
|
|
|
|
This script will install the following [Chocolatey](https://chocolatey.org/)
|
|
|
|
packages:
|
|
|
|
|
|
|
|
* [Git for Windows](https://chocolatey.org/packages/git) with the `git` and
|
2020-08-20 04:16:44 +02:00
|
|
|
Unix tools added to the `PATH`
|
2020-12-30 15:09:52 +01:00
|
|
|
* [Python 3.x](https://chocolatey.org/packages/python)
|
2020-03-16 11:17:08 +01:00
|
|
|
* [Visual Studio 2019 Build Tools](https://chocolatey.org/packages/visualstudio2019buildtools)
|
2020-06-02 11:04:17 +02:00
|
|
|
with [Visual C++ workload](https://chocolatey.org/packages/visualstudio2019-workload-vctools)
|
2019-06-28 10:01:02 +02:00
|
|
|
* [NetWide Assembler](https://chocolatey.org/packages/nasm)
|
|
|
|
|
|
|
|
To install Node.js prerequisites using
|
2022-06-02 18:34:01 +02:00
|
|
|
[Boxstarter WebLauncher](https://boxstarter.org/weblauncher), open
|
2021-02-23 20:59:24 +01:00
|
|
|
<https://boxstarter.org/package/nr/url?https://raw.githubusercontent.com/nodejs/node/HEAD/tools/bootstrap/windows_boxstarter>
|
2019-06-28 10:01:02 +02:00
|
|
|
with Internet Explorer or Edge browser on the target machine.
|
|
|
|
|
|
|
|
Alternatively, you can use PowerShell. Run those commands from an elevated
|
|
|
|
PowerShell terminal:
|
|
|
|
|
|
|
|
```powershell
|
|
|
|
Set-ExecutionPolicy Unrestricted -Force
|
2019-09-04 08:39:05 +02:00
|
|
|
iex ((New-Object System.Net.WebClient).DownloadString('https://boxstarter.org/bootstrapper.ps1'))
|
2019-06-28 10:01:02 +02:00
|
|
|
get-boxstarter -Force
|
2021-02-23 20:59:24 +01:00
|
|
|
Install-BoxstarterPackage https://raw.githubusercontent.com/nodejs/node/HEAD/tools/bootstrap/windows_boxstarter -DisableReboots
|
2019-06-28 10:01:02 +02:00
|
|
|
```
|
|
|
|
|
|
|
|
The entire installation using Boxstarter will take up approximately 10 GB of
|
|
|
|
disk space.
|
|
|
|
|
|
|
|
#### Building Node.js
|
2016-03-10 00:41:52 +01:00
|
|
|
|
2018-02-12 08:31:55 +01:00
|
|
|
If the path to your build directory contains a space or a non-ASCII character,
|
|
|
|
the build will likely fail.
|
2017-07-18 21:03:43 +02:00
|
|
|
|
2016-07-14 11:55:30 +02:00
|
|
|
```console
|
2016-12-06 21:52:59 +01:00
|
|
|
> .\vcbuild
|
2016-03-10 00:41:52 +01:00
|
|
|
```
|
|
|
|
|
|
|
|
To run the tests:
|
|
|
|
|
2016-07-14 11:55:30 +02:00
|
|
|
```console
|
2017-01-16 17:25:00 +01:00
|
|
|
> .\vcbuild test
|
2016-03-10 00:41:52 +01:00
|
|
|
```
|
|
|
|
|
|
|
|
To test if Node.js was built correctly:
|
|
|
|
|
2016-07-14 11:55:30 +02:00
|
|
|
```console
|
2016-06-13 12:24:53 +02:00
|
|
|
> Release\node -e "console.log('Hello from Node.js', process.version)"
|
2016-03-10 00:41:52 +01:00
|
|
|
```
|
|
|
|
|
2022-08-12 12:29:23 +02:00
|
|
|
### Android
|
2016-04-04 19:48:34 +02:00
|
|
|
|
2018-10-12 02:15:15 +02:00
|
|
|
Android is not a supported platform. Patches to improve the Android build are
|
|
|
|
welcome. There is no testing on Android in the current continuous integration
|
|
|
|
environment. The participation of people dedicated and determined to improve
|
|
|
|
Android building, testing, and support is encouraged.
|
2016-03-10 00:41:52 +01:00
|
|
|
|
2017-04-01 10:07:31 +02:00
|
|
|
Be sure you have downloaded and extracted
|
2022-08-12 12:29:23 +02:00
|
|
|
[Android NDK](https://developer.android.com/ndk) before in
|
2017-04-01 10:07:31 +02:00
|
|
|
a folder. Then run:
|
2016-03-10 00:41:52 +01:00
|
|
|
|
2016-07-14 11:55:30 +02:00
|
|
|
```console
|
2022-08-12 12:29:23 +02:00
|
|
|
$ source ./android-configure /path/to/your/android-ndk target_arch android_sdk_version
|
|
|
|
$ make -j4
|
2016-03-10 00:41:52 +01:00
|
|
|
```
|
|
|
|
|
2022-08-12 12:29:23 +02:00
|
|
|
The Android SDK version should be at least 24 (Android 7.0) and the target
|
|
|
|
architecture supports \[arm, arm64/aarch64, x86, x86\_64].
|
|
|
|
|
2019-06-28 10:01:02 +02:00
|
|
|
## `Intl` (ECMA-402) support
|
2016-03-10 00:41:52 +01:00
|
|
|
|
2021-05-03 11:15:35 +02:00
|
|
|
[Intl](https://github.com/nodejs/node/blob/HEAD/doc/api/intl.md) support is
|
2019-09-30 20:17:49 +02:00
|
|
|
enabled by default.
|
2016-03-10 00:41:52 +01:00
|
|
|
|
2019-09-30 20:17:49 +02:00
|
|
|
### Build with full ICU support (all locales supported by ICU)
|
2016-03-10 00:41:52 +01:00
|
|
|
|
2019-09-30 20:17:49 +02:00
|
|
|
This is the default option.
|
2016-03-10 00:41:52 +01:00
|
|
|
|
2019-09-30 20:17:49 +02:00
|
|
|
#### Unix/macOS
|
2016-03-10 00:41:52 +01:00
|
|
|
|
2019-09-30 20:17:49 +02:00
|
|
|
```console
|
|
|
|
$ ./configure --with-intl=full-icu
|
|
|
|
```
|
|
|
|
|
|
|
|
#### Windows
|
|
|
|
|
|
|
|
```console
|
|
|
|
> .\vcbuild full-icu
|
|
|
|
```
|
|
|
|
|
|
|
|
### Trimmed: `small-icu` (English only) support
|
|
|
|
|
2021-09-18 02:23:11 +02:00
|
|
|
In this configuration, only English data is included, but
|
2019-09-30 20:17:49 +02:00
|
|
|
the full `Intl` (ECMA-402) APIs. It does not need to download
|
|
|
|
any dependencies to function. You can add full data at runtime.
|
2016-03-10 00:41:52 +01:00
|
|
|
|
2019-06-28 10:01:02 +02:00
|
|
|
#### Unix/macOS
|
2016-03-10 00:41:52 +01:00
|
|
|
|
2016-07-14 11:55:30 +02:00
|
|
|
```console
|
2019-09-30 20:17:49 +02:00
|
|
|
$ ./configure --with-intl=small-icu
|
2016-03-10 00:41:52 +01:00
|
|
|
```
|
|
|
|
|
2019-06-28 10:01:02 +02:00
|
|
|
#### Windows
|
2016-03-10 00:41:52 +01:00
|
|
|
|
2016-07-14 11:55:30 +02:00
|
|
|
```console
|
2019-09-30 20:17:49 +02:00
|
|
|
> .\vcbuild small-icu
|
2016-03-10 00:41:52 +01:00
|
|
|
```
|
|
|
|
|
2019-06-28 10:01:02 +02:00
|
|
|
### Building without Intl support
|
2016-03-10 00:41:52 +01:00
|
|
|
|
2016-04-09 04:03:24 +02:00
|
|
|
The `Intl` object will not be available, nor some other APIs such as
|
|
|
|
`String.normalize`.
|
2016-03-10 00:41:52 +01:00
|
|
|
|
2019-06-28 10:01:02 +02:00
|
|
|
#### Unix/macOS
|
2016-03-10 00:41:52 +01:00
|
|
|
|
2016-07-14 11:55:30 +02:00
|
|
|
```console
|
2016-04-09 04:03:24 +02:00
|
|
|
$ ./configure --without-intl
|
2016-03-10 00:41:52 +01:00
|
|
|
```
|
|
|
|
|
2019-06-28 10:01:02 +02:00
|
|
|
#### Windows
|
2016-03-10 00:41:52 +01:00
|
|
|
|
2016-07-14 11:55:30 +02:00
|
|
|
```console
|
2017-01-16 17:25:00 +01:00
|
|
|
> .\vcbuild without-intl
|
2016-03-10 00:41:52 +01:00
|
|
|
```
|
|
|
|
|
2019-06-28 10:01:02 +02:00
|
|
|
### Use existing installed ICU (Unix/macOS only)
|
2016-03-10 00:41:52 +01:00
|
|
|
|
2016-07-14 11:55:30 +02:00
|
|
|
```console
|
2016-03-10 00:41:52 +01:00
|
|
|
$ pkg-config --modversion icu-i18n && ./configure --with-intl=system-icu
|
|
|
|
```
|
|
|
|
|
2018-10-30 18:31:18 +01:00
|
|
|
If you are cross-compiling, your `pkg-config` must be able to supply a path
|
2016-03-10 00:41:52 +01:00
|
|
|
that works for both your host and target environments.
|
|
|
|
|
2019-06-28 10:01:02 +02:00
|
|
|
### Build with a specific ICU
|
2016-03-10 00:41:52 +01:00
|
|
|
|
|
|
|
You can find other ICU releases at
|
2020-05-28 16:03:53 +02:00
|
|
|
[the ICU homepage](http://site.icu-project.org/download).
|
2016-03-10 00:41:52 +01:00
|
|
|
Download the file named something like `icu4c-**##.#**-src.tgz` (or
|
|
|
|
`.zip`).
|
|
|
|
|
2018-06-08 22:57:32 +02:00
|
|
|
To check the minimum recommended ICU, run `./configure --help` and see
|
|
|
|
the help for the `--with-icu-source` option. A warning will be printed
|
|
|
|
during configuration if the ICU version is too old.
|
|
|
|
|
2019-06-28 10:01:02 +02:00
|
|
|
#### Unix/macOS
|
2016-03-10 00:41:52 +01:00
|
|
|
|
2016-07-14 11:55:30 +02:00
|
|
|
From an already-unpacked ICU:
|
2019-08-29 15:28:03 +02:00
|
|
|
|
2016-07-14 11:55:30 +02:00
|
|
|
```console
|
2016-03-10 00:41:52 +01:00
|
|
|
$ ./configure --with-intl=[small-icu,full-icu] --with-icu-source=/path/to/icu
|
2016-07-14 11:55:30 +02:00
|
|
|
```
|
2016-03-10 00:41:52 +01:00
|
|
|
|
2016-07-14 11:55:30 +02:00
|
|
|
From a local ICU tarball:
|
2019-08-29 15:28:03 +02:00
|
|
|
|
2016-07-14 11:55:30 +02:00
|
|
|
```console
|
2016-03-10 00:41:52 +01:00
|
|
|
$ ./configure --with-intl=[small-icu,full-icu] --with-icu-source=/path/to/icu.tgz
|
2016-07-14 11:55:30 +02:00
|
|
|
```
|
2016-03-10 00:41:52 +01:00
|
|
|
|
2016-07-14 11:55:30 +02:00
|
|
|
From a tarball URL:
|
2019-08-29 15:28:03 +02:00
|
|
|
|
2016-07-14 11:55:30 +02:00
|
|
|
```console
|
2016-03-10 00:41:52 +01:00
|
|
|
$ ./configure --with-intl=full-icu --with-icu-source=http://url/to/icu.tgz
|
|
|
|
```
|
|
|
|
|
2019-06-28 10:01:02 +02:00
|
|
|
#### Windows
|
2016-03-10 00:41:52 +01:00
|
|
|
|
|
|
|
First unpack latest ICU to `deps/icu`
|
2020-05-28 16:03:53 +02:00
|
|
|
[icu4c-**##.#**-src.tgz](http://site.icu-project.org/download) (or `.zip`)
|
2016-03-10 00:41:52 +01:00
|
|
|
as `deps/icu` (You'll have: `deps/icu/source/...`)
|
|
|
|
|
2016-07-14 11:55:30 +02:00
|
|
|
```console
|
2017-01-16 17:25:00 +01:00
|
|
|
> .\vcbuild full-icu
|
2016-03-10 00:41:52 +01:00
|
|
|
```
|
|
|
|
|
2022-05-14 10:04:48 +02:00
|
|
|
### Configure OpenSSL appname
|
|
|
|
|
|
|
|
Node.js can use an OpenSSL configuration file by specifying the environment
|
|
|
|
variable `OPENSSL_CONF`, or using the command line option `--openssl-conf`, and
|
|
|
|
if none of those are specified will default to reading the default OpenSSL
|
|
|
|
configuration file `openssl.cnf`. Node.js will only read a section that is by
|
|
|
|
default named `nodejs_conf`, but this name can be overridden using the following
|
|
|
|
configure option:
|
|
|
|
|
|
|
|
```console
|
|
|
|
$ ./configure --openssl-conf-name=<some_conf_name>
|
|
|
|
```
|
|
|
|
|
2016-03-10 00:41:52 +01:00
|
|
|
## Building Node.js with FIPS-compliant OpenSSL
|
|
|
|
|
2021-04-14 11:19:54 +02:00
|
|
|
The current version of Node.js supports FIPS when statically and
|
|
|
|
dynamically linking with OpenSSL 3.0.0 by using the configuration flag
|
|
|
|
`--openssl-is-fips`.
|
2021-04-26 05:52:16 +02:00
|
|
|
|
2021-04-14 11:19:54 +02:00
|
|
|
### FIPS support when statically linking OpenSSL
|
|
|
|
|
|
|
|
FIPS can be supported by specifying the configuration flag `--openssl-is-fips`:
|
2021-10-16 04:52:13 +02:00
|
|
|
|
2021-04-14 11:19:54 +02:00
|
|
|
```console
|
|
|
|
$ ./configure --openssl-is-fips
|
|
|
|
$ make -j8
|
|
|
|
```
|
|
|
|
|
|
|
|
The above command will build and install the FIPS module into the out directory.
|
|
|
|
This includes building fips.so, running the `installfips` command that generates
|
|
|
|
the FIPS configuration file (fipsmodule.cnf), copying and updating openssl.cnf
|
|
|
|
to include the correct path to fipsmodule.cnf and finally uncomment the fips
|
|
|
|
section.
|
|
|
|
|
|
|
|
We can then run node specifying `--enable-fips`:
|
2021-10-16 04:52:13 +02:00
|
|
|
|
2021-04-14 11:19:54 +02:00
|
|
|
```console
|
|
|
|
$ ./node --enable-fips -p 'crypto.getFips()'
|
|
|
|
1
|
|
|
|
```
|
2021-10-16 04:52:13 +02:00
|
|
|
|
2021-04-14 11:19:54 +02:00
|
|
|
The above will use the Node.js default locations for OpenSSL 3.0:
|
2021-10-16 04:52:13 +02:00
|
|
|
|
2021-04-14 11:19:54 +02:00
|
|
|
```console
|
|
|
|
$ ./out/Release/openssl-cli version -m -d
|
|
|
|
OPENSSLDIR: "/nodejs/openssl/out/Release/obj.target/deps/openssl"
|
|
|
|
MODULESDIR: "/nodejs/openssl/out/Release/obj.target/deps/openssl/lib/openssl-modules"
|
|
|
|
```
|
2021-10-16 04:52:13 +02:00
|
|
|
|
2021-04-14 11:19:54 +02:00
|
|
|
The OpenSSL configuration files will be found in `OPENSSLDIR` directory above:
|
2021-10-16 04:52:13 +02:00
|
|
|
|
2021-04-14 11:19:54 +02:00
|
|
|
```console
|
|
|
|
$ ls -w 1 out/Release/obj.target/deps/openssl/*.cnf
|
|
|
|
out/Release/obj.target/deps/openssl/fipsmodule.cnf
|
|
|
|
out/Release/obj.target/deps/openssl/openssl.cnf
|
|
|
|
```
|
2021-10-16 04:52:13 +02:00
|
|
|
|
2021-04-14 11:19:54 +02:00
|
|
|
And the FIPS module will be located in the `MODULESDIR` directory:
|
2021-10-16 04:52:13 +02:00
|
|
|
|
2021-04-14 11:19:54 +02:00
|
|
|
```console
|
|
|
|
$ ls out/Release/obj.target/deps/openssl/lib/openssl-modules/
|
|
|
|
fips.so
|
|
|
|
```
|
|
|
|
|
2022-05-14 10:04:48 +02:00
|
|
|
Running `configure` without `--openssl-is-fips` flag and rebuilding will reset
|
|
|
|
the FIPS configuration.
|
|
|
|
|
2021-04-14 11:19:54 +02:00
|
|
|
### FIPS support when dynamically linking OpenSSL
|
2021-04-26 05:52:16 +02:00
|
|
|
|
|
|
|
For quictls/openssl 3.0 it is possible to enable FIPS when dynamically linking.
|
2021-07-14 20:20:21 +02:00
|
|
|
If you want to build Node.js using openssl-3.0.0+quic, you can follow these
|
|
|
|
steps:
|
|
|
|
|
|
|
|
**clone OpenSSL source and prepare build**
|
2021-09-18 02:23:11 +02:00
|
|
|
|
2021-07-14 20:20:21 +02:00
|
|
|
```bash
|
|
|
|
git clone git@github.com:quictls/openssl.git
|
|
|
|
|
|
|
|
cd openssl
|
|
|
|
|
|
|
|
./config \
|
|
|
|
--prefix=/path/to/install/dir/ \
|
|
|
|
shared \
|
|
|
|
enable-fips \
|
|
|
|
linux-x86_64
|
2021-04-26 05:52:16 +02:00
|
|
|
```
|
2021-07-14 20:20:21 +02:00
|
|
|
|
|
|
|
The `/path/to/install/dir` is the path in which the `make install` instructions
|
|
|
|
will publish the OpenSSL libraries and such. We will also use this path
|
|
|
|
(and sub-paths) later when compiling Node.js.
|
|
|
|
|
|
|
|
**compile and install OpenSSL**
|
2021-09-18 02:23:11 +02:00
|
|
|
|
2021-04-26 05:52:16 +02:00
|
|
|
```console
|
2021-07-14 20:20:21 +02:00
|
|
|
make -j8
|
|
|
|
make install
|
|
|
|
make install_ssldirs
|
|
|
|
make install_fips
|
2021-04-26 05:52:16 +02:00
|
|
|
```
|
|
|
|
|
2021-07-14 20:20:21 +02:00
|
|
|
After the OpenSSL (including FIPS) modules have been compiled and installed
|
|
|
|
(into the `/path/to/install/dir`) by the above instructions we also need to
|
|
|
|
update the OpenSSL configuration file located under
|
|
|
|
`/path/to/install/dir/ssl/openssl.cnf`. Right next to this file, you should
|
|
|
|
find the `fipsmodule.cnf` file - let's add the following to the end of the
|
|
|
|
`openssl.cnf` file.
|
|
|
|
|
|
|
|
**alter openssl.cnf**
|
2021-09-18 02:23:11 +02:00
|
|
|
|
2021-04-26 05:52:16 +02:00
|
|
|
```text
|
2021-04-14 11:19:54 +02:00
|
|
|
.include /absolute/path/to/fipsmodule.cnf
|
2021-04-26 05:52:16 +02:00
|
|
|
|
|
|
|
# List of providers to load
|
|
|
|
[provider_sect]
|
|
|
|
default = default_sect
|
|
|
|
# The fips section name should match the section name inside the
|
|
|
|
# included /path/to/install/dir/ssl/fipsmodule.cnf.
|
|
|
|
fips = fips_sect
|
|
|
|
|
|
|
|
[default_sect]
|
|
|
|
activate = 1
|
|
|
|
```
|
|
|
|
|
2021-07-14 20:20:21 +02:00
|
|
|
You can e.g. accomplish this by running the following command - be sure to
|
|
|
|
replace `/path/to/install/dir/` with the path you have selected. Please make
|
|
|
|
sure that you specify an absolute path for the `.include fipsmodule.cnf` line -
|
|
|
|
using relative paths did not work on my system!
|
|
|
|
|
|
|
|
**alter openssl.cnf using a script**
|
2021-09-18 02:23:11 +02:00
|
|
|
|
2021-07-14 20:20:21 +02:00
|
|
|
```console
|
|
|
|
cat <<EOT >> /path/to/install/dir/ssl/openssl.cnf
|
|
|
|
.include /path/to/install/dir/ssl/fipsmodule.cnf
|
|
|
|
|
|
|
|
# List of providers to load
|
|
|
|
[provider_sect]
|
|
|
|
default = default_sect
|
|
|
|
# The fips section name should match the section name inside the
|
|
|
|
# included /path/to/install/dir/ssl/fipsmodule.cnf.
|
|
|
|
fips = fips_sect
|
|
|
|
|
|
|
|
[default_sect]
|
|
|
|
activate = 1
|
|
|
|
EOT
|
|
|
|
```
|
|
|
|
|
|
|
|
As you might have picked a non-custom path for your OpenSSL install dir, we
|
|
|
|
have to export the following two environment variables in order for Node.js to
|
|
|
|
find our OpenSSL modules we built beforehand:
|
2021-09-18 02:23:11 +02:00
|
|
|
|
2021-04-26 05:52:16 +02:00
|
|
|
```console
|
2021-07-14 20:20:21 +02:00
|
|
|
export OPENSSL_CONF=/path/to/install/dir/ssl/openssl.cnf
|
|
|
|
export OPENSSL_MODULES=/path/to/install/dir/lib/ossl-modules
|
2021-04-26 05:52:16 +02:00
|
|
|
```
|
|
|
|
|
2021-07-14 20:20:21 +02:00
|
|
|
**build Node.js**
|
2021-09-18 02:23:11 +02:00
|
|
|
|
2021-04-26 05:52:16 +02:00
|
|
|
```console
|
2021-07-14 20:20:21 +02:00
|
|
|
./configure \
|
|
|
|
--shared-openssl \
|
|
|
|
--shared-openssl-libpath=/path/to/install/dir/lib \
|
|
|
|
--shared-openssl-includes=/path/to/install/dir/include \
|
|
|
|
--shared-openssl-libname=crypto,ssl \
|
|
|
|
--openssl-is-fips
|
|
|
|
|
|
|
|
export LD_LIBRARY_PATH=/path/to/install/dir/lib
|
|
|
|
|
|
|
|
make -j8
|
2021-04-26 05:52:16 +02:00
|
|
|
```
|
|
|
|
|
2021-07-14 20:20:21 +02:00
|
|
|
**verify the produced executable**
|
2021-09-18 02:23:11 +02:00
|
|
|
|
2021-04-26 05:52:16 +02:00
|
|
|
```console
|
2021-07-14 20:20:21 +02:00
|
|
|
ldd ./node
|
2021-04-26 05:52:16 +02:00
|
|
|
linux-vdso.so.1 (0x00007ffd7917b000)
|
|
|
|
libcrypto.so.81.3 => /path/to/install/dir/lib/libcrypto.so.81.3 (0x00007fd911321000)
|
|
|
|
libssl.so.81.3 => /path/to/install/dir/lib/libssl.so.81.3 (0x00007fd91125e000)
|
|
|
|
libdl.so.2 => /usr/lib64/libdl.so.2 (0x00007fd911232000)
|
|
|
|
libstdc++.so.6 => /usr/lib64/libstdc++.so.6 (0x00007fd911039000)
|
|
|
|
libm.so.6 => /usr/lib64/libm.so.6 (0x00007fd910ef3000)
|
|
|
|
libgcc_s.so.1 => /usr/lib64/libgcc_s.so.1 (0x00007fd910ed9000)
|
|
|
|
libpthread.so.0 => /usr/lib64/libpthread.so.0 (0x00007fd910eb5000)
|
|
|
|
libc.so.6 => /usr/lib64/libc.so.6 (0x00007fd910cec000)
|
|
|
|
/lib64/ld-linux-x86-64.so.2 (0x00007fd9117f2000)
|
|
|
|
```
|
2021-07-14 20:20:21 +02:00
|
|
|
|
2021-04-26 05:52:16 +02:00
|
|
|
If the `ldd` command says that `libcrypto` cannot be found one needs to set
|
|
|
|
`LD_LIBRARY_PATH` to point to the directory used above for
|
|
|
|
`--shared-openssl-libpath` (see previous step).
|
|
|
|
|
2021-07-14 20:20:21 +02:00
|
|
|
**verify the OpenSSL version**
|
2021-09-18 02:23:11 +02:00
|
|
|
|
2021-04-26 05:52:16 +02:00
|
|
|
```console
|
2021-07-14 20:20:21 +02:00
|
|
|
./node -p process.versions.openssl
|
2021-04-26 05:52:16 +02:00
|
|
|
3.0.0-alpha16+quic
|
|
|
|
```
|
|
|
|
|
2021-07-14 20:20:21 +02:00
|
|
|
**verify that FIPS is available**
|
2021-09-18 02:23:11 +02:00
|
|
|
|
2021-04-26 05:52:16 +02:00
|
|
|
```console
|
2021-07-14 20:20:21 +02:00
|
|
|
./node -p 'process.config.variables.openssl_is_fips'
|
2021-04-26 05:52:16 +02:00
|
|
|
true
|
2021-07-14 20:20:21 +02:00
|
|
|
|
|
|
|
./node --enable-fips -p 'crypto.getFips()'
|
2021-04-26 05:52:16 +02:00
|
|
|
1
|
|
|
|
```
|
|
|
|
|
|
|
|
FIPS support can then be enable via the OpenSSL configuration file or
|
|
|
|
using `--enable-fips` or `--force-fips` command line options to the Node.js
|
|
|
|
executable. See sections
|
|
|
|
[Enabling FIPS using Node.js options](#enabling-fips-using-node.js-options) and
|
|
|
|
[Enabling FIPS using OpenSSL config](#enabling-fips-using-openssl-config) below.
|
|
|
|
|
|
|
|
### Enabling FIPS using Node.js options
|
2021-09-18 02:23:11 +02:00
|
|
|
|
2021-04-26 05:52:16 +02:00
|
|
|
This is done using one of the Node.js options `--enable-fips` or
|
|
|
|
`--force-fips`, for example:
|
2021-09-18 02:23:11 +02:00
|
|
|
|
2021-04-26 05:52:16 +02:00
|
|
|
```console
|
|
|
|
$ node --enable-fips -p 'crypto.getFips()'
|
|
|
|
```
|
|
|
|
|
|
|
|
### Enabling FIPS using OpenSSL config
|
2021-09-18 02:23:11 +02:00
|
|
|
|
2021-04-26 05:52:16 +02:00
|
|
|
This example show that using OpenSSL's configuration file, FIPS can be enabled
|
|
|
|
without specifying the `--enable-fips` or `--force-fips` options by setting
|
|
|
|
`default_properties = fips=yes` in the FIPS configuration file. See
|
|
|
|
[link](https://github.com/openssl/openssl/blob/master/README-FIPS.md#loading-the-fips-module-at-the-same-time-as-other-providers)
|
|
|
|
for details.
|
|
|
|
|
|
|
|
For this to work the OpenSSL configuration file (default openssl.cnf) needs to
|
|
|
|
be updated. The following shows an example:
|
2021-09-18 02:23:11 +02:00
|
|
|
|
2021-04-26 05:52:16 +02:00
|
|
|
```console
|
|
|
|
openssl_conf = openssl_init
|
|
|
|
|
|
|
|
.include /path/to/install/dir/ssl/fipsmodule.cnf
|
|
|
|
|
|
|
|
[openssl_init]
|
|
|
|
providers = prov
|
|
|
|
alg_section = algorithm_sect
|
|
|
|
|
|
|
|
[prov]
|
|
|
|
fips = fips_sect
|
|
|
|
default = default_sect
|
|
|
|
|
|
|
|
[default_sect]
|
|
|
|
activate = 1
|
|
|
|
|
|
|
|
[algorithm_sect]
|
|
|
|
default_properties = fips=yes
|
|
|
|
```
|
2021-09-18 02:23:11 +02:00
|
|
|
|
2021-04-26 05:52:16 +02:00
|
|
|
After this change Node.js can be run without the `--enable-fips` or `--force-fips`
|
|
|
|
options.
|
2017-12-16 06:19:16 +01:00
|
|
|
|
|
|
|
## Building Node.js with external core modules
|
|
|
|
|
|
|
|
It is possible to specify one or more JavaScript text files to be bundled in
|
2018-10-30 18:31:18 +01:00
|
|
|
the binary as built-in modules when building Node.js.
|
2017-12-16 06:19:16 +01:00
|
|
|
|
2018-05-30 12:21:20 +02:00
|
|
|
### Unix/macOS
|
2017-12-16 06:19:16 +01:00
|
|
|
|
|
|
|
This command will make `/root/myModule.js` available via
|
|
|
|
`require('/root/myModule')` and `./myModule2.js` available via
|
|
|
|
`require('myModule2')`.
|
|
|
|
|
|
|
|
```console
|
|
|
|
$ ./configure --link-module '/root/myModule.js' --link-module './myModule2.js'
|
|
|
|
```
|
|
|
|
|
|
|
|
### Windows
|
|
|
|
|
2018-05-16 13:59:48 +02:00
|
|
|
To make `./myModule.js` available via `require('myModule')` and
|
|
|
|
`./myModule2.js` available via `require('myModule2')`:
|
2017-12-16 06:19:16 +01:00
|
|
|
|
|
|
|
```console
|
2018-05-16 13:59:48 +02:00
|
|
|
> .\vcbuild link-module './myModule.js' link-module './myModule2.js'
|
2017-12-16 06:19:16 +01:00
|
|
|
```
|
2018-08-10 18:10:24 +02:00
|
|
|
|
|
|
|
## Note for downstream distributors of Node.js
|
|
|
|
|
2018-11-06 03:40:03 +01:00
|
|
|
The Node.js ecosystem is reliant on ABI compatibility within a major release.
|
|
|
|
To maintain ABI compatibility it is required that distributed builds of Node.js
|
|
|
|
be built against the same version of dependencies, or similar versions that do
|
|
|
|
not break their ABI compatibility, as those released by Node.js for any given
|
|
|
|
`NODE_MODULE_VERSION` (located in `src/node_version.h`).
|
|
|
|
|
|
|
|
When Node.js is built (with an intention to distribute) with an ABI
|
|
|
|
incompatible with the official Node.js builds (e.g. using a ABI incompatible
|
|
|
|
version of a dependency), please reserve and use a custom `NODE_MODULE_VERSION`
|
|
|
|
by opening a pull request against the registry available at
|
2021-05-03 11:15:35 +02:00
|
|
|
<https://github.com/nodejs/node/blob/HEAD/doc/abi_version_registry.json>.
|