I successfully compiled spidermonkey (on windows), how can I link against it now (to embed it)?
js-config is not properly installed, and I don't understand this workaround.
Linking to the static library should be easier, but I don't even know which file it is. I have mozglue.lib, mozjs-43a1.lib, nspr4.lib, plc4.lib, plds4.lib
in dist/sdk/lib
and nspr4.lib, plc4.lib, plds4.lib
in dist/lib
.
Update
js-config
was not working because I had this problem (-bash: '\r': command not found
because of Windows/Unix newline characters problem, I ran dos2unix js-config
and I could run it).
However, the output does not help (on windows):
$ ./js-config --cflags
-std=gnu++0x -include /usr/local/include/mozjs-43a1/js/RequiredDefines.h -I/usr/local/include/mozjs-43a1 -Ic:/Users/Yvain/Documents/mozilla-central/js/src/build_OPT.OBJ/dist/include/nspr
$ ./js-config --libs
${libdir}/${JS_LIBRARY_NAME}.lib c:/Users/Yvain/Documents/mozilla-central/js/src/build_OPT.OBJ/dist/lib/nspr4.lib c:/Users/Yvain/Documents/mozilla-central/js/src/build_OPT.OBJ/dist/lib/plc4.lib c:/Users/Yvain/Documents/mozilla-central/js/src/build_OPT.OBJ/dist/lib/plds4.lib kernel32.lib user32.lib gdi32.lib winmm.lib wsock32.lib advapi32.lib psapi.lib
Notes
I used the following command to compile:
g++ -std=c++11 -I<objdir>/dist/include -L<objdir>/dist/lib helloworld.cpp -o helloworld -lmozjs-31 -lz -lpthread -ldl
I know it is not the correct way to compile it since those libraries are not in <objdir>/dist/lib
. It returns the following errors:
[...]/jscpucfg.h:121:3: erreur:
#error "Cannot determine endianness of your platform. Please add support to jscpucfg.h."
[...]
erreur: ‘JS_EvaluateScript’ was not declared in this scope
This question seems to draw some attention. Note that I asked the same question for V8.