Re: SpiderMonkey38 as static lib on Windows
[email protected] Thu, 25 Aug 2016 02:41:45 -0700 (PDT)
| Newsgroups | gmane.comp.mozilla.devel.jseng |
|---|---|
| Message-ID | <[email protected]> |
On Thursday, August 25, 2016 at 9:41:57 AM UTC+2, Mihai Dobrescu wrote: > 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? Someone on IRC recommended to use the --disable-export-js flag as well additionally to --disable-shared-js, which two together makes STATIC_JS_API defined, but I cannot use the generated js_static.lib even after this. I dumpbed the symbols from js_static.lib, and it contains ?JS_ShutDown@@YAXXZ (void __cdecl JS_ShutDown(void)) but the link error says: helloworld.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) void __cdecl JS_ShutDown(void)" (__imp_?JS_ShutDown@@YAXXZ) referenced in function _main Note the __imp_ prefix in the error message. I really don't know what I'm missing..