Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

compile_commands_json generator ignores output directory #2305

Closed
ikokostya opened this issue Jan 17, 2021 · 2 comments · Fixed by nodejs/gyp-next#191
Closed

compile_commands_json generator ignores output directory #2305

ikokostya opened this issue Jan 17, 2021 · 2 comments · Fixed by nodejs/gyp-next#191

Comments

@ikokostya
Copy link

  • Node Version: v14.15.4, npm 6.14.10
  • Platform: Linux 5.4.0-62-generic #70-Ubuntu SMP Tue Jan 12 12:45:47 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
  • Compiler: gcc version 9.3.0 (Ubuntu 9.3.0-17ubuntu1~20.04)
  • Module: Local module

Steps to reproduce

Generate compile_commands.json:

$ node-gyp configure -- -f compile_commands_json

Expected behavior

The command above produces two files Debug/compile_commands.json and Release/compile_commands.json in the build directory like make generator:

$ node-gyp configure

Actual behavior

The command above produces two files Debug/compile_commands.json and Release/compile_commands.json in the current directory:

Verbose output:
$ ls -1
binding.gyp
node_modules
package-lock.json
test.cc
test.js
$ node_modules/.bin/node-gyp configure --verbose -- -f compile_commands_json
gyp info it worked if it ends with ok
gyp verb cli [
gyp verb cli   '/home/kostya/.nvm/versions/node/v14.15.4/bin/node',
gyp verb cli   '/home/kostya/tmp/napi-test/node_modules/.bin/node-gyp',
gyp verb cli   'configure',
gyp verb cli   '--verbose',
gyp verb cli   '--',
gyp verb cli   '-f',
gyp verb cli   'compile_commands_json'
gyp verb cli ]
gyp info using [email protected]
gyp info using [email protected] | linux | x64
gyp verb command configure [ '-f', 'compile_commands_json' ]
gyp verb find Python Python is not set from command line or npm configuration
gyp verb find Python Python is not set from environment variable PYTHON
gyp verb find Python checking if "python3" can be used
gyp verb find Python - executing "python3" to get executable path
gyp verb find Python - executable path is "/usr/bin/python3"
gyp verb find Python - executing "/usr/bin/python3" to get version
gyp verb find Python - version is "3.8.5"
gyp info find Python using Python version 3.8.5 found at "/usr/bin/python3"
gyp verb get node dir no --target version specified, falling back to host node version: 14.15.4
gyp verb command install [ '14.15.4' ]
gyp verb install input version string "14.15.4"
gyp verb install installing version: 14.15.4
gyp verb install --ensure was passed, so won't reinstall if already installed
gyp verb install version is already installed, need to check "installVersion"
gyp verb got "installVersion" 9
gyp verb needs "installVersion" 9
gyp verb install version is good
gyp verb get node dir target node version installed: 14.15.4
gyp verb build dir attempting to create "build" dir: /home/kostya/tmp/napi-test/build
gyp verb build dir "build" dir needed to be created? /home/kostya/tmp/napi-test/build
gyp verb build/config.gypi creating config file
gyp verb build/config.gypi writing out config file: /home/kostya/tmp/napi-test/build/config.gypi
gyp verb config.gypi checking for gypi file: /home/kostya/tmp/napi-test/config.gypi
gyp verb common.gypi checking for gypi file: /home/kostya/tmp/napi-test/common.gypi
gyp info spawn /usr/bin/python3
gyp info spawn args [
gyp info spawn args   '/home/kostya/tmp/napi-test/node_modules/node-gyp/gyp/gyp_main.py',
gyp info spawn args   'binding.gyp',
gyp info spawn args   '-f',
gyp info spawn args   'compile_commands_json',
gyp info spawn args   '-I',
gyp info spawn args   '/home/kostya/tmp/napi-test/build/config.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/home/kostya/tmp/napi-test/node_modules/node-gyp/addon.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/home/kostya/.cache/node-gyp/14.15.4/include/node/common.gypi',
gyp info spawn args   '-Dlibrary=shared_library',
gyp info spawn args   '-Dvisibility=default',
gyp info spawn args   '-Dnode_root_dir=/home/kostya/.cache/node-gyp/14.15.4',
gyp info spawn args   '-Dnode_gyp_dir=/home/kostya/tmp/napi-test/node_modules/node-gyp',
gyp info spawn args   '-Dnode_lib_file=/home/kostya/.cache/node-gyp/14.15.4/<(target_arch)/node.lib',
gyp info spawn args   '-Dmodule_root_dir=/home/kostya/tmp/napi-test',
gyp info spawn args   '-Dnode_engine=v8',
gyp info spawn args   '--depth=.',
gyp info spawn args   '--no-parallel',
gyp info spawn args   '--generator-output',
gyp info spawn args   'build',
gyp info spawn args   '-Goutput_dir=.'
gyp info spawn args ]
gyp info ok
$ ls -1
binding.gyp
build
Debug
node_modules
package-lock.json
Release
test.cc
test.js
@alexweej
Copy link

Any thoughts? Also noticed this was a bit broken

meixg added a commit to meixg/gyp-next that referenced this issue Mar 9, 2023
meixg added a commit to meixg/gyp-next that referenced this issue Mar 9, 2023
@cclauss
Copy link
Contributor

cclauss commented Mar 30, 2023

When you want a pull request to be merged, please give it a positive review. Every checkmark ✔️ that project maintainers see there gives them confidence that the proposed changes have been looked at and have been deemed both useful and safe to merge into the codebase. Lots of 👍 and "what is the ETA?" comments are easier for maintainers to ignore than ✔️✔️✔️✔️✔️ from several different reviewers.

Anyone can review a pull request on GitHub. To do so here:

  1. Jump to fix: use generator_output as output_dir gyp-next#191
  2. Click the Files changed tab.
  3. Click the Review changes button.
  4. Click Approve (or one of the other options) and make comments only if they have not already been stated in the PR.
  5. Click Submit review so that your ✔️ can be added to the list.

cclauss added a commit to nodejs/gyp-next that referenced this issue May 30, 2023
* fix: use generator_output as output_dir

fix: nodejs/node-gyp#2305

* Update pylib/gyp/generator/compile_commands_json.py

Co-authored-by: Christian Clauss <[email protected]>

* Update compile_commands_json.py

---------

Co-authored-by: Christian Clauss <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants