Having trouble compiling Spidermonkey for 32 bit Windows, MSVC

I am trying to embed Spidermonkey into a Win32 application, using the instructions here.

I was eventually able to get it to compile, and js.exe appeared to work fine. However, now I need to compile it as a 32 bit DLL.

I changed my mozconfig file to specify x86_64-pc-windows-msvc as the target and the host, but when I run ./mach build, I just get this error info:

$ ./mach build
Adding configure options from C:\mozilla-source\mozilla-unified\mozconfig
  --enable-application=js
  --prefix=c:/mozilla-source/mozilla-unified
  --disable-jemalloc
  --disable-debug-symbols
  --enable-optimize
  --enable-strip
  --enable-install-strip
  --target=x86_64-pc-windows-msvc
  --host=x86_64-pc-windows-msvc
checking for host system type...
Executing: `sh C:/mozilla-source/mozilla-unified/build/moz.configure/../autoconf/config.sub x86_64-pc-windows-msvc`
The command returned non-zero exit status 1.
Its error output was:
| Invalid configuration `x86_64-pc-windows-msvc': OS `msvc' not recognized
Command `sh C:/mozilla-source/mozilla-unified/build/moz.configure/../autoconf/config.sub x86_64-pc-windows-msvc` failed with exit status 1.

I apologize for being such a noob and not really understanding this build process. It’s quite a leap from what I’m used to, when staying only within Visual Studio for development!

I found this page regarding Tiers and perhaps the issue is that I’ve probably got the latest mozilla source and need to figure out how to downgrade to something pre-Firefox 63?

MSVC is required for me since my application that will embed Spidermonkey is compiled with MSVC. Any suggestions would be greatly appreciated here!

Using Ted Campbell’s suggestion here, I figure I can avoid having to figure out how to get a specific ESR in Mercurial by downloading from ftp.mozilla.org directly. So my current plan is to overwrite my current 112 build with the contents of the 60.9.0 ESR package and see what happens next.

I don’t think recent versions will compile with MSVC anymore, though honestly I’m not sure about the state of things. It seems more likely to work if you compile the mozjs dll with clang, then compile your application with msvc. We make some attempt to keep the headers compiling under msvc, and clang should provide the correct ABI.

Thank you, Steve! I’m sorry for the late reply, I was away on vacation, but now I’m back and am going to start working on this again. Hopefully, I’ll figure out how to work outside of the Visual Studio world. I admittedly have spent my entire career only knowing how to use VS… :slight_smile: