2016-09-20 04:54:35 +00:00
|
|
|
# Building Node.js
|
2016-03-09 23:41:52 +00:00
|
|
|
|
2018-10-08 16:24:37 +00: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-09 23:41:52 +00:00
|
|
|
|
2018-10-08 16:24:37 +00:00
|
|
|
If you can reproduce a test failure, search for it in the
|
2016-03-09 23:41:52 +00:00
|
|
|
[Node.js issue tracker](https://github.com/nodejs/node/issues) or
|
|
|
|
file a new issue.
|
|
|
|
|
2018-09-28 14:45:44 +00:00
|
|
|
## Table of Contents
|
|
|
|
|
2018-10-20 01:33:00 +00:00
|
|
|
* [Supported platforms](#supported-platforms)
|
|
|
|
* [Input](#input)
|
|
|
|
* [Strategy](#strategy)
|
2019-03-17 11:31:29 +00:00
|
|
|
* [Platform list](#platform-list)
|
2018-10-20 01:33:00 +00:00
|
|
|
* [Supported toolchains](#supported-toolchains)
|
2019-03-17 11:31:29 +00:00
|
|
|
* [Official binary platforms and toolchains](#official-binary-platforms-and-toolchains)
|
2018-10-20 01:33:00 +00:00
|
|
|
* [OpenSSL asm support](#openssl-asm-support)
|
2019-03-17 11:31:29 +00:00
|
|
|
* [Previous versions of this document](#previous-versions-of-this-document)
|
2018-10-20 01:33:00 +00:00
|
|
|
* [Building Node.js on supported platforms](#building-nodejs-on-supported-platforms)
|
2019-06-28 08:01:02 +00:00
|
|
|
* [Note about Python 2 and Python 3](#note-about-python-2-and-python-3)
|
|
|
|
* [Unix and macOS](#unix-and-macos)
|
|
|
|
* [Unix prerequisites](#unix-prerequisites)
|
|
|
|
* [macOS prerequisites](#macos-prerequisites)
|
2019-11-06 11:49:27 +00:00
|
|
|
* [Building Node.js](#building-nodejs-1)
|
2018-10-20 01:33:00 +00:00
|
|
|
* [Running Tests](#running-tests)
|
2018-10-29 05:59:56 +00:00
|
|
|
* [Running Coverage](#running-coverage)
|
2018-10-20 01:33:00 +00:00
|
|
|
* [Building the documentation](#building-the-documentation)
|
|
|
|
* [Building a debug build](#building-a-debug-build)
|
2020-03-23 12:07:29 +00:00
|
|
|
* [Building an ASAN build](#building-an-asan-build)
|
2020-01-28 00:58:07 +00:00
|
|
|
* [Troubleshooting Unix and macOS builds](#troubleshooting-unix-and-macos-builds)
|
2019-03-17 11:31:29 +00:00
|
|
|
* [Windows](#windows)
|
2019-07-06 05:35:56 +00:00
|
|
|
* [Prerequisites](#prerequisites)
|
2019-06-28 08:01:02 +00:00
|
|
|
* [Option 1: Manual install](#option-1-manual-install)
|
2019-11-06 11:49:27 +00:00
|
|
|
* [Option 2: Automated install with Boxstarter](#option-2-automated-install-with-boxstarter)
|
2020-01-28 00:58:07 +00:00
|
|
|
* [Building Node.js](#building-nodejs-2)
|
2018-10-20 01:33:00 +00:00
|
|
|
* [Android/Android-based devices (e.g. Firefox OS)](#androidandroid-based-devices-eg-firefox-os)
|
2019-06-28 08:01:02 +00: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 18:17:49 +00:00
|
|
|
* [Trimmed: `small-icu` (English only) support](#trimmed-small-icu-english-only-support)
|
2019-06-28 08:01:02 +00:00
|
|
|
* [Unix/macOS](#unixmacos-1)
|
|
|
|
* [Windows](#windows-2)
|
2019-09-30 18:17:49 +00:00
|
|
|
* [Building without Intl support](#building-without-intl-support)
|
2019-06-28 08:01:02 +00:00
|
|
|
* [Unix/macOS](#unixmacos-2)
|
|
|
|
* [Windows](#windows-3)
|
2020-01-28 00:58:07 +00:00
|
|
|
* [Use existing installed ICU (Unix/macOS only)](#use-existing-installed-icu-unixmacos-only)
|
2019-09-30 18:17:49 +00:00
|
|
|
* [Build with a specific ICU](#build-with-a-specific-icu)
|
|
|
|
* [Unix/macOS](#unixmacos-3)
|
|
|
|
* [Windows](#windows-4)
|
2018-10-20 01:33:00 +00: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 18:17:49 +00:00
|
|
|
* [Unix/macOS](#unixmacos-4)
|
|
|
|
* [Windows](#windows-5)
|
2019-03-17 11:31:29 +00:00
|
|
|
* [Note for downstream distributors of Node.js](#note-for-downstream-distributors-of-nodejs)
|
2018-09-28 14:45:44 +00:00
|
|
|
|
2017-03-17 21:34:54 +00:00
|
|
|
## Supported platforms
|
|
|
|
|
2018-01-04 23:37:53 +00:00
|
|
|
This list of supported platforms is current as of the branch/release to
|
2018-10-30 04:51:55 +00:00
|
|
|
which it belongs.
|
2017-03-17 21:34:54 +00:00
|
|
|
|
|
|
|
### Input
|
|
|
|
|
2018-10-12 00:15:15 +00:00
|
|
|
Node.js relies on V8 and libuv. We adopt a subset of their supported platforms.
|
2017-03-17 21:34:54 +00:00
|
|
|
|
|
|
|
### Strategy
|
|
|
|
|
2018-10-30 04:51:55 +00:00
|
|
|
There are three support tiers:
|
2017-03-17 21:34:54 +00:00
|
|
|
|
2019-03-17 11:31:29 +00: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 14:13:57 +00:00
|
|
|
Test failures on tier 1 platforms will block releases.
|
2019-03-17 11:31:29 +00: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 14:19:36 +00: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 11:31:29 +00: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 15:17:40 +00:00
|
|
|
will reflect those changes.
|
2019-03-17 11:31:29 +00:00
|
|
|
|
|
|
|
### Platform list
|
|
|
|
|
2019-12-11 15:03:05 +00: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 11:31:29 +00:00
|
|
|
|
|
|
|
**For production applications, run Node.js on supported platforms only.**
|
2017-04-26 16:59:53 +00:00
|
|
|
|
2019-01-30 22:53:21 +00:00
|
|
|
Node.js does not support a platform version if a vendor has expired support
|
2019-03-04 23:32:34 +00:00
|
|
|
for it. In other words, Node.js does not support running on End-of-Life (EoL)
|
2019-01-30 22:53:21 +00:00
|
|
|
platforms. This is true regardless of entries in the table below.
|
|
|
|
|
2019-03-17 11:31:29 +00:00
|
|
|
| Operating System | Architectures | Versions | Support Type | Notes |
|
|
|
|
| ---------------- | ---------------- | ------------------------------- | ------------ | --------------------------------- |
|
|
|
|
| GNU/Linux | x64 | kernel >= 3.10, glibc >= 2.17 | Tier 1 | e.g. Ubuntu 16.04 <sup>[1](#fn1)</sup>, Debian 9, EL 7 <sup>[2](#fn2)</sup> |
|
|
|
|
| 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.5, glibc >= 2.17 | Tier 1 | e.g. Ubuntu 16.04, Debian 9, EL 7 <sup>[3](#fn3)</sup> |
|
|
|
|
| GNU/Linux | armv7 | kernel >= 4.14, glibc >= 2.24 | Tier 1 | e.g. Ubuntu 18.04, Debian 9 |
|
|
|
|
| GNU/Linux | armv6 | kernel >= 4.14, glibc >= 2.24 | Experimental | Downgraded as of Node.js 12 |
|
2019-06-10 22:55:37 +00:00
|
|
|
| GNU/Linux | ppc64le >=power8 | kernel >= 3.10.0, glibc >= 2.17 | Tier 2 | e.g. Ubuntu 16.04 <sup>[1](#fn1)</sup>, EL 7 <sup>[2](#fn2)</sup> |
|
|
|
|
| GNU/Linux | s390x | kernel >= 3.10.0, glibc >= 2.17 | Tier 2 | e.g. EL 7 <sup>[2](#fn2)</sup> |
|
2020-02-20 19:35:14 +00:00
|
|
|
| Windows | x64, x86 (WoW64) | >= Windows 8.1/2012 R2 | Tier 1 | <sup>[4](#fn4),[5](#fn5)</sup> |
|
|
|
|
| Windows | x86 (native) | >= Windows 8.1/2012 R2 | Tier 1 (running) / Experimental (compiling) <sup>[6](#fn6)</sup> | |
|
|
|
|
| Windows | x64, x86 | Windows Server 2012 (not R2) | Experimental | |
|
2019-03-17 11:31:29 +00:00
|
|
|
| Windows | arm64 | >= Windows 10 | Experimental | |
|
|
|
|
| macOS | x64 | >= 10.11 | Tier 1 | |
|
|
|
|
| SmartOS | x64 | >= 18 | Tier 2 | |
|
2019-09-06 17:21:19 +00:00
|
|
|
| AIX | ppc64be >=power7 | >= 7.2 TL02 | Tier 2 | |
|
2019-11-08 07:52:38 +00:00
|
|
|
| FreeBSD | x64 | >= 11 | Experimental | Downgraded as of Node.js 12 <sup>[7](#fn7)</sup> |
|
2019-03-17 11:31:29 +00:00
|
|
|
|
2019-12-23 15:17:40 +00:00
|
|
|
<em id="fn1">1</em>: GCC 6 is not provided on the base platform. Users will
|
2019-03-17 11:31:29 +00:00
|
|
|
need the
|
|
|
|
[Toolchain test builds PPA](https://launchpad.net/~ubuntu-toolchain-r/+archive/ubuntu/test?field.series_filter=xenial)
|
|
|
|
or similar to source a newer compiler.
|
|
|
|
|
2019-12-23 15:17:40 +00:00
|
|
|
<em id="fn2">2</em>: GCC 6 is not provided on the base platform. Users will
|
2019-03-17 11:31:29 +00:00
|
|
|
need the
|
|
|
|
[devtoolset-6](https://www.softwarecollections.org/en/scls/rhscl/devtoolset-6/)
|
|
|
|
or later to source a newer compiler.
|
|
|
|
|
2019-12-23 15:17:40 +00:00
|
|
|
<em id="fn3">3</em>: Older kernel versions may work for ARM64. However the
|
2019-03-17 11:31:29 +00:00
|
|
|
Node.js test infrastructure only tests >= 4.5.
|
|
|
|
|
|
|
|
<em id="fn4">4</em>: On Windows, running Node.js in Windows terminal emulators
|
2018-08-16 21:39:52 +00:00
|
|
|
like `mintty` requires the usage of [winpty](https://github.com/rprichard/winpty)
|
2019-12-23 15:17:40 +00:00
|
|
|
for the tty channels to work (e.g. `winpty node.exe script.js`).
|
2017-10-09 17:10:54 +00:00
|
|
|
In "Git bash" if you call the node shell alias (`node` without the `.exe`
|
|
|
|
extension), `winpty` is used automatically.
|
|
|
|
|
2019-12-23 15:17:40 +00:00
|
|
|
<em id="fn5">5</em>: The Windows Subsystem for Linux (WSL) is not
|
2018-08-16 21:39:52 +00: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
|
2018-10-12 00:15:15 +00:00
|
|
|
Windows binary (`node.exe`) in WSL is not recommended. It will not work
|
|
|
|
without workarounds such as stdio redirection.
|
2017-11-14 02:44:25 +00:00
|
|
|
|
2019-03-17 11:31:29 +00:00
|
|
|
<em id="fn6">6</em>: Running Node.js on x86 Windows should work and binaries
|
|
|
|
are provided. However, tests in our infrastructure only run on WoW64.
|
2019-12-23 15:17:40 +00:00
|
|
|
Furthermore, compiling on x86 Windows is Experimental and
|
2019-03-17 11:31:29 +00:00
|
|
|
may not be possible.
|
|
|
|
|
2019-11-08 07:52:38 +00:00
|
|
|
<em id="fn7">7</em>: The default FreeBSD 12.0 compiler is Clang 6.0.1, but
|
2019-12-23 15:17:40 +00:00
|
|
|
FreeBSD 12.1 upgrades to 8.0.1. Other Clang/LLVM versions are available
|
2019-11-08 07:52:38 +00:00
|
|
|
via the system's package manager, including Clang 9.0.
|
|
|
|
|
2017-03-17 21:34:54 +00:00
|
|
|
### Supported toolchains
|
|
|
|
|
2018-10-30 17:31:18 +00:00
|
|
|
Depending on the host platform, the selection of toolchains may vary.
|
2017-03-17 21:34:54 +00:00
|
|
|
|
2019-03-17 11:31:29 +00:00
|
|
|
| Operating System | Compiler Versions |
|
|
|
|
| ---------------- | -------------------------------------------------------------- |
|
|
|
|
| Linux | GCC >= 6.3 |
|
|
|
|
| Windows | Visual Studio >= 2017 with the Windows 10 SDK on a 64-bit host |
|
2019-09-19 22:33:15 +00:00
|
|
|
| macOS | Xcode >= 10 (Apple LLVM >= 10) |
|
2019-03-17 11:31:29 +00:00
|
|
|
|
|
|
|
### Official binary platforms and toolchains
|
|
|
|
|
|
|
|
Binaries at <https://nodejs.org/download/release/> are produced on:
|
|
|
|
|
|
|
|
| Binary package | Platform and Toolchain |
|
|
|
|
| --------------------- | ------------------------------------------------------------------------ |
|
|
|
|
| aix-ppc64 | AIX 7.1 TL05 on PPC64BE with GCC 6 |
|
2020-03-24 10:21:08 +00:00
|
|
|
| darwin-x64 (and .pkg) | macOS 10.15, Xcode Command Line Tools 11 with -mmacosx-version-min=10.13 |
|
2020-04-13 11:31:34 +00:00
|
|
|
| linux-arm64 | CentOS 7 with devtoolset-8 / GCC 8 <sup>[8](#fn8)</sup> |
|
2020-04-14 08:38:40 +00:00
|
|
|
| linux-armv7l | Cross-compiled on Ubuntu 18.04 x64 with [custom GCC toolchain](https://github.com/rvagg/rpi-newer-crosstools) |
|
2020-04-13 11:31:34 +00:00
|
|
|
| linux-ppc64le | CentOS 7 with devtoolset-8 / GCC 8 <sup>[8](#fn8)</sup> |
|
|
|
|
| linux-s390x | RHEL 7 with devtoolset-8 / GCC 8 <sup>[8](#fn8)</sup> |
|
|
|
|
| linux-x64 | CentOS 7 with devtoolset-8 / GCC 8 <sup>[8](#fn8)</sup> |
|
2020-02-20 19:35:14 +00:00
|
|
|
| win-x64 and win-x86 | Windows 2012 R2 (x64) with Visual Studio 2019 |
|
2019-03-17 11:31:29 +00:00
|
|
|
|
2020-04-13 11:31:34 +00:00
|
|
|
<em id="fn8">8</em>: The Enterprise Linux devtoolset-8 allows us to compile
|
|
|
|
binaries with GCC 8 but linked to the glibc and libstdc++ versions of the host
|
2019-03-17 11:31:29 +00:00
|
|
|
platforms (CentOS 7 / RHEL 7). Therefore, binaries produced on these systems
|
|
|
|
are compatible with glibc >= 2.17 and libstdc++ >= 6.0.20 (`GLIBCXX_3.4.20`).
|
|
|
|
These are available on distributions natively supporting GCC 4.9, such as
|
|
|
|
Ubuntu 14.04 and Debian 8.
|
2017-03-17 21:34:54 +00:00
|
|
|
|
2018-03-07 13:31:05 +00:00
|
|
|
#### OpenSSL asm support
|
|
|
|
|
2018-11-10 01:54:00 +00:00
|
|
|
OpenSSL-1.1.1 requires the following assembler version for use of asm
|
2018-04-23 12:26:28 +00:00
|
|
|
support on x86_64 and ia32.
|
2018-03-07 13:31:05 +00:00
|
|
|
|
2018-11-10 01:54:00 +00: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 19:19:27 +00:00
|
|
|
AVX-512 is disabled for Skylake-X by OpenSSL-1.1.1.
|
2018-11-10 01:54:00 +00:00
|
|
|
|
|
|
|
For use of AVX2,
|
|
|
|
|
2018-03-07 13:31:05 +00:00
|
|
|
* gas (GNU assembler) version 2.23 or higher
|
2018-11-08 06:43:45 +00:00
|
|
|
* Xcode version 5.0 or higher
|
2018-03-07 13:31:05 +00:00
|
|
|
* llvm version 3.3 or higher
|
|
|
|
* nasm version 2.10 or higher in Windows
|
|
|
|
|
2018-11-10 01:54:00 +00:00
|
|
|
Please refer to
|
2020-04-06 03:26:24 +00:00
|
|
|
<https://www.openssl.org/docs/man1.1.1/man3/OPENSSL_ia32cap.html> for details.
|
2018-03-07 13:31:05 +00:00
|
|
|
|
2018-11-10 01:54:00 +00:00
|
|
|
If compiling without one of the above, use `configure` with the
|
|
|
|
`--openssl-no-asm` flag. Otherwise, `configure` will fail.
|
|
|
|
|
2019-03-17 11:31:29 +00: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:
|
|
|
|
|
2019-11-22 14:32:52 +00:00
|
|
|
* [Node.js 13](https://github.com/nodejs/node/blob/v13.x/BUILDING.md)
|
|
|
|
* [Node.js 12](https://github.com/nodejs/node/blob/v12.x/BUILDING.md)
|
2019-03-17 11:31:29 +00:00
|
|
|
* [Node.js 10](https://github.com/nodejs/node/blob/v10.x/BUILDING.md)
|
|
|
|
* [Node.js 8](https://github.com/nodejs/node/blob/v8.x/BUILDING.md)
|
|
|
|
|
2017-03-17 21:34:54 +00:00
|
|
|
## Building Node.js on supported platforms
|
2016-03-09 23:41:52 +00:00
|
|
|
|
2019-06-28 08:01:02 +00:00
|
|
|
### Note about Python 2 and Python 3
|
2017-11-14 14:57:11 +00:00
|
|
|
|
2019-11-29 21:52:50 +00:00
|
|
|
The Node.js project supports both Python 3 and Python 2 for building.
|
|
|
|
If both are installed Python 3 will be used. If only Python 2 is available
|
|
|
|
it will be used instead. When possible we recommend that you build and
|
|
|
|
test with Python 3.
|
2019-06-28 08:01:02 +00:00
|
|
|
|
|
|
|
### Unix and macOS
|
|
|
|
|
|
|
|
#### Unix prerequisites
|
2016-03-09 23:41:52 +00:00
|
|
|
|
2019-03-17 11:31:29 +00:00
|
|
|
* `gcc` and `g++` >= 6.3 or newer, or
|
2016-03-09 23:41:52 +00:00
|
|
|
* GNU Make 3.81 or newer
|
2019-06-28 08:01:02 +00:00
|
|
|
* Python (see note above)
|
2019-09-01 06:18:32 +00:00
|
|
|
* Python 2.7
|
2019-11-29 21:52:50 +00:00
|
|
|
* Python 3.5, 3.6, 3.7, and 3.8.
|
2019-06-28 08:01:02 +00:00
|
|
|
|
|
|
|
Installation via Linux package manager can be achieved with:
|
|
|
|
|
|
|
|
* Ubuntu, Debian: `sudo apt-get install python g++ make`
|
|
|
|
* Fedora: `sudo dnf install python gcc-c++ make`
|
|
|
|
* CentOS and RHEL: `sudo yum install python gcc-c++ make`
|
|
|
|
* OpenSUSE: `sudo zypper install python gcc-c++ make`
|
2020-02-07 05:43:31 +00:00
|
|
|
* Arch Linux, Manjaro: `sudo pacman -S python gcc make`
|
2016-04-20 17:48:22 +00:00
|
|
|
|
2019-06-28 08:01:02 +00:00
|
|
|
FreeBSD and OpenBSD users may also need to install `libexecinfo`.
|
|
|
|
|
|
|
|
#### macOS prerequisites
|
|
|
|
|
2019-09-19 22:33:15 +00:00
|
|
|
* Xcode Command Line Tools >= 10 for macOS
|
2019-06-28 08:01:02 +00:00
|
|
|
* Python (see note above)
|
2019-09-01 06:18:32 +00:00
|
|
|
* Python 2.7
|
2019-11-29 21:52:50 +00:00
|
|
|
* Python 3.5, 3.6, 3.7, and 3.8.
|
2019-06-28 08:01:02 +00:00
|
|
|
|
|
|
|
macOS users can install the `Xcode Command Line Tools` by running
|
2017-05-28 10:57:35 +00: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 06:56:01 +00:00
|
|
|
|
2019-06-28 08:01:02 +00:00
|
|
|
#### Building Node.js
|
|
|
|
|
2018-02-12 07:31:55 +00:00
|
|
|
If the path to your build directory contains a space, the build will likely
|
|
|
|
fail.
|
2017-07-18 19:03:43 +00:00
|
|
|
|
2016-09-03 03:23:21 +00:00
|
|
|
To build Node.js:
|
2016-04-20 17:48:22 +00:00
|
|
|
|
2016-07-14 09:55:30 +00:00
|
|
|
```console
|
2016-03-09 23:41:52 +00:00
|
|
|
$ ./configure
|
2016-12-01 16:47:46 +00:00
|
|
|
$ make -j4
|
2016-03-09 23:41:52 +00:00
|
|
|
```
|
|
|
|
|
2019-11-02 15:27:48 +00:00
|
|
|
If you run into a `No module named 'distutils.spawn'` error when executing
|
|
|
|
`./configure`, please try `python3 -m pip install --upgrade setuptools` or
|
|
|
|
`sudo apt install python3-distutils -y`.
|
2020-04-06 03:26:24 +00:00
|
|
|
For more information, see <https://github.com/nodejs/node/issues/30189>.
|
2019-11-02 15:27:48 +00:00
|
|
|
|
2018-11-08 06:43:45 +00:00
|
|
|
The `-j4` option will cause `make` to run 4 simultaneous compilation jobs which
|
|
|
|
may reduce build time. For more information, see the
|
|
|
|
[GNU Make Documentation](https://www.gnu.org/software/make/manual/html_node/Parallel.html).
|
2016-12-01 16:47:46 +00:00
|
|
|
|
2019-06-20 19:19:27 +00:00
|
|
|
The above requires that `python` resolves to a supported version of
|
2019-03-17 11:31:29 +00:00
|
|
|
Python. See [Prerequisites](#prerequisites).
|
2016-03-09 23:41:52 +00:00
|
|
|
|
2018-08-21 17:28:18 +00: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
|
|
|
|
```
|
|
|
|
|
2018-01-09 11:34:11 +00:00
|
|
|
#### Running Tests
|
|
|
|
|
|
|
|
To verify the build:
|
|
|
|
|
|
|
|
```console
|
|
|
|
$ make test-only
|
|
|
|
```
|
|
|
|
|
|
|
|
At this point, you are ready to make code changes and re-run the tests.
|
|
|
|
|
2018-10-12 00:15:15 +00:00
|
|
|
If you are running tests before submitting a Pull Request, the recommended
|
2018-01-09 11:34:11 +00:00
|
|
|
command is:
|
2016-03-09 23:41:52 +00:00
|
|
|
|
2017-05-28 20:20:21 +00:00
|
|
|
```console
|
2018-04-17 00:46:25 +00:00
|
|
|
$ make -j4 test
|
2016-03-09 23:41:52 +00:00
|
|
|
```
|
|
|
|
|
2018-04-17 00:46:25 +00:00
|
|
|
`make -j4 test` does a full check on the codebase, including running linters and
|
2018-01-09 11:34:11 +00:00
|
|
|
documentation tests.
|
|
|
|
|
2018-10-29 05:59:56 +00:00
|
|
|
Make sure the linter does not report any issues and that all tests pass. Please
|
|
|
|
do not submit patches that fail either check.
|
|
|
|
|
|
|
|
If you want to run the linter without running tests, use
|
2019-07-06 18:08:01 +00:00
|
|
|
`make lint`/`vcbuild lint`. It will lint JavaScript, C++, and Markdown files.
|
2018-10-29 05:59:56 +00:00
|
|
|
|
2019-05-04 11:45:48 +00: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 18:06:32 +00:00
|
|
|
|
|
|
|
```text
|
2019-08-13 18:12:13 +00:00
|
|
|
$ python tools/test.py test/parallel/test-stream2-transform.js
|
2018-10-12 18:06:32 +00:00
|
|
|
```
|
|
|
|
|
|
|
|
You can execute the entire suite of tests for a given subsystem
|
|
|
|
by providing the name of a subsystem:
|
|
|
|
|
|
|
|
```text
|
|
|
|
$ python tools/test.py -J --mode=release child-process
|
|
|
|
```
|
|
|
|
|
|
|
|
If you want to check the other options, please refer to the help by using
|
2018-10-20 01:33:00 +00:00
|
|
|
the `--help` option:
|
2018-10-12 18:06:32 +00:00
|
|
|
|
|
|
|
```text
|
|
|
|
$ python tools/test.py --help
|
|
|
|
```
|
|
|
|
|
|
|
|
You can usually run tests directly with node:
|
|
|
|
|
|
|
|
```text
|
|
|
|
$ ./node ./test/parallel/test-stream2-transform.js
|
|
|
|
```
|
|
|
|
|
2018-10-29 05:59:56 +00:00
|
|
|
Remember to recompile with `make -j4` in between test runs if you change code in
|
|
|
|
the `lib` or `src` directories.
|
|
|
|
|
2018-11-14 22:53:59 +00: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
|
|
|
|
on Ubuntu that does not seem to be the case. To enable '::1' on the
|
|
|
|
loopback interface on Ubuntu:
|
|
|
|
|
|
|
|
```bash
|
|
|
|
sudo sysctl -w net.ipv6.conf.lo.disable_ipv6=0
|
|
|
|
```
|
|
|
|
|
2018-11-01 05:46:29 +00:00
|
|
|
You can use
|
|
|
|
[node-code-ide-configs](https://github.com/nodejs/node-code-ide-configs)
|
|
|
|
to run/debug tests, if your IDE configs are present.
|
|
|
|
|
2018-10-29 05:59:56 +00:00
|
|
|
#### Running Coverage
|
2017-10-06 17:42:35 +00:00
|
|
|
|
2018-10-29 05:59:56 +00: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-04 22:10:05 +00:00
|
|
|
|
|
|
|
```console
|
|
|
|
$ ./configure --coverage
|
|
|
|
$ make coverage
|
|
|
|
```
|
|
|
|
|
2018-10-29 05:59:56 +00:00
|
|
|
A detailed coverage report will be written to `coverage/index.html` for
|
|
|
|
JavaScript coverage and to `coverage/cxxcoverage.html` for C++ coverage
|
|
|
|
(if you only want to run the JavaScript tests then you do not need to run
|
|
|
|
the first command `./configure --coverage`).
|
|
|
|
|
|
|
|
_Generating a test coverage report can take several minutes._
|
|
|
|
|
|
|
|
To collect coverage for a subset of tests you can set the `CI_JS_SUITES` and
|
2019-01-22 20:14:41 +00:00
|
|
|
`CI_NATIVE_SUITES` variables (to run specific suites, e.g., `child-process`, in
|
|
|
|
isolation, unset the opposing `_SUITES` variable):
|
2018-10-29 05:59:56 +00:00
|
|
|
|
|
|
|
```text
|
|
|
|
$ CI_JS_SUITES=child-process CI_NATIVE_SUITES= make coverage
|
|
|
|
```
|
|
|
|
|
|
|
|
The above command executes tests for the `child-process` subsystem and
|
|
|
|
outputs the resulting coverage report.
|
2017-09-04 22:10:05 +00:00
|
|
|
|
2019-01-22 20:14:41 +00:00
|
|
|
Alternatively, you can run `make coverage-run-js`, to execute JavaScript tests
|
|
|
|
independently of the C++ test suite:
|
2019-01-18 21:46:49 +00:00
|
|
|
|
|
|
|
```text
|
|
|
|
$ CI_JS_SUITES=fs CI_NATIVE_SUITES= make coverage-run-js
|
|
|
|
```
|
|
|
|
|
|
|
|
The `make coverage` command downloads some tools to the project root directory.
|
|
|
|
To clean up after generating the coverage reports:
|
2017-09-04 22:10:05 +00:00
|
|
|
|
|
|
|
```console
|
2017-10-06 17:42:35 +00:00
|
|
|
$ make coverage-clean
|
2017-09-04 22:10:05 +00:00
|
|
|
```
|
|
|
|
|
2018-01-09 11:34:11 +00:00
|
|
|
#### Building the documentation
|
|
|
|
|
2016-03-09 23:41:52 +00:00
|
|
|
To build the documentation:
|
|
|
|
|
2015-11-18 22:40:03 +00:00
|
|
|
This will build Node.js first (if necessary) and then use it to build the docs:
|
|
|
|
|
2016-07-14 09:55:30 +00:00
|
|
|
```console
|
2016-03-09 23:41:52 +00:00
|
|
|
$ make doc
|
|
|
|
```
|
|
|
|
|
2017-08-18 18:36:33 +00:00
|
|
|
If you have an existing Node.js build, you can build just the docs with:
|
2015-11-18 22:40:03 +00:00
|
|
|
|
2016-07-14 09:55:30 +00:00
|
|
|
```console
|
2016-09-03 03:23:21 +00:00
|
|
|
$ NODE=/path/to/node make doc-only
|
2015-11-18 22:40:03 +00:00
|
|
|
```
|
|
|
|
|
2016-03-09 23:41:52 +00:00
|
|
|
To read the documentation:
|
|
|
|
|
2016-07-14 09:55:30 +00:00
|
|
|
```console
|
2016-03-09 23:41:52 +00:00
|
|
|
$ man doc/node.1
|
|
|
|
```
|
|
|
|
|
2018-03-13 15:12:40 +00:00
|
|
|
If you prefer to read the documentation in a browser,
|
|
|
|
run the following after `make doc` is finished:
|
|
|
|
|
|
|
|
```console
|
|
|
|
$ make docopen
|
|
|
|
```
|
|
|
|
|
|
|
|
This will open a browser with the documentation.
|
|
|
|
|
2016-03-09 23:41:52 +00:00
|
|
|
To test if Node.js was built correctly:
|
|
|
|
|
2016-07-14 09:55:30 +00:00
|
|
|
```console
|
2016-09-03 03:23:21 +00:00
|
|
|
$ ./node -e "console.log('Hello from Node.js ' + process.version)"
|
|
|
|
```
|
|
|
|
|
|
|
|
To install this version of Node.js into a system directory:
|
|
|
|
|
|
|
|
```console
|
|
|
|
$ [sudo] make install
|
2016-03-09 23:41:52 +00:00
|
|
|
```
|
|
|
|
|
2018-08-24 18:52:18 +00: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:
|
|
|
|
|
|
|
|
``` console
|
2019-11-17 11:15:21 +00:00
|
|
|
$ make install PREFIX=/opt/node-debug/
|
2018-08-24 18:52:18 +00: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 17:31:18 +00:00
|
|
|
was captured on (i.e. 64-bit `gdb` for `node` built on a 64-bit system, Linux
|
2018-08-24 18:52:18 +00: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:
|
|
|
|
|
|
|
|
``` console
|
|
|
|
$ gdb /opt/node-debug/node core.node.8.1535359906
|
|
|
|
$ backtrace
|
|
|
|
```
|
2016-03-09 23:41:52 +00:00
|
|
|
|
2020-03-23 12:07:29 +00: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)
|
|
|
|
(using an image like `gengjiawen/node-build:2020-02-14`).
|
|
|
|
|
|
|
|
The `--debug` is not necessary and will slow down build and testing, but it can
|
|
|
|
show clear stacktrace if ASAN hits an issue.
|
|
|
|
|
|
|
|
``` console
|
|
|
|
$ ./configure --debug --enable-asan && make -j4
|
|
|
|
$ make test-only
|
|
|
|
```
|
|
|
|
|
2020-01-28 00:58:07 +00: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-09 23:41:52 +00:00
|
|
|
### Windows
|
|
|
|
|
2019-06-28 08:01:02 +00:00
|
|
|
#### Prerequisites
|
|
|
|
|
|
|
|
##### Option 1: Manual install
|
2016-03-09 23:41:52 +00:00
|
|
|
|
2019-01-28 14:15:31 +00:00
|
|
|
* [Python 2.7](https://www.python.org/downloads/)
|
2017-11-07 17:36:09 +00:00
|
|
|
* The "Desktop development with C++" workload from
|
2019-10-18 09:04:35 +00:00
|
|
|
[Visual Studio 2017 or 2019](https://visualstudio.microsoft.com/downloads/) or
|
|
|
|
the "Visual C++ build tools" workload from the
|
|
|
|
[Build Tools](https://visualstudio.microsoft.com/downloads/#build-tools-for-visual-studio-2019),
|
2017-11-07 17:36:09 +00:00
|
|
|
with the default optional components.
|
2016-03-09 23:41:52 +00:00
|
|
|
* Basic Unix tools required for some tests,
|
2019-09-04 06:39:05 +00:00
|
|
|
[Git for Windows](https://git-scm.com/download/win) includes Git Bash
|
2016-03-09 23:41:52 +00:00
|
|
|
and tools which can be included in the global `PATH`.
|
2019-09-04 06:39:05 +00:00
|
|
|
* The [NetWide Assembler](https://www.nasm.us/), for OpenSSL assembler modules.
|
2018-04-11 12:11:36 +00:00
|
|
|
If not installed in the default location, it needs to be manually added
|
2019-01-03 00:44:23 +00: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 08:01:02 +00:00
|
|
|
|
|
|
|
Optional requirements to build the MSI installer package:
|
|
|
|
|
2019-09-04 06:39:05 +00:00
|
|
|
* The [WiX Toolset v3.11](https://wixtoolset.org/releases/) and the
|
2019-10-18 09:04:35 +00:00
|
|
|
[Wix Toolset Visual Studio 2017 Extension](https://marketplace.visualstudio.com/items?itemName=RobMensching.WixToolsetVisualStudio2017Extension)
|
|
|
|
or the [Wix Toolset Visual Studio 2019 Extension](https://marketplace.visualstudio.com/items?itemName=WixToolset.WixToolsetVisualStudio2019Extension).
|
2019-06-28 08:01:02 +00:00
|
|
|
|
|
|
|
Optional requirements for compiling for Windows 10 on ARM (ARM64):
|
|
|
|
|
|
|
|
* ARM64 Windows build machine
|
|
|
|
* Due to a GYP limitation, this is required to run compiled code
|
|
|
|
generation tools (like V8's builtins and mksnapshot tools)
|
|
|
|
* 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 06:39:05 +00:00
|
|
|
A [Boxstarter](https://boxstarter.org/) script can be used for easy setup of
|
2019-06-28 08:01:02 +00: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
|
|
|
|
Unix tools added to the `PATH`.
|
|
|
|
* [Python 3.x](https://chocolatey.org/packages/python) and
|
|
|
|
[legacy Python](https://chocolatey.org/packages/python2)
|
2020-03-16 10:17:08 +00:00
|
|
|
* [Visual Studio 2019 Build Tools](https://chocolatey.org/packages/visualstudio2019buildtools)
|
2019-06-28 08:01:02 +00:00
|
|
|
with [Visual C++ workload](https://chocolatey.org/packages/visualstudio2017-workload-vctools)
|
|
|
|
* [NetWide Assembler](https://chocolatey.org/packages/nasm)
|
|
|
|
|
|
|
|
To install Node.js prerequisites using
|
2019-09-04 06:39:05 +00:00
|
|
|
[Boxstarter WebLauncher](https://boxstarter.org/WebLauncher), open
|
|
|
|
<https://boxstarter.org/package/nr/url?https://raw.githubusercontent.com/nodejs/node/master/tools/bootstrap/windows_boxstarter>
|
2019-06-28 08:01:02 +00: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 06:39:05 +00:00
|
|
|
iex ((New-Object System.Net.WebClient).DownloadString('https://boxstarter.org/bootstrapper.ps1'))
|
2019-06-28 08:01:02 +00:00
|
|
|
get-boxstarter -Force
|
|
|
|
Install-BoxstarterPackage https://raw.githubusercontent.com/nodejs/node/master/tools/bootstrap/windows_boxstarter -DisableReboots
|
|
|
|
```
|
|
|
|
|
|
|
|
The entire installation using Boxstarter will take up approximately 10 GB of
|
|
|
|
disk space.
|
|
|
|
|
|
|
|
#### Building Node.js
|
2016-03-09 23:41:52 +00:00
|
|
|
|
2018-02-12 07:31:55 +00:00
|
|
|
If the path to your build directory contains a space or a non-ASCII character,
|
|
|
|
the build will likely fail.
|
2017-07-18 19:03:43 +00:00
|
|
|
|
2016-07-14 09:55:30 +00:00
|
|
|
```console
|
2016-12-06 20:52:59 +00:00
|
|
|
> .\vcbuild
|
2016-03-09 23:41:52 +00:00
|
|
|
```
|
|
|
|
|
|
|
|
To run the tests:
|
|
|
|
|
2016-07-14 09:55:30 +00:00
|
|
|
```console
|
2017-01-16 16:25:00 +00:00
|
|
|
> .\vcbuild test
|
2016-03-09 23:41:52 +00:00
|
|
|
```
|
|
|
|
|
|
|
|
To test if Node.js was built correctly:
|
|
|
|
|
2016-07-14 09:55:30 +00:00
|
|
|
```console
|
2016-06-13 10:24:53 +00:00
|
|
|
> Release\node -e "console.log('Hello from Node.js', process.version)"
|
2016-03-09 23:41:52 +00:00
|
|
|
```
|
|
|
|
|
2018-01-04 23:37:53 +00:00
|
|
|
### Android/Android-based devices (e.g. Firefox OS)
|
2016-04-04 17:48:34 +00:00
|
|
|
|
2018-10-12 00:15:15 +00: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-09 23:41:52 +00:00
|
|
|
|
2017-04-01 08:07:31 +00:00
|
|
|
Be sure you have downloaded and extracted
|
|
|
|
[Android NDK](https://developer.android.com/tools/sdk/ndk/index.html) before in
|
|
|
|
a folder. Then run:
|
2016-03-09 23:41:52 +00:00
|
|
|
|
2016-07-14 09:55:30 +00:00
|
|
|
```console
|
2016-03-09 23:41:52 +00:00
|
|
|
$ ./android-configure /path/to/your/android-ndk
|
|
|
|
$ make
|
|
|
|
```
|
|
|
|
|
2019-06-28 08:01:02 +00:00
|
|
|
## `Intl` (ECMA-402) support
|
2016-03-09 23:41:52 +00:00
|
|
|
|
2018-06-16 17:43:50 +00:00
|
|
|
[Intl](https://github.com/nodejs/node/blob/master/doc/api/intl.md) support is
|
2019-09-30 18:17:49 +00:00
|
|
|
enabled by default.
|
2016-03-09 23:41:52 +00:00
|
|
|
|
2019-09-30 18:17:49 +00:00
|
|
|
### Build with full ICU support (all locales supported by ICU)
|
2016-03-09 23:41:52 +00:00
|
|
|
|
2019-09-30 18:17:49 +00:00
|
|
|
This is the default option.
|
2016-03-09 23:41:52 +00:00
|
|
|
|
2019-09-30 18:17:49 +00:00
|
|
|
#### Unix/macOS
|
2016-03-09 23:41:52 +00:00
|
|
|
|
2019-09-30 18:17:49 +00:00
|
|
|
```console
|
|
|
|
$ ./configure --with-intl=full-icu
|
|
|
|
```
|
|
|
|
|
|
|
|
#### Windows
|
|
|
|
|
|
|
|
```console
|
|
|
|
> .\vcbuild full-icu
|
|
|
|
```
|
|
|
|
|
|
|
|
### Trimmed: `small-icu` (English only) support
|
|
|
|
|
|
|
|
In this configuration, only English data is included, but
|
|
|
|
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-09 23:41:52 +00:00
|
|
|
|
2019-06-28 08:01:02 +00:00
|
|
|
#### Unix/macOS
|
2016-03-09 23:41:52 +00:00
|
|
|
|
2016-07-14 09:55:30 +00:00
|
|
|
```console
|
2019-09-30 18:17:49 +00:00
|
|
|
$ ./configure --with-intl=small-icu
|
2016-03-09 23:41:52 +00:00
|
|
|
```
|
|
|
|
|
2019-06-28 08:01:02 +00:00
|
|
|
#### Windows
|
2016-03-09 23:41:52 +00:00
|
|
|
|
2016-07-14 09:55:30 +00:00
|
|
|
```console
|
2019-09-30 18:17:49 +00:00
|
|
|
> .\vcbuild small-icu
|
2016-03-09 23:41:52 +00:00
|
|
|
```
|
|
|
|
|
2019-06-28 08:01:02 +00:00
|
|
|
### Building without Intl support
|
2016-03-09 23:41:52 +00:00
|
|
|
|
2016-04-09 02:03:24 +00:00
|
|
|
The `Intl` object will not be available, nor some other APIs such as
|
|
|
|
`String.normalize`.
|
2016-03-09 23:41:52 +00:00
|
|
|
|
2019-06-28 08:01:02 +00:00
|
|
|
#### Unix/macOS
|
2016-03-09 23:41:52 +00:00
|
|
|
|
2016-07-14 09:55:30 +00:00
|
|
|
```console
|
2016-04-09 02:03:24 +00:00
|
|
|
$ ./configure --without-intl
|
2016-03-09 23:41:52 +00:00
|
|
|
```
|
|
|
|
|
2019-06-28 08:01:02 +00:00
|
|
|
#### Windows
|
2016-03-09 23:41:52 +00:00
|
|
|
|
2016-07-14 09:55:30 +00:00
|
|
|
```console
|
2017-01-16 16:25:00 +00:00
|
|
|
> .\vcbuild without-intl
|
2016-03-09 23:41:52 +00:00
|
|
|
```
|
|
|
|
|
2019-06-28 08:01:02 +00:00
|
|
|
### Use existing installed ICU (Unix/macOS only)
|
2016-03-09 23:41:52 +00:00
|
|
|
|
2016-07-14 09:55:30 +00:00
|
|
|
```console
|
2016-03-09 23:41:52 +00:00
|
|
|
$ pkg-config --modversion icu-i18n && ./configure --with-intl=system-icu
|
|
|
|
```
|
|
|
|
|
2018-10-30 17:31:18 +00:00
|
|
|
If you are cross-compiling, your `pkg-config` must be able to supply a path
|
2016-03-09 23:41:52 +00:00
|
|
|
that works for both your host and target environments.
|
|
|
|
|
2019-06-28 08:01:02 +00:00
|
|
|
### Build with a specific ICU
|
2016-03-09 23:41:52 +00:00
|
|
|
|
|
|
|
You can find other ICU releases at
|
|
|
|
[the ICU homepage](http://icu-project.org/download).
|
|
|
|
Download the file named something like `icu4c-**##.#**-src.tgz` (or
|
|
|
|
`.zip`).
|
|
|
|
|
2018-06-08 20:57:32 +00: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 08:01:02 +00:00
|
|
|
#### Unix/macOS
|
2016-03-09 23:41:52 +00:00
|
|
|
|
2016-07-14 09:55:30 +00:00
|
|
|
From an already-unpacked ICU:
|
2019-08-29 13:28:03 +00:00
|
|
|
|
2016-07-14 09:55:30 +00:00
|
|
|
```console
|
2016-03-09 23:41:52 +00:00
|
|
|
$ ./configure --with-intl=[small-icu,full-icu] --with-icu-source=/path/to/icu
|
2016-07-14 09:55:30 +00:00
|
|
|
```
|
2016-03-09 23:41:52 +00:00
|
|
|
|
2016-07-14 09:55:30 +00:00
|
|
|
From a local ICU tarball:
|
2019-08-29 13:28:03 +00:00
|
|
|
|
2016-07-14 09:55:30 +00:00
|
|
|
```console
|
2016-03-09 23:41:52 +00:00
|
|
|
$ ./configure --with-intl=[small-icu,full-icu] --with-icu-source=/path/to/icu.tgz
|
2016-07-14 09:55:30 +00:00
|
|
|
```
|
2016-03-09 23:41:52 +00:00
|
|
|
|
2016-07-14 09:55:30 +00:00
|
|
|
From a tarball URL:
|
2019-08-29 13:28:03 +00:00
|
|
|
|
2016-07-14 09:55:30 +00:00
|
|
|
```console
|
2016-03-09 23:41:52 +00:00
|
|
|
$ ./configure --with-intl=full-icu --with-icu-source=http://url/to/icu.tgz
|
|
|
|
```
|
|
|
|
|
2019-06-28 08:01:02 +00:00
|
|
|
#### Windows
|
2016-03-09 23:41:52 +00:00
|
|
|
|
|
|
|
First unpack latest ICU to `deps/icu`
|
|
|
|
[icu4c-**##.#**-src.tgz](http://icu-project.org/download) (or `.zip`)
|
|
|
|
as `deps/icu` (You'll have: `deps/icu/source/...`)
|
|
|
|
|
2016-07-14 09:55:30 +00:00
|
|
|
```console
|
2017-01-16 16:25:00 +00:00
|
|
|
> .\vcbuild full-icu
|
2016-03-09 23:41:52 +00:00
|
|
|
```
|
|
|
|
|
|
|
|
## Building Node.js with FIPS-compliant OpenSSL
|
|
|
|
|
2019-03-17 11:31:29 +00:00
|
|
|
The current version of Node.js does not support FIPS.
|
2017-12-16 05:19:16 +00: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 17:31:18 +00:00
|
|
|
the binary as built-in modules when building Node.js.
|
2017-12-16 05:19:16 +00:00
|
|
|
|
2018-05-30 10:21:20 +00:00
|
|
|
### Unix/macOS
|
2017-12-16 05:19:16 +00: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 11:59:48 +00:00
|
|
|
To make `./myModule.js` available via `require('myModule')` and
|
|
|
|
`./myModule2.js` available via `require('myModule2')`:
|
2017-12-16 05:19:16 +00:00
|
|
|
|
|
|
|
```console
|
2018-05-16 11:59:48 +00:00
|
|
|
> .\vcbuild link-module './myModule.js' link-module './myModule2.js'
|
2017-12-16 05:19:16 +00:00
|
|
|
```
|
2018-08-10 16:10:24 +00:00
|
|
|
|
|
|
|
## Note for downstream distributors of Node.js
|
|
|
|
|
2018-11-06 02:40:03 +00: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
|
|
|
|
<https://github.com/nodejs/node/blob/master/doc/abi_version_registry.json>.
|