make error when run without access to `/proc`
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 10.7k
- Forks
- 1.9k
- Avg merge
- 1d 4h
- Merged PRs (30d)
- 5
Description
- Node Version: node = v20.16.0, npm = 10.8.1
- Platform: Linux 6.8.0-40-generic x86_64
- Module: re2
Verbose output (from npm or node-gyp):
npm error gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build', '--jobs', 0 ]
npm error make: the '-j' option requires a positive integer argument
When building a package using the systemd security option ProcSubset=pid, gyp sets the number of jobs to 0, which make does not accept.
I believe the relevant code is here: https://github.com/nodejs/node-gyp/blob/e6f4ede10cca28e9edeaa85d7830914c5d1499c7/lib/build.js#L176-L179
The documentation for Node function os.cpus() says:
Returns an array of objects containing information about each logical CPU core. The array will be empty if no CPU information is available, such as if the
/procfile system is unavailable.
This can be shown by getting the number of CPUs in a transient service unit:
$ node -e "console.log(require('node:os').cpus().length)"
16
$ sudo systemd-run -p ProcSubset=pid -t -- \
node -e "console.log(require('node:os').cpus().length)"
0
In the event of os.cpus() not returning any information, I suggest that gyp should either default to some constant number of parallel jobs or let make run as many jobs as it wants.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with lib/build.js at lines 176-179 and reproduce the zero-CPU result using the provided systemd-run command with ProcSubset=pid. Check the resulting make arguments and verify that a build no longer passes a zero job count when os.cpus() returns an empty array.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, linux, node.js
- Domain
- build-system, tooling
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 55/100