在win32环境下编译SpiderMonkey1.7 Shell

 

转贴自: http://archives.devshed.com/forums/mozilla-98/making-spidermonkey-1-7-shell-compile-on-win32-solution-2263499.html 

 

作者:Rasmus Kromann-Larsen

 

有时间再翻译。

 

Making SpiderMonkey 1.7 Shell compile on Win32 (solution)

Crosspost from mozilla.dev.tech.javascript (not sure which groups are
active).

Hi,

I'm currently writing a master thesis on JavaScript, and needed to
modify SpiderMonkey. I'm working with the GranParadisio alpha 3
version of Firefox - and version 1.7 of SpiderMonkey. In this process,
I wanted to get my modified SpiderMonkey into both Firefox and working
as a shell. Apparently, the first is easy, but the jsshell doesn't
seem to work out of the box.

I've finally after a lot of googling and various attempts, managed to
make it work. I'll list my steps here, so it might help anyone else
trying to accomplish this. Furthermore, I'm pretty sure someone else
can fix the shell in a much cleaner way than I have, which would be
appreciated :-)

Browser compilation:

1. Download and install MozillaBuildSetup.exe
2. Download mozilla source (GranParadisio3)
3. Use this .mozconfig:

$
mk_add_options MZBJDIR=@TPSRCDIR@/ff-dynamic
ac_add_options
ac_add_options
ac_add_options
ac_add_options
ac_add_options
mk_add_options MZ_CPRJECT=browser

4. Compile it :-) This should work out of the box - although probably
take a few hours.

Now it's possible to change something in the js/src dir and compile it
in ff-dynamic/js/src - integrating the changes into the dynamic
firefox.

-- Making the shell work:

Now, following some old directions I found, I went to the js/src
directory in mingw32 and wrote 'nmake -f js.mak' to produce
jsshell.exe - this however resulted in:

UTPUT BEGIN

$ nmake -f js.mak

Microsoft (R) Program Maintenance Utility Version 8.00.50727.762
Copyright (C) Microsoft Corporation. All rights reserved.

No configuration specified. Defaulting to jsshell - Win32 Debug.
cl.exe /nologo /MDd /W3 /Gm /GX /Zi / /D "_DEBUG" /D
"DEBUG" /D _X86_=1 /D "_WINDWS" /D "WIN32" /D "XP_WIN" /D "JSFILE" /D
"EXPRT_JS_API" /Fp"./Debug/js.pch" /I"./Debug" /YX /Fo"./Debug/" /
Fd".
/Debug/" /c "jsinterp.c"
cl : Command line warning D9035 : option 'GX' has been deprecated and
will be removed in a future release
cl : Command line warning D9036 : use 'EHsc' instead of 'GX'
cl : Command line warning D9002 : ignoring unknown option '/YX'
jsinterp.c
link.exe @E:/DCUME~1/RasmusKL/LCALS~1/Temp/nm390.tmp
jsapi.obj : error LNK2001: unresolved external symbol
_js_InitIteratorClasses
jsobj.obj : error LNK2001: unresolved external symbol
_js_InitIteratorClasses
jsgc.obj : error LNK2001: unresolved external symbol
_js_CloseG
jsinterp.obj : error LNK2001: unresolved external symbol
_js_NewGenerator
jsinterp.obj : error LNK2001: unresolved external symbol
_js_CallIteratorNext
jsinterp.obj : error LNK2001: unresolved external symbol
_js_ValueToIterator
jsinterp.obj : error LNK2001: unresolved external symbol
_js_CloseNativeIterator
jsgc.obj : error LNK2001: unresolved external symbol
_js_CloseIteratorState
jsapi.obj : error LNK2001: unresolved external symbol
_js_GeneratorClass
jsapi.obj : error LNK2001: unresolved external symbol
_js_StopIterationClass
jsapi.obj : error LNK2001: unresolved external symbol
_js_IteratorClass
/Debug/js32.dll : fatal error LNK1120: 10 unresolved externals
NMAKE : fatal error U1077: '"e:/Program Files/Microsoft Visual Studio
8/VC/BIN/link.exe"' : return code '0x460'
Stop.
NMAKE : fatal error U1077: '"e:/Program Files/Microsoft Visual Studio
8/VC/BIN/nmake.exe"' : return code '0x2'
Stop.

UTPUT END

Googling further, I found an obscure fix to someone compiling under
MSVC6 here:



I tried adding:

#include "jsiter.c"

in my jsinterp.c as the thread said - and lo-and-behold The
jsshell.exe compiled!

Wrapping it all up:

Now however, building firefox from the dynamic build won't work
anymore. It'll give you the following error:

UTPUT BEGIN

jsiter.obj : error LNK2005: _js_CloseIteratorState already defined in
jsinterp.obj
jsiter.obj : error LNK2005: _js_GetNativeIteratorFlags already defined
in jsinterp.obj
jsiter.obj : error LNK2005: _js_CloseNativeIterator already defined in
jsinterp.obj
jsiter.obj : error LNK2005: _js_ValueToIterator already defined in
jsinterp.obj
jsiter.obj : error LNK2005: _js_CallIteratorNext already defined in
jsinterp.obj
jsiter.obj : error LNK2005: _js_NewGenerator already defined in
jsinterp.obj
jsiter.obj : error LNK2005: _js_CloseG already defined
in jsinterp.obj
jsiter.obj : error LNK2005: _js_InitIteratorClasses already defined in
jsinterp.obj
jsiter.obj : error LNK2005: _js_IteratorClass already defined in
jsinterp.obj
jsiter.obj : error LNK2005: _js_StopIterationClass already defined in
jsinterp.obj
jsiter.obj : error LNK2005: _js_GeneratorClass already defined in
jsinterp.obj
Creating library js3250.lib and object js3250.exp
js3250.dll : fatal error LNK1169: one or more multiply defined symbols
found
make[1]: [js3250.dll] Error 145
make[1]: Leaving directory `/
src'
make: [default] Error 2

UTPUT END

Which would work without the extra include. My hacky solution after
experimenting with getting the error to disappear both places was to
change my #include in jsinterp.c to:

#if _FIX_JSSHELL
#include "jsiter.c"
#endif

and add /D "_FIX_JSSHELL" to the js.mak file, resulting in:

CPP=cl.exe
# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /Zi / /D "WIN32" /D
"_DEBUG" /D _X86_=1 /D "_WINDWS" /YX /c
# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi / /D "_DEBUG" /D "DEBUG" /D
_X86_=1 /D "_WINDWS" /D "WIN32" /D "XP_WIN" /D "JSFILE" /D
"EXPRT_JS_API" /I"$(INTDIR)" /YX /c
CPP_PRJ=/nologo /MDd /W3 /Gm /GX /Zi / /D "_DEBUG" /D "DEBUG" /D
_X86_=1 /D "_WINDWS"/
/D "WIN32" /D "XP_WIN" /D "JSFILE" /D "_FIX_JSSHELL" /D
"EXPRT_JS_API" /Fp"$(INTDIR)/js.pch" /I"$(INTDIR)" /YX/
/Fo"$(INTDIR)/" /Fd"$(INTDIR)/" /c

Hope it helps someone - or atleast give the people actually developing
this stuff an idea for a more clean fix than my hacky solution :-)

- Rasmus.


dev-tech-js-engine mailing list
dev-tech-js-engine (AT) lists (DOT) mozilla.org

 

-----------------------------------------------------------------------------------------------------------

 

Brian Crowder

 

 

Making SpiderMonkey 1.7 Shell compile on Win32 (solution)

-- Making the shell work:
>

Now, following some old directions I found, I went to the js/src
directory in mingw32 and wrote 'nmake -f js.mak' to produce
jsshell.exe - this however resulted in:
>

UTPUT BEGIN
>

$ nmake -f js.mak

You want to use Makefile.ref instead (ideally with GNU make). Using
the mozillabuild tools you needed for building the browser should work
fine.


dev-tech-js-engine mailing list
dev-tech-js-engine (AT) lists (DOT) mozilla.org

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值