ninja安装

  • vs2015以后的版本默认安装了ninja,打开vc command tool即可使用
  • 源码安装:

git clone git://github.com/ninja-build/ninja.git && cd ninja
“C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat” x64
python configure.py --bootstrap

ninja rules

在这里插入图片描述
其中includes、cflags编译的时候替换成各个模块的输入
在这里插入图片描述

ninja: build stopped: subcommand failed.

编译过程中出现错误,使用ninja > 1.txt导出编译日志到文件,subcommand fail是正常错误提示,查看前面日志中出现的错误,windows中可能由于"/“和”\"路径符号导致错误(ninja版本问题,建议使用github上的ninja源码编译)

  • C2220错误,编译cflags中添加了 /WX编译选项,默认的警告当作错误处理,删除每个模块的/WX即可

CreateProcess failed: The system cannot find the file specified.

检查BUILDCONFIG.gn同级的BUILD.gn配置里面查找到编译器cl或者gcc等是否正常,可以路径错误导致编译器不能使用

一般如果没看到编译提示,工具路径有问题

gn文件定义的变量没使用,需要删除

ERROR at //gn/BUILD.gn:1:14: Assignment had no effect.
target_cpu = “x86”
^----
You set the variable “target_cpu” here and it was unused before it went

Logo

腾讯云面向开发者汇聚海量精品云计算使用和开发经验,营造开放的云计算技术生态圈。

更多推荐