building mozilla NSPR using MinGw on windows without VC++

2.3k views Asked by At

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.

3

There are 3 answers

3
Unmanned Player On BEST ANSWER

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.

0
Robert On

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.
0
Jarekczek On

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.