Search code examples
windowsvisual-studiobuildspidermonkey

How to build SpiderMonkey under Windows?


I try to build SpiderMonkey under Windows. I follow the documentation under https://wiki.mozilla.org/JavaScript:New_to_SpiderMonkey

I have installed the prerequirement from https://developer.mozilla.org/en-US/docs/Mozilla/Developer_guide/Build_Instructions/Windows_Prerequisites

Differently I use the current VS 15.9.11 instead the old 15.8.

If I try to call configure inside the Mozilla build shell then it can't find the c compiler:

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

Where is the Mozilla build shell searching for the C compiler? What can be the cause of the problem? Which of the 3 possible C compiler is coming from VS?


Solution

  • I (finaly) got it to build. It took me days.

    I used these instructions in addition to mozillas spidermonkey documentation.

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

    I will list a few important things to remember.

    • Launch x86 Native Tools Command Prompt for VS2017
    • in VS2017 cmd prompt set MOZ_NO_RESET_PATH=1
    • in VS2017 cmd prompt launch minGW mozilla-build/start-shell.bat
    • Download legacy Autconf and compile it http://www.linuxfromscratch.org/blfs/view/cvs/general/autoconf213.html
    • clone esr60 branch code. I tried latest code , I tried latest released code, but it had to this branch until it compiled.

    So emphasis no those points and these linked instructions may work.