如何在 Windows 下构建 SpiderMonkey?

How to build SpiderMonkey under Windows?

我尝试在 Windows 下构建 SpiderMonkey。我遵循 https://wiki.mozilla.org/JavaScript:New_to_SpiderMonkey

下的文档

我已经安装了 https://developer.mozilla.org/en-US/docs/Mozilla/Developer_guide/Build_Instructions/Windows_Prerequisites

的先决条件

不同的是,我使用当前的 VS 15.9.11 而不是旧的 15.8。

如果我尝试在 Mozilla 构建 shell 中调用 configure,那么它找不到 c 编译器:

Winuser@Winuser /c/workspace-cpp/spidermonkey/js/src/build_DBG.OBJ
$ ../configure --enable-debug --disable-optimize
Reexecuting in the virtualenv
checking for vcs source checkout... hg
checking for a shell... C:/mozilla-build/msys/bin/sh.exe
checking for host system type... x86_64-pc-mingw32
checking for target system type... x86_64-pc-mingw32
checking for Python 3... C:/mozilla-build//python3/python3.exe (3.6.5)
checking for hg... c:/mozilla-build/python/Scripts/hg.exe
checking for Mercurial version... 4.5.3
checking for sparse checkout... no
checking whether cross compiling... no
checking for yasm... c:/mozilla-build/bin/yasm.exe
checking yasm version... 1.3.0
checking for the target C compiler... not found
DEBUG: _cc: Trying clang-cl
DEBUG: _cc: Trying gcc
DEBUG: _cc: Trying clang
ERROR: Cannot find the target C compiler

Mozilla build shell 在哪里搜索 C 编译器?问题的原因可能是什么? 3 个可能的 C 编译器中的哪一个来自 VS?

我(终于)开始建造了。我花了几天时间。

除了 mozillas spidermonkey 文档外,我还使用了这些说明。

https://github.com/TheQwertiest/foo_spider_monkey_panel/wiki/Building-SpiderMonkey

我将列出一些要记住的重要事项。

  • 启动x86 Native Tools Command Prompt for VS2017
  • 在VS2017 cmd提示符下set MOZ_NO_RESET_PATH=1
  • 在 VS2017 cmd 提示符下启动 minGW mozilla-build/start-shell.bat
  • 下载旧版 Autconf 并编译它 http://www.linuxfromscratch.org/blfs/view/cvs/general/autoconf213.html
  • 克隆 esr60 分支代码。我尝试了最新的代码,我尝试了最新发布的代码,但是在编译之前它必须到这个分支。

所以不要强调那些要点,这些链接说明可能有效。

上述答案中的说明已移至新位置https://theqwertiest.github.io/foo_spider_monkey_panel/docs/for_developers/building_spidermonkey

PS:esr68 分支(以及 master 分支)的构建过程略有不同,需要额外的补丁才能与 MSVC 兼容。一旦我开始使用相应的分支,链接的说明将被更新。

PPS:由于缺少代表,我不得不 post 回答而不是发表评论。

PPPS:没想到有人会真正使用本指南 =)