2

I need to use spidermonkey for my perl javascript engine. For that I need to build spidermonkey with thread-safe libraries. So as I understand I need to first build NSPR and then spidermonkey.

So, as I understood from following link https://developer.mozilla.org/en/NSPR_build_instructions

I first downloaded the mozilla-build and opened the mingw. I followed the instructions as mentioned like creating target.debug directory and so on .....

when I am doing make, I am getting following error message

make[3]: nsinstall: Command not found
make[3]: *** [export] Error 127
make[3]: Leaving directory `/c/target.debug/pr/include/md'
make[2]: *** [export] Error 2
make[2]: Leaving directory `/c/target.debug/pr/include'
make[1]: *** [export] Error 2
make[1]: Leaving directory `/c/target.debug/pr'
make: *** [export] Error 2

looks like nsinstall is missing.

I am not a professional programmer in C/C++ so looking for your help.

I need to successfully build the spidermonkey on window using Mingw.

I tried to follow the steps as mentioned in following link: http://jargon.ca/spidermonkey/

but when I am running the js.exe, it's complaining about missing libnspr4.dll file.

So please help me how can I build nspr and spidermonkey on windows operating system.

mfontani
  • 2,924
  • 20
  • 18
rpg
  • 1,632
  • 2
  • 18
  • 34
  • Have you tried to follow the instruction in my blog http://opensourcepack.blogspot.com/2012/01/spidermonkey-185-mingw.html –  Apr 02 '12 at 12:55

3 Answers3

3

You can get a copy of nsinstall from mozilla.

  • Download moztools-static.zip and unzip it.
  • copy moztools-static/moztools/bin/nsinstall.exe to /mingw/bin.
Robert
  • 41
  • 2
1

There is no straight forward way on Windows. You have two options to do that. Either follow instructions on:

  1. Compiming Mozilla with MinGW
  2. Or satisfy the pre-requisities mentioned on Windows pre-requisities page and start compiling.

I have not personally tried the 1st option, but for second option you will need Microsoft Visual Studio to work with. Then again, if you need just NSPR 4 why don't you pull out those files from your Firefox installation directoy? I guess the DLLs are named something like nspr4.dll, plc4.dll and plds4.dll.

Unmanned Player
  • 1,109
  • 9
  • 30
  • Forgot to mention: when you compile nspr4, I think you need to say the windows platform while calling the ../configure script. Specify win95 and not Winnt which is default that generates libnspr4.dll. Read its help for more info. For js.exe to start working, nspr4.dll/libnspr4.dll should be in the same directory as js.exe or locatable in %PATH%. – Unmanned Player Apr 11 '11 at 05:21
  • My Firefox 27.0.1 installation does not contain nspr4.dll. However it contains nss3.dll. Linking with `-lnss3` in place of `-lnspr4` seems to work well. – Jarekczek Mar 12 '14 at 09:56
  • Thunderbird release contains `nspr4.dll` file. – Jarekczek Mar 12 '14 at 12:25
0

You can build nsinstall with cygwin the following way:

mkdir cygwinbuild
../configure --host=i386-pc-linux-gnu
cd config
make nsinstall

Then building with mingw (with --enable-win32-target=WIN95) almost succeeds. I had to fix the following things:

(1) pr/include/md/_win95.h

// these should be defined in winbase.h, but in my mingw
// they are not
#ifndef STACK_SIZE_PARAM_IS_A_RESERVATION 0x00010000
  #define STACK_SIZE_PARAM_IS_A_RESERVATION 0x00010000
#endif
#ifndef CRITICAL_SECTION_NO_DEBUG_INFO
  #define CRITICAL_SECTION_NO_DEBUG_INFO  0x01000000
#endif

(2) pr/include/pratom.h, line 80

// my mingw cannot link InterlockedIncrement, probably there's a better
// option than turning this off
#if 0 && defined(_WIN32) && !defined(_WIN32_WCE) && \

(3) If one wants to run the tests, the trick from point 1 should also be applied to tests attach, foreign, testfile.

Some tests fail using my build: cvar, gethost, op_2long, parent, reinit, selct_nm, socket, sockopt, writev. The rest is successful.

Jarekczek
  • 7,456
  • 3
  • 46
  • 66