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

构建本地debug node的环境,我用cmake编译 #2

Open
huenchao opened this issue Oct 30, 2019 · 1 comment
Open

构建本地debug node的环境,我用cmake编译 #2

huenchao opened this issue Oct 30, 2019 · 1 comment

Comments

@huenchao
Copy link
Owner

huenchao commented Oct 30, 2019

  1. 下载源码
$ git clone https://github.com/nodejs/node.git
  1. 配置
$ ./configure --debug

如果出现:

Node configure: Found Python 3.7.2...
INFO: Using floating patch "tools/icu/patches/64/source/common/putil.cpp" from "tools/icu"
INFO: Using floating patch "tools/icu/patches/64/source/i18n/dtptngen.cpp" from "tools/icu"
No receipt for 'com.apple.pkg.DeveloperToolsCLILeo' found at '/'.
No receipt for 'com.apple.pkg.DeveloperToolsCLI' found at '/'.
gyp: No Xcode or CLT version detected!
Error running GYP

首先,你的py版本不对,nodejs需要用py2,你需要把py3.x都删了,然后执行下面的

$ sudo rm -rf /Library/Developer/CommandLineTools
$  xcode-select --install

如果上面还不行,就去看一下这个issue

$ python2 configure.py --debug
INFO: Using floating patch "tools/icu/patches/64/source/common/putil.cpp" from "tools/icu"
INFO: Using floating patch "tools/icu/patches/64/source/i18n/dtptngen.cpp" from "tools/icu"
INFO: configure completed successfully
  1. 只编译debug的版本(如果第二步你出错的话,你记得加上在下面命令前PYTHON=python2)
$ make -C out BUILDTYPE=Debug -j 4
@huenchao huenchao changed the title build nodejs 构建本地debug node的环境,我用cmake编译 Nov 15, 2019
@huenchao
Copy link
Owner Author

我们再介绍一个新工具,利用它,我们可以自动生成cmakelist.txt. 它就是node-cmake-generator

  1. install Xcode
  2. clone your node fork
  3. cd node
  4. npm install -g node-cmake-generator
  5. run node-cmake-generator
  6. open the project in CLion
  7. make -C out BUILDTYPE=Debug -j 1
  8. 设置一下debug的配置。
  9. enjoy :)

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

No branches or pull requests

1 participant