endflow.net blog

/* programming and programming */

Building SpiderMonkey on Windows

with 16 comments

/* Introduction */

I have build SpiderMonkey 1.7.0 on Windows XP SP2 using Visual C++ 2008 (Visual Studio 2008 Command Prompt). However, I couldn’t build easily because I encountered some linker errors. So I would like to describe about how to avoid errors.

/* Build Requirements */

I don’t know enough or not.

  • SpiderMonkey 1.7.0 Source code
  • Visual C++ 2008 (Visual Studio 2008 Command Prompt)

I use Development Edition but maybe you can do this using Express Edition.

/* Failed Building */

There are many build targets.

"js - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
"js - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
"jsshell - Win32 Release" (based on "Win32 (x86) Console Application")
"jsshell - Win32 Debug" (based on "Win32 (x86) Console Application")
"jskwgen - Win32 Release" (based on "Win32 (x86) Static Library")
"jskwgen - Win32 Debug" (based on "Win32 (x86) Static Library")
"fdlibm - Win32 Release" (based on "Win32 (x86) Static Library")
"fdlibm - Win32 Debug" (based on "Win32 (x86) Static Library")

*part of js.mak

In this entry, I decide to use “jsshell – Win32 Debug”. Because I want to check DLL(js32.dll) quickly with the console application “JSShell”(jsshell.exe).

OK, let’s execute following build command from Visual Studio 2008 Command Prompt.

nmake -f "js.mak" CFG="jsshell - Win32 Debug"

After executing, you will get many many “Warning” messages and few “Error” messages and fail to build. First, focus on Error messages (ignore Warning messages in this time),

jsapi.obj : error LNK2001: unresolved external symbol "_js_GeneratorClass"
jsapi.obj : error LNK2001: unresolved external symbol "_js_IteratorClass"
jsapi.obj : error LNK2001: unresolved external symbol "_js_StopIterationClass"
jsapi.obj : error LNK2001: unresolved external symbol "_js_InitIteratorClasses"
jsobj.obj : error LNK2001: unresolved external symbol "_js_InitIteratorClasses"
jsgc.obj : error LNK2019: unresolved external symbol _js_CloseGeneratorObject referenced in function _js_RunCloseHooks
jsgc.obj : error LNK2019: unresolved external symbol _js_CloseIteratorState referenced in function _CloseIteratorStates
jsinterp.obj : error LNK2019: unresolved external symbol _js_NewGenerator referenced in function _js_Interpret
jsinterp.obj : error LNK2019: unresolved external symbol _js_CloseNativeIterator referenced in function _js_Interpret
jsinterp.obj : error LNK2019: unresolved external symbol _js_CallIteratorNext referenced in function _js_Interpret
jsinterp.obj : error LNK2019: unresolved external symbol _js_ValueToIterator referenced in function _js_Interpret

like this.

/* Fix Makefile */

As you know, there are linker errors. When I hear “linker error” and “unresolved”, I remember “library” problem, but in this time, it has different problem. Because the missing symbol has prefix “_js_”.

Next, I think the code excluded by pre-processor such as “#ifdef” and “#endif”. However, I couldn’t find doubtful codes. There is the missing function “js_CallIteratorNext” in jsiter.c (extern declaration in jsiter.h).

Erm … next, I think I grep object files and check the name of missing symbol. When just I saw the list of object files in Explorer, I understand causes of build error. Surprisingly, there are no describe of “jsiter”(jsiter.h, jsiter.c, jsiter.obj)! That’s mean the object file “jsiter.obj” (include symbol “js_CallIteratorNext”) didn’t generated.

I got causes and I would like to add jsiter.* into Makefile(js.mak). However, it is annoying work. So I put modified Makefile in here(as you know, UNWARRANTABLE).

/* Succeed Building */

The fix was done, let’s try re-build. For safety, I recommend to delete “Debug” directory completely. The build will succeed and generated “js32.dll” and “jsshell.exe” in Debug directory. (there are many many warning as usual)

Hum … why don’t I use Tamarin? lololol

enjoy JS with SpiderMonkey! ;)

Written by kuy

January 20th, 2008 at 8:35 pm

Posted in Uncategorized

Tagged with , , , ,

16 Responses to 'Building SpiderMonkey on Windows'

Subscribe to comments with RSS or TrackBack to 'Building SpiderMonkey on Windows'.

  1. thanks dude. i didn’t use tamarin cause the script to bytecode compiler isn’t open sourced yet from what i hear ;)

    ian

    9 Feb 08 at 12:16

  2. Thanks a lot for this! I managed to compile SpiderMonkey using VC++ Express 8 and your modified makefile. I think maybe there’s a small error on line 960, though. I noticed jsiter.h is listed twice. I think it should be:

    “.jsiter.h”
    “.jsinterp.h”

    (It probably works fine, anyway.) Thanks again! :-)

    dave

    17 Feb 08 at 21:28

  3. thanks much, guy

    Laurissatk

    20 Mar 08 at 09:58

  4. ian, Laurissatk:
    Thank you comment.
    I’d like to write next blog entry about this topics.

    dave:
    thanks your pointing.
    I’ll update make file.

    kuy

    13 May 08 at 12:55

  5. google finds only your page and its just what i looking for.
    thanks a lot!

    sou

    17 May 08 at 08:25

  6. Very much appreciated.

    Michael

    17 Jun 08 at 05:19

  7. Thanks a lot. i would like to compile the Spidermonkey in release mode, can u tell me the command for the same.

    Thanks in advance
    Gagan

    Gagan

    7 Sep 08 at 15:34

  8. VC++に最近乗り移ったんで、コマンドプロンプトでビルドするあたりからどうビルドして良いのかわかりません

    コマンドプロンプトは開けるのですが、最初にjsファイルを読み込ませてからコマンドプロンプトを開きビルドするんですか?

    またコマンドプロンプトを使わないでビルドする方法はありますか

    アドバイスお願いします

    学生(VC初心者)

    14 Sep 08 at 01:26

  9. ビルド仕方がわかりました
    けどまた問題にぶち当たりどう修正して良いのかわかりません
    環境はVC2008です

    $ nmake -f js.mak CFG=”jsshell – Win32 Release”
    js.mak(34)fatal error U1050:An invalid configuration is specified. stop
    というエラーが出たんですけど具体的にどう修正すればよろしいのでしょうか

    アドバイスお願いします

    学生(VC初心者)

    15 Sep 08 at 00:37

  10. $ nmake -f js.mak CFG=”jsshell – Win32 Release”

    - Win32 Release ”-”空白入れるの忘れただけでした

    おさがわせしてすみません

    学生(VC初心者)

    15 Sep 08 at 02:38

  11. Thanks a lot! That surely saved me some time!

    tom

    17 Jan 09 at 02:26

  12. Thanks dude… it saved me time and headache.

    supmit

    24 Jan 09 at 05:56

  13. Thanks a ton!! You rock!

    jon

    19 Feb 09 at 06:43

  14. Thanks so much! It works in VS 2005 as well.

    Joe

    8 Oct 09 at 10:37

  15. thanks, it’s helpful.I followed the guide and suceeded in generating .dll files without errors. However, the warnings remain. There are so many that I bother to see the details. Does the warnings matters?

    vacant

    11 Dec 09 at 14:41

  16. @vacant
    Hmm… I don’t know importance of warnings since I could use it without any issues in fact. Did you get something problem?

    kuy

    11 Dec 09 at 14:48

Leave a Reply