Skip to content

What are the header files in the installation directory used for? #5054

Open
@hqzing

Description

@hqzing

Node.js Version

v23.10.0

NPM Version

10.9.2

Operating System

Linux 41bf7579c099 6.8.0-54-generic #56-Ubuntu SMP PREEMPT_DYNAMIC Sat Feb 8 00:37:57 UTC 2025 x86_64 x86_64 x86_64 GNU/Linux

Subsystem

Other

Description

I noticed that when we use the make install command to install the built Node.js artifacts, the Makefile script copies the header files into the installation directory, placing them in an include subdirectory.

For this reason, the pre-built package distributed by the official team for the Linux version also includes this include directory.

For example, in version v23.10.0, the structure inside the compressed package(node-v23.10.0-linux-x64.tar.gz) is as follows:

root@41bf7579c099:~# tree -L 2 node-v23.10.0-linux-x64
node-v23.10.0-linux-x64
├── CHANGELOG.md
├── LICENSE
├── README.md
├── bin
│   ├── corepack -> ../lib/node_modules/corepack/dist/corepack.js
│   ├── node
│   ├── npm -> ../lib/node_modules/npm/bin/npm-cli.js
│   └── npx -> ../lib/node_modules/npm/bin/npx-cli.js
├── include
│   └── node
├── lib
│   └── node_modules
└── share
    ├── doc
    └── man

9 directories, 7 files

So far, I haven't found any scenarios where these header files are actually used.

I speculate that the compressed package(node-v23.10.0-headers.tar.gz) specifically provided by the official team for header files can already replace the function of the include directory in the installation package. When node-gyp compiles an addon, it downloads this compressed package instead of using the header files in the installation directory.

Can someone explain to me what these header files in the installation directory are for?

Are they for libnode? Or are they for some other special scenarios? Or are they actually redundant?

Minimal Reproduction

No response

Output

No response

Before You Submit

  • I have looked for issues that already exist before submitting this
  • My issue follows the guidelines in the README file, and follows the 'How to ask a good question' guide at https://stackoverflow.com/help/how-to-ask

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions