Re: SpiderMonkey38 as static lib on Windows

Mihai Dobrescu <[email protected]> Thu, 25 Aug 2016 00:41:56 -0700 (PDT)
Newsgroups gmane.comp.mozilla.devel.jseng
Message-ID <[email protected]>
On Monday, August 22, 2016 at 11:42:14 PM UTC+3, [email protected] wrote:
> On Monday, August 22, 2016 at 7:19:18 PM UTC+2, Mihai Dobrescu wrote:
> > On Monday, August 22, 2016 at 7:09:53 PM UTC+3, [email protected] wrote:
> > > Hi Guys,
> > > 
> > > I'd like to use SpiderMonkey 38 on Windows as a static library.
> > > 
> > > I have built x86 for Windows using the package published in this thread:
> > > https://groups.google.com/forum/#!topic/mozilla.dev.tech.js-engine/1GC-7lkX-qk
> > > Package: http://people.mozilla.org/~sfink/data/mozjs-38.3.0sfink2.tar.bz2 
> > > 
> > > I can compile and link my own executables using mozjs-38.lib as:
> > > 
> > > cl.exe /EHs /I"d:\spidermonkey38\js\src\build_OPT.OBJ\dist\include" /c helloworld.cpp
> > > link.exe helloworld.obj "d:\spidermonkey38\js\src\build_OPT.OBJ\dist\lib\mozjs-38.lib"
> > > 
> > > However, the below page suggests to use the "--disable-shared-js" flag for the configure script to build SpiderMonkey as a static lib:
> > > https://developer.mozilla.org/en-US/docs/Mozilla/Projects/SpiderMonkey/Build_Documentation#Building_SpiderMonkey_as_a_static_library
> > > 
> > > If I add this flag, then no mozjs-38.lib gets generated during mozmake.
> > > Am I doing something wrong? Should I be using the "js_static.lib" to link my executable somehow?
> > > 
> > > I'd appreciate any guidance!
> > > 
> > > Thanks,
> > > tamas
> > 
> > Did you look in "build_OPT.OBJ\dist\sdk\lib"?
> 
> 
> Yes, I just did, it's not there either.
> 
> These files are there if I build without "--disable-shared-js"
> mozjs-38.lib
> nspr4.lib
> nspr4.pdb
> plc4.lib
> plc4.pdb
> plds4.lib
> plds4.pdb
> 
> .. but mozjs-38.lib is missing if I add the flag.

To me, it looks like js.exe is created always with the static lib or it adds all the SpiderMonkey's code.

IMHO, --disable-shared-js just skips the creation of the static lib. Anyway, I couldn't use the static lib itself, it gives me errors at linking. Did you manage to use it?