mapbox / mapbox/node-pre-gyp

libc variable should default to unknown for non-linux target_platform?

Open
#383 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
1.2k
Forks
271
Avg merge
23h 40m
Merged PRs (30d)
2

Description

## TLDR;
I claim that the `libc` variable makes no sense for windows targets and should default to "unknown" when installing prebuilts on windows _and_ when installing prebuilts for windows on linux.

## Long Story
When invoking node-pre-gyp from win32, `libc` will default to the value "unknown".
When invoking node-pre-gyp from a linux platform (i.e. docker), but targeting win32, `libc` will default to whatever value is detected for the host. Thus, if a native package includes `libc` within the `package_name` template, node-pre-gyp will attempt to download the wrong prebuilt binary.

A real world example of "installing prebuilts _for_ windows _on_ linux": electron-builder allows one to build a windows app distribution from a docker instance if all native modules have win32 prebuilts available. This mostly works, except for the case where the native module uses the `libc` variable within the `package_name` template. An example of such a package is `grpc-node`, which is used by many packages such as `firebase` for example.

Thus, should node-pre-gyp default the `libc` variable to unknown when targeting win32?

Or, is it the responsibility of each and every client of node-pre-gyp to ensure that the `target_libc` option is set to "unknown" for the edge case of cross-installing dependencies?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing how node-pre-gyp determines libc and target_platform during native package installation, including the package_name template and target_libc option. Reproduce installation for a win32 target from both win32 and Linux hosts. Done means win32-targeted prebuilts consistently use libc as unknown, with coverage for both host scenarios.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, node.js
Domain
tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.