nodejs / nodejs/node-gyp

Compile commands only generates entry for nothing.c

Open
#2,159 1 comment 0 reactions 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

I'm trying to generate a a compile commands json file in a mono repo. Unfortunately, it is only giving me a compile_commands.json with nothing.c entry and not my files.

  • Node Version: 12.18.0 (npm 6.14.4)
  • Platform: Linux ubuntu 18 kernel 4.15.0
  • Compiler: gcc 7.5.0
  • Module: custom
Incomplete compile_commands.json

It's a mono repo with multiple packages, one requires a native add on, it compiles fine with:

node-gyp clean
node-gyp configure
node-gyp build

It also compiles fine with rebuild command. However when I try to generate a compile_commands.json it only includes one entry for nothing.c and not for the files specified in binding.gyp:

node-gyp clean
node-gyp configure -- -f gyp.generator.compile_commands_json.py
node-gyp build

This goes ok but the compile_commands.json file only has one entry for nothing.c.

The repository structure is more or less like:

root
|- node_modules
|- packages
   |- package1
      |- src
   |- package2
      |- src
      |- c
   |- packageN

I'm almost sure that the repository structure has something to do, because i tried in another repository and it seems to be working fine. Just not sure how to work around it. Of if someone else can confirm a similar behavior.

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 with the node-gyp configure command using gyp.generator.compile_commands_json.py and inspect the package's binding.gyp alongside the generated compile_commands.json. Reproduce the monorepo case and compare it with the working repository; done means the JSON includes compile entries for the native source files rather than only nothing.c.

Written by the indexing model from the issue text.

Assessment

Tech stack
c, node.js, python
Domain
build-system
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.