Java自学者论坛

 找回密码
 立即注册

手机号码,快捷登录

恭喜Java自学者论坛(https://www.javazxz.com)已经为数万Java学习者服务超过8年了!积累会员资料超过10000G+
成为本站VIP会员,下载本站10000G+会员资源,会员资料板块,购买链接:点击进入购买VIP会员

JAVA高级面试进阶训练营视频教程

Java架构师系统进阶VIP课程

分布式高可用全栈开发微服务教程Go语言视频零基础入门到精通Java架构师3期(课件+源码)
Java开发全终端实战租房项目视频教程SpringBoot2.X入门到高级使用教程大数据培训第六期全套视频教程深度学习(CNN RNN GAN)算法原理Java亿级流量电商系统视频教程
互联网架构师视频教程年薪50万Spark2.0从入门到精通年薪50万!人工智能学习路线教程年薪50万大数据入门到精通学习路线年薪50万机器学习入门到精通教程
仿小米商城类app和小程序视频教程深度学习数据分析基础到实战最新黑马javaEE2.1就业课程从 0到JVM实战高手教程MySQL入门到精通教程
查看: 538|回复: 0

window 下生成NodeJs(v8.9.3) 的 VS2015 解决方案node.sln

[复制链接]
  • TA的每日心情
    奋斗
    2024-4-6 11:05
  • 签到天数: 748 天

    [LV.9]以坛为家II

    2034

    主题

    2092

    帖子

    70万

    积分

    管理员

    Rank: 9Rank: 9Rank: 9

    积分
    705612
    发表于 2021-8-26 15:36:54 | 显示全部楼层 |阅读模式

     window 下生成NodeJs(v8.9.3) 的 VS2015 解决方案node.sln

    使用步骤 也可以参照 github:

    https://github.com/nodejs/node/blob/master/BUILDING.md#windows-1

    1. 从 github 同步 

    https://github.com/nodejs/node

    2.安装 python 2.7 或者 2.6

    https://www.python.org/downloads/

    当然, 如果有Python 环境, 就跳过好了

    3. 修改 common.gypi

    因为如果 不修改的话, 会报好多错误的....

    E:\Projects\C++\node-git\trunk\tools>gyp_node.py  -Dtarget_arch=x64 -f msvs
    gyp: name 'node_shared' is not defined while evaluating condition 'node_shared=="true"' in E:\Projects\C++\node-git\trunk\node.gyp
    
    E:\Projects\C++\node-git\trunk\tools>gyp_node.py  -Dtarget_arch=x64 -f msvs
    gyp: name 'node_shared' is not defined while evaluating condition 'node_shared=="true"' in E:\Projects\C++\node-git\trunk\node.gyp
    
    E:\Projects\C++\node-git\trunk\tools>gyp_node.py  -Dtarget_arch=x64 -f msvs
    gyp: name 'node_use_openssl' is not defined while evaluating condition 'OS=="win" and node_use_openssl=="true" and node_shared_openssl=="false"' in E:\Projects\C++\node-git\trunk\node.gyp
    
    E:\Projects\C++\node-git\trunk\tools>gyp_node.py  -Dtarget_arch=x64 -f msvs
    gyp: name 'node_shared_openssl' is not defined while evaluating condition 'OS=="win" and node_use_openssl=="true" and node_shared_openssl=="false"' in E:\Projects\C++\node-git\trunk\node.gyp
    
    E:\Projects\C++\node-git\trunk\tools>gyp_node.py  -Dtarget_arch=x64 -f msvs
    gyp: name 'openssl_fips' is not defined while evaluating condition 'openssl_fips != ""' in E:\Projects\C++\node-git\trunk\node.gyp
    
    E:\Projects\C++\node-git\trunk\tools>gyp_node.py  -Dtarget_arch=x64 -f msvs
    gyp: name 'v8_enable_inspector' is not defined while evaluating condition 'v8_enable_inspector==1' in E:\Projects\C++\node-git\trunk\node.gyp
    
    E:\Projects\C++\node-git\trunk\tools>gyp_node.py  -Dtarget_arch=x64 -f msvs
    gyp: name 'node_enable_d8' is not defined while evaluating condition 'node_enable_d8=="true"' in E:\Projects\C++\node-git\trunk\node.gyp
    
    E:\Projects\C++\node-git\trunk\tools>gyp_node.py  -Dtarget_arch=x64 -f msvs
    gyp: name 'node_release_urlbase' is not defined while evaluating condition 'node_release_urlbase!=""' in E:\Projects\C++\node-git\trunk\node.gyp
    
    E:\Projects\C++\node-git\trunk\tools>gyp_node.py  -Dtarget_arch=x64 -f msvs
    gyp: name 'debug_http2' is not defined while evaluating condition 'debug_http2==1' in E:\Projects\C++\node-git\trunk\node.gyp
    
    E:\Projects\C++\node-git\trunk\tools>gyp_node.py  -Dtarget_arch=x64 -f msvs
    gyp: name 'v8_enable_i18n_support' is not defined while evaluating condition 'v8_enable_i18n_support==1' in E:\Projects\C++\node-git\trunk\node.gyp

    好多变量都没有定义.....

    下面是修改的部分(红色粗体字,变量值是我自己的缺少设置,可以改), 文件在主目录下

    {
      'variables': {
        'asan%': 0,
        'werror': '',                     # Turn off -Werror in V8 build.
        'visibility%': 'hidden',          # V8's visibility setting
        'target_arch%': 'ia32',           # set v8's target architecture
        'host_arch%': 'ia32',             # set v8's host architecture
        'want_separate_host_toolset%': 0, # V8 should not build target and host
        'library%': 'static_library',     # allow override to 'shared_library' for DLL/.so builds
        'component%': 'static_library',   # NB. these names match with what V8 expects
        'msvs_multi_core_compile': '0',   # we do enable multicore compiles, but not using the V8 way
        'python%': 'python',
    
        'node_shared': 'false',
        'node_enable_d8': 'false',
        'v8_enable_inspector': 1,
        'v8_enable_i18n_support': 'true',
        'debug_http2': 1,
        'debug_nghttp2': 1,
        'node_use_openssl': 'false',
        'node_shared_openssl': 'true',
        'openssl_fips': '',
        'node_release_urlbase': '',
        
        'node_shared%': 'false',
        'force_dynamic_crt%': 0,
        'node_use_v8_platform%': 'true',
        'node_use_bundled_v8%': 'true',
        'node_module_version%': '',
    .....

    4.修改 deps\v8\src\v8.gyp

    貌似调用 deps\v8\src\v8.gyp 的时候, 有个参数没有传进去,target_arch的值我用的 是 'x64':

    E:\Projects\C++\node-git\trunk\tools>gyp_node.py  -Dtarget_arch=x64 -f msvs
    gyp: name 'debug_nghttp2' is not defined while evaluating condition 'debug_nghttp2 == 1' in E:\Projects\C++\node-git\trunk\deps\nghttp2\nghttp2.gyp
    gyp: Undefined variable target_arch in E:\Projects\C++\node-git\trunk\deps\v8\src\v8.gyp

    所以,手动加了这个变量

    {
      'variables': {
        'target_arch': 'x64',
    
        'v8_code': 1,
    .....

    5. 生成 解决方案 

    一般来说,使用 gyp 生成 VS 的解决方案的, 都是 使用类似的 命令行: 

    "gyp_XXXX.py  -Dtarget_arch=x64 -f msvs"    XXXX 就是工程/解决方案名,例如 V8的 就是 gyp_V8.gyp; Node的就是gyp_node.gyp
    tools>gyp_node.py  -Dtarget_arch=x64 -f msvs

     

    Over!

    6.如果 用 vcbuild.bat 生成, 就不会有这些错误

    以上是直接 运行 gyp_node.py  会产生 缺少 变量,  但是 如果 用 vcbuild.bat, 就不会.  >>git上有issue说明<< ^_^

    哎...今天够累的,签到来了1...
    回复

    使用道具 举报

    您需要登录后才可以回帖 登录 | 立即注册

    本版积分规则

    QQ|手机版|小黑屋|Java自学者论坛 ( 声明:本站文章及资料整理自互联网,用于Java自学者交流学习使用,对资料版权不负任何法律责任,若有侵权请及时联系客服屏蔽删除 )

    GMT+8, 2024-4-29 08:20 , Processed in 0.085126 second(s), 29 queries .

    Powered by Discuz! X3.4

    Copyright © 2001-2021, Tencent Cloud.

    快速回复 返回顶部 返回列表