Fix for Spidermonkey Build Issue in Darwin

Posted: October 15th, 2010 | Author: | Filed under: IT Related | Tags: , , , , , | 2 Comments »

If any you found the following error msg while compiling Spidermonkey on Darwin / Mac ?

jsobj.c: In function ‘js_ConstructObject’:
jsobj.c:2686: warning: comparison is always true due to limited range of data type
cc -o Darwin_DBG.OBJ/jsopcode.o -c -Wall -Wno-format -g -DXP_UNIX -DSVR4 -DSYSV -D_BSD_SOURCE -DPOSIX_SOURCE -DDARWIN -DX86_LINUX  -DDEBUG -DDEBUG_adnan -DEDITLINE -IDarwin_DBG.OBJ  jsopcode.c
cc -o Darwin_DBG.OBJ/jsparse.o -c -Wall -Wno-format -g -DXP_UNIX -DSVR4 -DSYSV -D_BSD_SOURCE -DPOSIX_SOURCE -DDARWIN -DX86_LINUX  -DDEBUG -DDEBUG_adnan -DEDITLINE -IDarwin_DBG.OBJ  jsparse.c
cc -o Darwin_DBG.OBJ/jsprf.o -c -Wall -Wno-format -g -DXP_UNIX -DSVR4 -DSYSV -D_BSD_SOURCE -DPOSIX_SOURCE -DDARWIN -DX86_LINUX  -DDEBUG -DDEBUG_adnan -DEDITLINE -IDarwin_DBG.OBJ  jsprf.c
jsprf.c: In function ‘BuildArgArray’:
jsprf.c:644: error: incompatible types in assignment
make[1]: *** [Darwin_DBG.OBJ/jsprf.o] Error 1
make: *** [all] Error 2

Personally, i’ll answer yes 🙂

And here is a quick fix for the issue:

1) Open jsprf.c
2) Add the following lines in line 61 (js-1.7.0)

#elif defined(va_copy)
#define VARARGS_ASSIGN(foo, bar) va_copy(foo,bar)

Make sure it is now somehow similar to the following:

#ifdef HAVE_VA_COPY
#define VARARGS_ASSIGN(foo, bar)        VA_COPY(foo,bar)
#elif defined(va_copy)
#define VARARGS_ASSIGN(foo, bar)        va_copy(foo,bar)
#elif defined(HAVE_VA_LIST_AS_ARRAY)
#define VARARGS_ASSIGN(foo, bar)        foo[0] = bar[0]

3) make -f Makefile.ref
4) your spider monkey is ready in Darwin_DBG.OBJ directory 🙂

Credit: http://github.com/janl/couchdbx-core/blob/ff47372552d10df00d74cb7989dfed4a19a6040d/patches/js/patch-jsprf.c