SpiderMonkey38 as static lib on Windows

classic Classic list List threaded Threaded
21 messages Options
12
Reply | Threaded
Open this post in threaded view
|

SpiderMonkey38 as static lib on Windows

tamasszarka
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
_______________________________________________
dev-tech-js-engine mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-js-engine
Reply | Threaded
Open this post in threaded view
|

Re: SpiderMonkey38 as static lib on Windows

Mihai Dobrescu
On Monday, August 22, 2016 at 7:09:53 PM UTC+3, [hidden email] 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"?
_______________________________________________
dev-tech-js-engine mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-js-engine
Reply | Threaded
Open this post in threaded view
|

Re: SpiderMonkey38 as static lib on Windows

tamasszarka
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, [hidden email] 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.
_______________________________________________
dev-tech-js-engine mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-js-engine
Reply | Threaded
Open this post in threaded view
|

Re: SpiderMonkey38 as static lib on Windows

Mihai Dobrescu
On Monday, August 22, 2016 at 11:42:14 PM UTC+3, [hidden email] 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, [hidden email] 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?
_______________________________________________
dev-tech-js-engine mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-js-engine
Reply | Threaded
Open this post in threaded view
|

Re: SpiderMonkey38 as static lib on Windows

tamasszarka
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, [hidden email] 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, [hidden email] 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..
_______________________________________________
dev-tech-js-engine mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-js-engine
Reply | Threaded
Open this post in threaded view
|

Re: SpiderMonkey38 as static lib on Windows

Mihai Dobrescu
On Thursday, August 25, 2016 at 12:41:46 PM UTC+3, [hidden email] wrote:

> 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, [hidden email] 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, [hidden email] 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..

Probably there is some flag to be added to your project in order to use the static lib mangling.
_______________________________________________
dev-tech-js-engine mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-js-engine
Reply | Threaded
Open this post in threaded view
|

Re: SpiderMonkey38 as static lib on Windows

Mihai Dobrescu
On Thursday, August 25, 2016 at 1:08:59 PM UTC+3, Mihai Dobrescu wrote:

> On Thursday, August 25, 2016 at 12:41:46 PM UTC+3, [hidden email] wrote:
> > 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, [hidden email] 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, [hidden email] 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..
>
> Probably there is some flag to be added to your project in order to use the static lib mangling.

What if you define STATIC_JS_API in your project too?
_______________________________________________
dev-tech-js-engine mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-js-engine
Reply | Threaded
Open this post in threaded view
|

Re: SpiderMonkey38 as static lib on Windows

tamasszarka
On Thursday, August 25, 2016 at 12:14:50 PM UTC+2, Mihai Dobrescu wrote:

> On Thursday, August 25, 2016 at 1:08:59 PM UTC+3, Mihai Dobrescu wrote:
> > On Thursday, August 25, 2016 at 12:41:46 PM UTC+3, [hidden email] wrote:
> > > 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, [hidden email] 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, [hidden email] 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..
> >
> > Probably there is some flag to be added to your project in order to use the static lib mangling.
>
> What if you define STATIC_JS_API in your project too?

I'm just trying to compile the helloworld example from here:
https://developer.mozilla.org/en-US/docs/Mozilla/Projects/SpiderMonkey/How_to_embed_the_JavaScript_engine#Hello_World_sample_embedding_application

If I put [#define STATIC_JS_API] before the [#include "jsapi.h"] line, I get more unresolved symbol errors, for all the .obj files in js_static.lib as well.
If I put it after [#include "jsapi.h"], it's the same. No success.
_______________________________________________
dev-tech-js-engine mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-js-engine
Reply | Threaded
Open this post in threaded view
|

Re: SpiderMonkey38 as static lib on Windows

Mihai Dobrescu
On Thursday, August 25, 2016 at 2:46:03 PM UTC+3, [hidden email] wrote:

> On Thursday, August 25, 2016 at 12:14:50 PM UTC+2, Mihai Dobrescu wrote:
> > On Thursday, August 25, 2016 at 1:08:59 PM UTC+3, Mihai Dobrescu wrote:
> > > On Thursday, August 25, 2016 at 12:41:46 PM UTC+3, [hidden email] wrote:
> > > > 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, [hidden email] 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, [hidden email] 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..
> > >
> > > Probably there is some flag to be added to your project in order to use the static lib mangling.
> >
> > What if you define STATIC_JS_API in your project too?
>
> I'm just trying to compile the helloworld example from here:
> https://developer.mozilla.org/en-US/docs/Mozilla/Projects/SpiderMonkey/How_to_embed_the_JavaScript_engine#Hello_World_sample_embedding_application
>
> If I put [#define STATIC_JS_API] before the [#include "jsapi.h"] line, I get more unresolved symbol errors, for all the .obj files in js_static.lib as well.
> If I put it after [#include "jsapi.h"], it's the same. No success.

In js\src\configure there is:


# Check whether --enable-shared-js or --disable-shared-js was given.
if test "${enable_shared_js+set}" = set; then
  enableval="$enable_shared_js"
  if test "$enableval" = "yes"; then
    DISABLE_SHARED_JS=0
  elif test "$enableval" = "no"; then
    DISABLE_SHARED_JS=1
  else
    { echo "configure: error: Option, shared-js, does not take an argument ($enableval)." 1>&2; echo "configure: error: Option, shared-js, does not take an argument ($enableval)." 1>&5; exit 1; }
  fi
fi


# Check whether --enable-export-js or --disable-export-js was given.
if test "${enable_export_js+set}" = set; then
  enableval="$enable_export_js"
  if test "$enableval" = "no"; then
    DISABLE_EXPORT_JS=1
  elif test "$enableval" = "yes"; then
    DISABLE_EXPORT_JS=
  else
    { echo "configure: error: Option, export-js, does not take an argument ($enableval)." 1>&2; echo "configure: error: Option, export-js, does not take an argument ($enableval)." 1>&5; exit 1; }
  fi
fi


if test "$DISABLE_SHARED_JS" = "1" ; then
  if test "$DISABLE_EXPORT_JS" = "1"; then
    cat >> confdefs.pytmp <<\EOF
    (''' STATIC_JS_API ''', ' 1 ')
EOF
cat >> confdefs.h <<\EOF
#define STATIC_JS_API 1
EOF

  else
    cat >> confdefs.pytmp <<\EOF
    (''' STATIC_EXPORTABLE_JS_API ''', ' 1 ')
EOF
cat >> confdefs.h <<\EOF
#define STATIC_EXPORTABLE_JS_API 1
EOF

  fi
else
  if test "$DISABLE_EXPORT_JS" = "1"; then
    { echo "configure: error: Must export JS symbols when building a shared library." 1>&2; echo "configure: error: Must export JS symbols when building a shared library." 1>&5; exit 1; }
  fi
  JS_SHARED_LIBRARY=1
fi

So, depending on your build, you watch for definition of one of STATIC_JS_API or STATIC_EXPORTABLE_JS_API in confdefs.h in your build directory tree (under \\js\src\build_OPT.OBJ\js\src, for example).

Then, if is defined, do the same in your project, at project level, along with other symbols definitions for debug or release (where you have _DEBUG/NDEBUG etc., in the C++ preprocessor definitions section). In my case works this way.
_______________________________________________
dev-tech-js-engine mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-js-engine
Reply | Threaded
Open this post in threaded view
|

Re: SpiderMonkey38 as static lib on Windows

tamasszarka
On Thursday, August 25, 2016 at 2:03:12 PM UTC+2, Mihai Dobrescu wrote:

> On Thursday, August 25, 2016 at 2:46:03 PM UTC+3, [hidden email] wrote:
> > On Thursday, August 25, 2016 at 12:14:50 PM UTC+2, Mihai Dobrescu wrote:
> > > On Thursday, August 25, 2016 at 1:08:59 PM UTC+3, Mihai Dobrescu wrote:
> > > > On Thursday, August 25, 2016 at 12:41:46 PM UTC+3, [hidden email] wrote:
> > > > > 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, [hidden email] 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, [hidden email] 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..
> > > >
> > > > Probably there is some flag to be added to your project in order to use the static lib mangling.
> > >
> > > What if you define STATIC_JS_API in your project too?
> >
> > I'm just trying to compile the helloworld example from here:
> > https://developer.mozilla.org/en-US/docs/Mozilla/Projects/SpiderMonkey/How_to_embed_the_JavaScript_engine#Hello_World_sample_embedding_application
> >
> > If I put [#define STATIC_JS_API] before the [#include "jsapi.h"] line, I get more unresolved symbol errors, for all the .obj files in js_static.lib as well.
> > If I put it after [#include "jsapi.h"], it's the same. No success.
>
> In js\src\configure there is:
>
>
> # Check whether --enable-shared-js or --disable-shared-js was given.
> if test "${enable_shared_js+set}" = set; then
>   enableval="$enable_shared_js"
>   if test "$enableval" = "yes"; then
>     DISABLE_SHARED_JS=0
>   elif test "$enableval" = "no"; then
>     DISABLE_SHARED_JS=1
>   else
>     { echo "configure: error: Option, shared-js, does not take an argument ($enableval)." 1>&2; echo "configure: error: Option, shared-js, does not take an argument ($enableval)." 1>&5; exit 1; }
>   fi
> fi
>
>
> # Check whether --enable-export-js or --disable-export-js was given.
> if test "${enable_export_js+set}" = set; then
>   enableval="$enable_export_js"
>   if test "$enableval" = "no"; then
>     DISABLE_EXPORT_JS=1
>   elif test "$enableval" = "yes"; then
>     DISABLE_EXPORT_JS=
>   else
>     { echo "configure: error: Option, export-js, does not take an argument ($enableval)." 1>&2; echo "configure: error: Option, export-js, does not take an argument ($enableval)." 1>&5; exit 1; }
>   fi
> fi
>
>
> if test "$DISABLE_SHARED_JS" = "1" ; then
>   if test "$DISABLE_EXPORT_JS" = "1"; then
>     cat >> confdefs.pytmp <<\EOF
>     (''' STATIC_JS_API ''', ' 1 ')
> EOF
> cat >> confdefs.h <<\EOF
> #define STATIC_JS_API 1
> EOF
>
>   else
>     cat >> confdefs.pytmp <<\EOF
>     (''' STATIC_EXPORTABLE_JS_API ''', ' 1 ')
> EOF
> cat >> confdefs.h <<\EOF
> #define STATIC_EXPORTABLE_JS_API 1
> EOF
>
>   fi
> else
>   if test "$DISABLE_EXPORT_JS" = "1"; then
>     { echo "configure: error: Must export JS symbols when building a shared library." 1>&2; echo "configure: error: Must export JS symbols when building a shared library." 1>&5; exit 1; }
>   fi
>   JS_SHARED_LIBRARY=1
> fi
>
> So, depending on your build, you watch for definition of one of STATIC_JS_API or STATIC_EXPORTABLE_JS_API in confdefs.h in your build directory tree (under \\js\src\build_OPT.OBJ\js\src, for example).
>
> Then, if is defined, do the same in your project, at project level, along with other symbols definitions for debug or release (where you have _DEBUG/NDEBUG etc., in the C++ preprocessor definitions section). In my case works this way.

I am not using Visual Studio at the moment. I'm trying with:
cl -c -I"d:\spidermonkey38\js\src\BUILD_OPT.OBJ\dist\include" helloworld.cpp
and then
link helloworld.obj "d:\spidermonkey38\js\src\BUILD_OPT.OBJ\dist\include"

The shared version worked when configured WITHOUT --disable-shared-js and used mozjs-38.lib for linking, and the helloworld app worked using mozjs-38.dll

I tried from Visual Studio, setting the project level #define and referencing js_static.lib for linking, but I get the exact same errors.
_______________________________________________
dev-tech-js-engine mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-js-engine
Reply | Threaded
Open this post in threaded view
|

Re: SpiderMonkey38 as static lib on Windows

Mihai Dobrescu
On Thursday, August 25, 2016 at 4:05:04 PM UTC+3, [hidden email] wrote:

> On Thursday, August 25, 2016 at 2:03:12 PM UTC+2, Mihai Dobrescu wrote:
> > On Thursday, August 25, 2016 at 2:46:03 PM UTC+3, [hidden email] wrote:
> > > On Thursday, August 25, 2016 at 12:14:50 PM UTC+2, Mihai Dobrescu wrote:
> > > > On Thursday, August 25, 2016 at 1:08:59 PM UTC+3, Mihai Dobrescu wrote:
> > > > > On Thursday, August 25, 2016 at 12:41:46 PM UTC+3, [hidden email] wrote:
> > > > > > 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, [hidden email] 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, [hidden email] 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..
> > > > >
> > > > > Probably there is some flag to be added to your project in order to use the static lib mangling.
> > > >
> > > > What if you define STATIC_JS_API in your project too?
> > >
> > > I'm just trying to compile the helloworld example from here:
> > > https://developer.mozilla.org/en-US/docs/Mozilla/Projects/SpiderMonkey/How_to_embed_the_JavaScript_engine#Hello_World_sample_embedding_application
> > >
> > > If I put [#define STATIC_JS_API] before the [#include "jsapi.h"] line, I get more unresolved symbol errors, for all the .obj files in js_static.lib as well.
> > > If I put it after [#include "jsapi.h"], it's the same. No success.
> >
> > In js\src\configure there is:
> >
> >
> > # Check whether --enable-shared-js or --disable-shared-js was given.
> > if test "${enable_shared_js+set}" = set; then
> >   enableval="$enable_shared_js"
> >   if test "$enableval" = "yes"; then
> >     DISABLE_SHARED_JS=0
> >   elif test "$enableval" = "no"; then
> >     DISABLE_SHARED_JS=1
> >   else
> >     { echo "configure: error: Option, shared-js, does not take an argument ($enableval)." 1>&2; echo "configure: error: Option, shared-js, does not take an argument ($enableval)." 1>&5; exit 1; }
> >   fi
> > fi
> >
> >
> > # Check whether --enable-export-js or --disable-export-js was given.
> > if test "${enable_export_js+set}" = set; then
> >   enableval="$enable_export_js"
> >   if test "$enableval" = "no"; then
> >     DISABLE_EXPORT_JS=1
> >   elif test "$enableval" = "yes"; then
> >     DISABLE_EXPORT_JS=
> >   else
> >     { echo "configure: error: Option, export-js, does not take an argument ($enableval)." 1>&2; echo "configure: error: Option, export-js, does not take an argument ($enableval)." 1>&5; exit 1; }
> >   fi
> > fi
> >
> >
> > if test "$DISABLE_SHARED_JS" = "1" ; then
> >   if test "$DISABLE_EXPORT_JS" = "1"; then
> >     cat >> confdefs.pytmp <<\EOF
> >     (''' STATIC_JS_API ''', ' 1 ')
> > EOF
> > cat >> confdefs.h <<\EOF
> > #define STATIC_JS_API 1
> > EOF
> >
> >   else
> >     cat >> confdefs.pytmp <<\EOF
> >     (''' STATIC_EXPORTABLE_JS_API ''', ' 1 ')
> > EOF
> > cat >> confdefs.h <<\EOF
> > #define STATIC_EXPORTABLE_JS_API 1
> > EOF
> >
> >   fi
> > else
> >   if test "$DISABLE_EXPORT_JS" = "1"; then
> >     { echo "configure: error: Must export JS symbols when building a shared library." 1>&2; echo "configure: error: Must export JS symbols when building a shared library." 1>&5; exit 1; }
> >   fi
> >   JS_SHARED_LIBRARY=1
> > fi
> >
> > So, depending on your build, you watch for definition of one of STATIC_JS_API or STATIC_EXPORTABLE_JS_API in confdefs.h in your build directory tree (under \\js\src\build_OPT.OBJ\js\src, for example).
> >
> > Then, if is defined, do the same in your project, at project level, along with other symbols definitions for debug or release (where you have _DEBUG/NDEBUG etc., in the C++ preprocessor definitions section). In my case works this way.
>
> I am not using Visual Studio at the moment. I'm trying with:
> cl -c -I"d:\spidermonkey38\js\src\BUILD_OPT.OBJ\dist\include" helloworld.cpp
> and then
> link helloworld.obj "d:\spidermonkey38\js\src\BUILD_OPT.OBJ\dist\include"
>
> The shared version worked when configured WITHOUT --disable-shared-js and used mozjs-38.lib for linking, and the helloworld app worked using mozjs-38.dll
>
> I tried from Visual Studio, setting the project level #define and referencing js_static.lib for linking, but I get the exact same errors.

Did you try to add them to cl using this https://msdn.microsoft.com/en-us/library/hhzbb5c8.aspx ?
_______________________________________________
dev-tech-js-engine mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-js-engine
Reply | Threaded
Open this post in threaded view
|

Re: SpiderMonkey38 as static lib on Windows

tamasszarka
On Thursday, August 25, 2016 at 4:11:11 PM UTC+2, Mihai Dobrescu wrote:

> On Thursday, August 25, 2016 at 4:05:04 PM UTC+3, [hidden email] wrote:
> > On Thursday, August 25, 2016 at 2:03:12 PM UTC+2, Mihai Dobrescu wrote:
> > > On Thursday, August 25, 2016 at 2:46:03 PM UTC+3, [hidden email] wrote:
> > > > On Thursday, August 25, 2016 at 12:14:50 PM UTC+2, Mihai Dobrescu wrote:
> > > > > On Thursday, August 25, 2016 at 1:08:59 PM UTC+3, Mihai Dobrescu wrote:
> > > > > > On Thursday, August 25, 2016 at 12:41:46 PM UTC+3, [hidden email] wrote:
> > > > > > > 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, [hidden email] 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, [hidden email] 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..
> > > > > >
> > > > > > Probably there is some flag to be added to your project in order to use the static lib mangling.
> > > > >
> > > > > What if you define STATIC_JS_API in your project too?
> > > >
> > > > I'm just trying to compile the helloworld example from here:
> > > > https://developer.mozilla.org/en-US/docs/Mozilla/Projects/SpiderMonkey/How_to_embed_the_JavaScript_engine#Hello_World_sample_embedding_application
> > > >
> > > > If I put [#define STATIC_JS_API] before the [#include "jsapi.h"] line, I get more unresolved symbol errors, for all the .obj files in js_static.lib as well.
> > > > If I put it after [#include "jsapi.h"], it's the same. No success.
> > >
> > > In js\src\configure there is:
> > >
> > >
> > > # Check whether --enable-shared-js or --disable-shared-js was given.
> > > if test "${enable_shared_js+set}" = set; then
> > >   enableval="$enable_shared_js"
> > >   if test "$enableval" = "yes"; then
> > >     DISABLE_SHARED_JS=0
> > >   elif test "$enableval" = "no"; then
> > >     DISABLE_SHARED_JS=1
> > >   else
> > >     { echo "configure: error: Option, shared-js, does not take an argument ($enableval)." 1>&2; echo "configure: error: Option, shared-js, does not take an argument ($enableval)." 1>&5; exit 1; }
> > >   fi
> > > fi
> > >
> > >
> > > # Check whether --enable-export-js or --disable-export-js was given.
> > > if test "${enable_export_js+set}" = set; then
> > >   enableval="$enable_export_js"
> > >   if test "$enableval" = "no"; then
> > >     DISABLE_EXPORT_JS=1
> > >   elif test "$enableval" = "yes"; then
> > >     DISABLE_EXPORT_JS=
> > >   else
> > >     { echo "configure: error: Option, export-js, does not take an argument ($enableval)." 1>&2; echo "configure: error: Option, export-js, does not take an argument ($enableval)." 1>&5; exit 1; }
> > >   fi
> > > fi
> > >
> > >
> > > if test "$DISABLE_SHARED_JS" = "1" ; then
> > >   if test "$DISABLE_EXPORT_JS" = "1"; then
> > >     cat >> confdefs.pytmp <<\EOF
> > >     (''' STATIC_JS_API ''', ' 1 ')
> > > EOF
> > > cat >> confdefs.h <<\EOF
> > > #define STATIC_JS_API 1
> > > EOF
> > >
> > >   else
> > >     cat >> confdefs.pytmp <<\EOF
> > >     (''' STATIC_EXPORTABLE_JS_API ''', ' 1 ')
> > > EOF
> > > cat >> confdefs.h <<\EOF
> > > #define STATIC_EXPORTABLE_JS_API 1
> > > EOF
> > >
> > >   fi
> > > else
> > >   if test "$DISABLE_EXPORT_JS" = "1"; then
> > >     { echo "configure: error: Must export JS symbols when building a shared library." 1>&2; echo "configure: error: Must export JS symbols when building a shared library." 1>&5; exit 1; }
> > >   fi
> > >   JS_SHARED_LIBRARY=1
> > > fi
> > >
> > > So, depending on your build, you watch for definition of one of STATIC_JS_API or STATIC_EXPORTABLE_JS_API in confdefs.h in your build directory tree (under \\js\src\build_OPT.OBJ\js\src, for example).
> > >
> > > Then, if is defined, do the same in your project, at project level, along with other symbols definitions for debug or release (where you have _DEBUG/NDEBUG etc., in the C++ preprocessor definitions section). In my case works this way.
> >
> > I am not using Visual Studio at the moment. I'm trying with:
> > cl -c -I"d:\spidermonkey38\js\src\BUILD_OPT.OBJ\dist\include" helloworld.cpp
> > and then
> > link helloworld.obj "d:\spidermonkey38\js\src\BUILD_OPT.OBJ\dist\include"
> >
> > The shared version worked when configured WITHOUT --disable-shared-js and used mozjs-38.lib for linking, and the helloworld app worked using mozjs-38.dll
> >
> > I tried from Visual Studio, setting the project level #define and referencing js_static.lib for linking, but I get the exact same errors.
>
> Did you try to add them to cl using this https://msdn.microsoft.com/en-us/library/hhzbb5c8.aspx ?

I managed to statically link against js_static.lib.
You were right, I was missing -DSTATIC_JS_API, thanks!
Additionally I needed the -MD compiler flag. This is what I ended up with:

cl -EHs -MD -I"D:\spidermonkey38\js\src\BUILD_OPT.OBJ\dist\include" -DSTATIC_JS_API helloworld.cpp -link -LIBPATH:"D:\spidermonkey38\js\src\BUILD_OPT.OBJ\dist\lib" js_static.lib nspr4.lib plc4.lib plds4.lib kernel32.lib user32.lib gdi32.lib winmm.lib wsock32.lib advapi32.lib psapi.lib

Do you know if there is any way to get rid of the .dll dependencies for NSPR as well (nspr4.dll, plds4.dll plc4.dll)? I see a static version of these libs (nspr4_s.lib, plds4_s.lib, plc4_s.lib), but I cannot link js_static against those.
_______________________________________________
dev-tech-js-engine mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-js-engine
Reply | Threaded
Open this post in threaded view
|

Re: SpiderMonkey38 as static lib on Windows

Mihai Dobrescu
On Friday, August 26, 2016 at 12:41:21 PM UTC+3, [hidden email] wrote:

> On Thursday, August 25, 2016 at 4:11:11 PM UTC+2, Mihai Dobrescu wrote:
> > On Thursday, August 25, 2016 at 4:05:04 PM UTC+3, [hidden email] wrote:
> > > On Thursday, August 25, 2016 at 2:03:12 PM UTC+2, Mihai Dobrescu wrote:
> > > > On Thursday, August 25, 2016 at 2:46:03 PM UTC+3, [hidden email] wrote:
> > > > > On Thursday, August 25, 2016 at 12:14:50 PM UTC+2, Mihai Dobrescu wrote:
> > > > > > On Thursday, August 25, 2016 at 1:08:59 PM UTC+3, Mihai Dobrescu wrote:
> > > > > > > On Thursday, August 25, 2016 at 12:41:46 PM UTC+3, [hidden email] wrote:
> > > > > > > > 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, [hidden email] 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, [hidden email] 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..
> > > > > > >
> > > > > > > Probably there is some flag to be added to your project in order to use the static lib mangling.
> > > > > >
> > > > > > What if you define STATIC_JS_API in your project too?
> > > > >
> > > > > I'm just trying to compile the helloworld example from here:
> > > > > https://developer.mozilla.org/en-US/docs/Mozilla/Projects/SpiderMonkey/How_to_embed_the_JavaScript_engine#Hello_World_sample_embedding_application
> > > > >
> > > > > If I put [#define STATIC_JS_API] before the [#include "jsapi.h"] line, I get more unresolved symbol errors, for all the .obj files in js_static.lib as well.
> > > > > If I put it after [#include "jsapi.h"], it's the same. No success.
> > > >
> > > > In js\src\configure there is:
> > > >
> > > >
> > > > # Check whether --enable-shared-js or --disable-shared-js was given.
> > > > if test "${enable_shared_js+set}" = set; then
> > > >   enableval="$enable_shared_js"
> > > >   if test "$enableval" = "yes"; then
> > > >     DISABLE_SHARED_JS=0
> > > >   elif test "$enableval" = "no"; then
> > > >     DISABLE_SHARED_JS=1
> > > >   else
> > > >     { echo "configure: error: Option, shared-js, does not take an argument ($enableval)." 1>&2; echo "configure: error: Option, shared-js, does not take an argument ($enableval)." 1>&5; exit 1; }
> > > >   fi
> > > > fi
> > > >
> > > >
> > > > # Check whether --enable-export-js or --disable-export-js was given.
> > > > if test "${enable_export_js+set}" = set; then
> > > >   enableval="$enable_export_js"
> > > >   if test "$enableval" = "no"; then
> > > >     DISABLE_EXPORT_JS=1
> > > >   elif test "$enableval" = "yes"; then
> > > >     DISABLE_EXPORT_JS=
> > > >   else
> > > >     { echo "configure: error: Option, export-js, does not take an argument ($enableval)." 1>&2; echo "configure: error: Option, export-js, does not take an argument ($enableval)." 1>&5; exit 1; }
> > > >   fi
> > > > fi
> > > >
> > > >
> > > > if test "$DISABLE_SHARED_JS" = "1" ; then
> > > >   if test "$DISABLE_EXPORT_JS" = "1"; then
> > > >     cat >> confdefs.pytmp <<\EOF
> > > >     (''' STATIC_JS_API ''', ' 1 ')
> > > > EOF
> > > > cat >> confdefs.h <<\EOF
> > > > #define STATIC_JS_API 1
> > > > EOF
> > > >
> > > >   else
> > > >     cat >> confdefs.pytmp <<\EOF
> > > >     (''' STATIC_EXPORTABLE_JS_API ''', ' 1 ')
> > > > EOF
> > > > cat >> confdefs.h <<\EOF
> > > > #define STATIC_EXPORTABLE_JS_API 1
> > > > EOF
> > > >
> > > >   fi
> > > > else
> > > >   if test "$DISABLE_EXPORT_JS" = "1"; then
> > > >     { echo "configure: error: Must export JS symbols when building a shared library." 1>&2; echo "configure: error: Must export JS symbols when building a shared library." 1>&5; exit 1; }
> > > >   fi
> > > >   JS_SHARED_LIBRARY=1
> > > > fi
> > > >
> > > > So, depending on your build, you watch for definition of one of STATIC_JS_API or STATIC_EXPORTABLE_JS_API in confdefs.h in your build directory tree (under \\js\src\build_OPT.OBJ\js\src, for example).
> > > >
> > > > Then, if is defined, do the same in your project, at project level, along with other symbols definitions for debug or release (where you have _DEBUG/NDEBUG etc., in the C++ preprocessor definitions section). In my case works this way.
> > >
> > > I am not using Visual Studio at the moment. I'm trying with:
> > > cl -c -I"d:\spidermonkey38\js\src\BUILD_OPT.OBJ\dist\include" helloworld.cpp
> > > and then
> > > link helloworld.obj "d:\spidermonkey38\js\src\BUILD_OPT.OBJ\dist\include"
> > >
> > > The shared version worked when configured WITHOUT --disable-shared-js and used mozjs-38.lib for linking, and the helloworld app worked using mozjs-38.dll
> > >
> > > I tried from Visual Studio, setting the project level #define and referencing js_static.lib for linking, but I get the exact same errors.
> >
> > Did you try to add them to cl using this https://msdn.microsoft.com/en-us/library/hhzbb5c8.aspx ?
>
> I managed to statically link against js_static.lib.
> You were right, I was missing -DSTATIC_JS_API, thanks!
> Additionally I needed the -MD compiler flag. This is what I ended up with:
>
> cl -EHs -MD -I"D:\spidermonkey38\js\src\BUILD_OPT.OBJ\dist\include" -DSTATIC_JS_API helloworld.cpp -link -LIBPATH:"D:\spidermonkey38\js\src\BUILD_OPT.OBJ\dist\lib" js_static.lib nspr4.lib plc4.lib plds4.lib kernel32.lib user32.lib gdi32.lib winmm.lib wsock32.lib advapi32.lib psapi.lib
>
> Do you know if there is any way to get rid of the .dll dependencies for NSPR as well (nspr4.dll, plds4.dll plc4.dll)? I see a static version of these libs (nspr4_s.lib, plds4_s.lib, plc4_s.lib), but I cannot link js_static against those.

I am a user as you are, I had to make my way through it, but I still can't link against the static libs because somehow it misses the zlib in configuration. I also use v45, not v38. It was easy to move to v45 though... I have embedded it as shared lib/dll, until msvc linker got stuck in some templates and I couldn't make it go further. So I have skipped to mingw64. There I've found I should add these flags. I need to link statically, because mingw64 crashes the heap (I've found many reports related to this, but no solution yet, for me).

As answer to your question, see this: https://groups.google.com/forum/#!topic/mozilla.dev.tech.js-engine/x1c7rKmZf-Y
_______________________________________________
dev-tech-js-engine mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-js-engine
Reply | Threaded
Open this post in threaded view
|

Re: SpiderMonkey38 as static lib on Windows

Mihai Dobrescu
In reply to this post by tamasszarka
+ adding that def is not right, IMHO.
It should get it during compilation out of the included files after config.
Yet, it seems to need it for both, msvc and mingw.
_______________________________________________
dev-tech-js-engine mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-js-engine
Reply | Threaded
Open this post in threaded view
|

Re: SpiderMonkey38 as static lib on Windows

tamasszarka
On Friday, August 26, 2016 at 12:01:32 PM UTC+2, Mihai Dobrescu wrote:
> + adding that def is not right, IMHO.
> It should get it during compilation out of the included files after config.
> Yet, it seems to need it for both, msvc and mingw.

Anyway, thanks for your help!
I am embedding SM38 on Linux statically, and now I need to port it to Win. Are you saying that you managed to statically link to the NSPR libs using mingw64, so that you did not have to deploy the DLLs, or you could NOT do that neither with mingw64 nor msvc?
_______________________________________________
dev-tech-js-engine mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-js-engine
Reply | Threaded
Open this post in threaded view
|

Re: SpiderMonkey38 as static lib on Windows

Mihai Dobrescu
On Friday, August 26, 2016 at 1:36:32 PM UTC+3, [hidden email] wrote:
> On Friday, August 26, 2016 at 12:01:32 PM UTC+2, Mihai Dobrescu wrote:
> > + adding that def is not right, IMHO.
> > It should get it during compilation out of the included files after config.
> > Yet, it seems to need it for both, msvc and mingw.
>
> Anyway, thanks for your help!
> I am embedding SM38 on Linux statically, and now I need to port it to Win. Are you saying that you managed to statically link to the NSPR libs using mingw64, so that you did not have to deploy the DLLs, or you could NOT do that neither with mingw64 nor msvc?

I couln'd link to static libs, I did not intend. For the moment I prefer dlls under Windows. I did not use under linux at all as I embed js in Adobe products, although I'd be so happy to see them under linux! BTW, you could cross compile under linux. Should be simpler than under Windows itself...
_______________________________________________
dev-tech-js-engine mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-js-engine
Reply | Threaded
Open this post in threaded view
|

Re: SpiderMonkey38 as static lib on Windows

tamasszarka
Thanks for your help though! Will see if I can live with the NSPR DLLs..
_______________________________________________
dev-tech-js-engine mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-js-engine
Reply | Threaded
Open this post in threaded view
|

Re: SpiderMonkey38 as static lib on Windows

Mihai Dobrescu
On Friday, August 26, 2016 at 6:28:03 PM UTC+3, [hidden email] wrote:
> Thanks for your help though! Will see if I can live with the NSPR DLLs..

No problem. If I can, I help you further.
_______________________________________________
dev-tech-js-engine mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-js-engine
Reply | Threaded
Open this post in threaded view
|

Re: SpiderMonkey38 as static lib on Windows

Steve Fink-4
In reply to this post by Mihai Dobrescu
On 08/26/2016 04:17 AM, Mihai Dobrescu wrote:

> On Friday, August 26, 2016 at 1:36:32 PM UTC+3, [hidden email] wrote:
>> On Friday, August 26, 2016 at 12:01:32 PM UTC+2, Mihai Dobrescu wrote:
>>> + adding that def is not right, IMHO.
>>> It should get it during compilation out of the included files after config.
>>> Yet, it seems to need it for both, msvc and mingw.
>>
>> Anyway, thanks for your help!
>> I am embedding SM38 on Linux statically, and now I need to port it to Win. Are you saying that you managed to statically link to the NSPR libs using mingw64, so that you did not have to deploy the DLLs, or you could NOT do that neither with mingw64 nor msvc?
>
> I couln'd link to static libs, I did not intend. For the moment I prefer dlls under Windows. I did not use under linux at all as I embed js in Adobe products, although I'd be so happy to see them under linux! BTW, you could cross compile under linux. Should be simpler than under Windows itself...
>

Bug 1176787 https://bugzilla.mozilla.org/show_bug.cgi?id=1176787 is
related to this, though I'll freely admit that I don't understand most
of what is being discussed there.

I believe one issue is that if you're linking a static js lib that
includs a static nspr, then things will break if you link against
something else that uses nspr (because you'll be using two copies, and
they'll fight over TLS, or something?) If everything links against a
dynamic NSPR, you should be ok.

I think?

But I don't even really know what mingw64 is. Does that imply you're
using gcc? Or are you using mingw64+cl.exe? (Is that even a meaningful
question?)

I would love to have all of these compiling and linking issues resolved
for the JS lib, but realistically I'm not going to be spending much time
on it any day soon. If you have identified specific fixes needed in the
standalone source release tarball, file a bug and CC me (:sfink) and
I'll make sure they get in (assuming I can convince myself they don't
break other scenarios.)

Thanks!
Steve
_______________________________________________
dev-tech-js-engine mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-js-engine
Reply | Threaded
Open this post in threaded view
|

Re: SpiderMonkey38 as static lib on Windows

Mihai Dobrescu
In reply to this post by Mihai Dobrescu
On Friday, August 26, 2016 at 9:45:26 PM UTC+3, Steve Fink wrote:

> On 08/26/2016 04:17 AM, Mihai Dobrescu wrote:
> > On Friday, August 26, 2016 at 1:36:32 PM UTC+3, [hidden email] wrote:
> >> On Friday, August 26, 2016 at 12:01:32 PM UTC+2, Mihai Dobrescu wrote:
> >>> + adding that def is not right, IMHO.
> >>> It should get it during compilation out of the included files after config.
> >>> Yet, it seems to need it for both, msvc and mingw.
> >>
> >> Anyway, thanks for your help!
> >> I am embedding SM38 on Linux statically, and now I need to port it to Win. Are you saying that you managed to statically link to the NSPR libs using mingw64, so that you did not have to deploy the DLLs, or you could NOT do that neither with mingw64 nor msvc?
> >
> > I couln'd link to static libs, I did not intend. For the moment I prefer dlls under Windows. I did not use under linux at all as I embed js in Adobe products, although I'd be so happy to see them under linux! BTW, you could cross compile under linux. Should be simpler than under Windows itself...
> >
>
> Bug 1176787 https://bugzilla.mozilla.org/show_bug.cgi?id=1176787 is
> related to this, though I'll freely admit that I don't understand most
> of what is being discussed there.
>
> I believe one issue is that if you're linking a static js lib that
> includs a static nspr, then things will break if you link against
> something else that uses nspr (because you'll be using two copies, and
> they'll fight over TLS, or something?) If everything links against a
> dynamic NSPR, you should be ok.
>
> I think?
>
> But I don't even really know what mingw64 is. Does that imply you're
> using gcc? Or are you using mingw64+cl.exe? (Is that even a meaningful
> question?)
>
> I would love to have all of these compiling and linking issues resolved
> for the JS lib, but realistically I'm not going to be spending much time
> on it any day soon. If you have identified specific fixes needed in the
> standalone source release tarball, file a bug and CC me (:sfink) and
> I'll make sure they get in (assuming I can convince myself they don't
> break other scenarios.)
>
> Thanks!
> Steve

Hi,

Tamas uses msvc++, the officially supported compiler under Windows.
I use, under Windows, msvc++ and I try to migrate to mingw-w64. Which is not yet supported fully. I have a hard time making it link to produce a static library, becaue, for the moment, I have encountered a heap corruption when linking to a dll.
_______________________________________________
dev-tech-js-engine mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-js-engine
12