nodejs / nodejs/node-gyp

Use `lib` prefix in `target_name` is dropped when naming .node file

Open
#2,264 1 comment 1 reaction 0 assignees View on GitHub

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: 12.18.1 npm: 6.14.5
  • Platform: macOS 10.15.2
  • Compiler: clang 11.0.3
  • Module: node-gyp 7.0.0

I'm not having any issues building or getting node-gyp to work. I am experiencing some weirdness, where the opening chars of my target_name are dropped in the outputted binary file. I'm using a target_name of lib{REST_OF_NAME}.

The lib part of my target name is dropped in the outputted .node file. In my lib{REST_OF_NAME}.target.mk file, the lib is dropped in lines like:

$(builddir)/{REST_OF_NAME}.node: GYP_LDFLAGS := $(LDFLAGS_$(BUILDTYPE))
$(builddir)/{REST_OF_NAME}.node: LIBS := $(LIBS)
$(builddir)/{REST_OF_NAME}.node: GYP_LIBTOOLFLAGS := $(LIBTOOLFLAGS_$(BUILDTYPE))
$(builddir)/{REST_OF_NAME}.node: TOOLSET := $(TOOLSET)
$(builddir)/{REST_OF_NAME}.node: $(OBJS) FORCE_DO_CMD
	$(call do_cmd,solink_module)

I see the desired name in lines like:

TARGET := lib{REST_OF_NAME}
DEFS_Debug := \
	'-DNODE_GYP_MODULE_NAME=lib{REST_OF_NAME}' \

Is there some feature I need to switch on, or some reason that a target cannot have a prefix of lib? If I put an underscore or some other character in front of lib it works. Normally I'd just rename my project and move on, but I am wrapping an existing library and can't change the name.

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

Reproduce the report with node-gyp 7.0.0 on macOS using a target_name beginning with lib, then inspect the generated lib{REST_OF_NAME}.target.mk. Compare the TARGET value with the generated .node filename; done when the lib prefix is preserved without changing the existing target name.

Written by the indexing model from the issue text.

Assessment

Tech stack
node.js, python
Domain
build-system, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.