However, spidermonkey is in my Mac ports collection because it is a
dependency of CouchDB.
I was wondering if I can configure Johnson to use the built in
spidermonkey binary: /opt/local/bin/js.
Thanks,
and Happy Holidays and Happy New Year.
Ed
On Sun, Dec 27, 2009 at 12:52 PM, Ed Howland <ed.ho...@gmail.com> wrote:
> Well, I was not able to get Johnson compiled on 1.8.7 on my Mac due to
> the spidermonkey compile problem mentioned elsewhere. I got the same
> result with smparkes-johnson gem.
Which compile problem is this? IIRC, johnson *should* work with 1.8.7.
> However, spidermonkey is in my Mac ports collection because it is a
> dependency of CouchDB.
>
> I was wondering if I can configure Johnson to use the built in
> spidermonkey binary: /opt/local/bin/js.
Not at this time. Johson ships with with spidermonkey, so you can't
really configure it to point at a different version. Have you tried
building johnson from the git repo? Maybe we can fix the compile
problem you mentioned earlier.
--
Aaron Patterson
http://tenderlovemaking.com/
> Well, I was not able to get Johnson compiled on 1.8.7 on my Mac due to
> the spidermonkey compile problem mentioned elsewhere. I got the same
> result with smparkes-johnson gem.
Can you give some more details? Which version of OS X? Which ruby (system or one you installed yourself)? 32 or 64 bit?
I've installed my version of the gem on OS X several times, both 32 and 64 bit (though no 32 bit recently). I did make a few tweaks to make it build on Snow Leopard, as I recall.
Can you post the compile failure?
> I was wondering if I can configure Johnson to use the built in
> spidermonkey binary: /opt/local/bin/js.
Not easily. Doh ... Aaron just answered.
I am assuming I have the latest from Github, because 'git pull'
produces: 'Already up-to-date.' I've narrowed down the problem to:
First the config. Intel Macbook Pro. Snow Leopard (10.6.2)
rake build:spidermonkey
...
cat: ../../dist/Darwin_DBG.OBJ/nspr/Version: No such file or directory
make[1]: Circular jscpucfg.h <- Darwin_DBG.OBJ/jsautocfg.h dependency
dropped.
cc -o Darwin_DBG.OBJ/jscpucfg Darwin_DBG.OBJ/jscpucfg.o
ld: warning: in Darwin_DBG.OBJ/jscpucfg.o, file is not of required
architecture
Undefined symbols:
"_main", referenced from:
start in crt1.10.6.o
ld: symbol(s) not found
....
It seems that this is a problem with jscpucfg.o needing a 32 bit build
perhaps and gcc is compiling a 64 bit one? I am not sure how to fix
this. Perhaps by setting an ARCH-some environment variable before the
build.
Steven, which tweaks did you happen to apply to build it? I tried your
gem fork and I get the same error, IIRC.
Thanks,
Ed
In this case, the line that would help is the line that builds jscpucfg.o: need to see the flags/options/etc.
There are problems on OS X because the build infrastructure files in the frozen spidermonkey in the git repo don't detect the arch correctly on 64-bit 10.6. I found a discussion amongst the Moz folks about it. They've since fixed it on newer versions of spidermonkey, including the one distributed with FF3.5, which is what my fork vendors as tracemonkey. I back ported a bunch of small changes to the frozen spidermonkey in my fork, which builds as spidermonkey. I'm happy to help getting all this back into the main repo however I can ...
If cloning my repo, doing a "git submodule update --init", and a "rake test" doesn't work, I'd love to see the output of the rake command ...
gcc -I. -I/Users/edh/.rvm/ruby-1.8.7-p174/lib/ruby/1.8/i386-darwin10.0.0
-I/Users/edh/.rvm/ruby-1.8.7-p174/lib/ruby/1.8/i386-darwin10.0.0
-I../../../../ext/spidermonkey
-I/Users/edh/ruby/smparkes-johnson/johnson/vendor/spidermonkey/Darwin_DBG.OBJ
-I/Users/edh/ruby/smparkes-johnson/johnson/vendor/spidermonkey
-D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -fno-common -isysroot
/Developer/SDKs/MacOSX10.6.sdk -arch i386 -pipe -fno-common -g -Wall
-Wextra -Wcast-qual -Wwrite-strings -Wconversion
-Wmissing-noreturn -Winline -DXP_UNIX -c
../../../../ext/spidermonkey/debugger.c
In file included from ../../../../ext/spidermonkey/immutable_node.h:6,
from ../../../../ext/spidermonkey/debugger.c:4:
/Users/edh/ruby/smparkes-johnson/johnson/vendor/spidermonkey/jsatom.h:69:
error: size of array ‘arg’ is negative
In file included from
/Users/edh/ruby/smparkes-johnson/johnson/vendor/spidermonkey/jsgc.h:48,
from
/Users/edh/ruby/smparkes-johnson/johnson/vendor/spidermonkey/jscntxt.h:52,
from ../../../../ext/spidermonkey/immutable_node.h:10,
from ../../../../ext/spidermonkey/debugger.c:4:
/Users/edh/ruby/smparkes-johnson/johnson/vendor/spidermonkey/jsbit.h:220:
error: size of array ‘arg’ is negative
gmake: *** [debugger.o] Error 1
rake aborted!
Command failed with status (2): [gmake...]
(See full trace by running task with --trace)
---
Ed
> In this case, the line that would help is the line that builds jscpucfg.o: need to see the flags/options/etc.
>
> There are problems on OS X because the build infrastructure files in the frozen spidermonkey in the git repo don't detect the arch correctly on 64-bit 10.6. I found a discussion amongst the Moz folks about it. They've since fixed it on newer versions of spidermonkey, including the one distributed with FF3.5, which is what my fork vendors as tracemonkey. I back ported a bunch of small changes to the frozen spidermonkey in my fork, which builds as spidermonkey. I'm happy to help getting all this back into the main repo however I can ...
>
> If cloning my repo, doing a "git submodule update --init", and a "rake test" doesn't work, I'd love to see the output of the rake command ...
--
Ed Howland
http://greenprogrammer.wordpress.com
http://twitter.com/ed_howland
> Ok, using rvm 1.8.7
When did you install this? In particular:
> gcc -I. -I/Users/edh/.rvm/ruby-1.8.7-p174/lib/ruby/1.8/i386-darwin10.0.0
This implies you're using a 32 bit compiler, which leads to a few questions. Are you specifically trying to do a 32-bit compile? I know people have been wrestling with forcing 32 bits under Snow Leopard, which, I think, wants to default to 64 bits now. Unless, perhaps, you are on a 32-bit only Mac (if such things exist ... and can run Snow Leopard)?
If you don't want/need 32 bits for some reason, you may need to reinstall ruby and/or the developer tools to get 100% 64 bits.
Otherwise, we need to debug why it's getting confused about the 32 bit config ... but first I want to figure out if that's actually what we want. I did have this running on a 32 bit Mac w/o problem but I no longer have that machine and it wasn't running Snow Leopard ...
Here is my system info. AFAIK, it is 64 bit for Core 2 duo,
Model Name: MacBook Pro
Model Identifier: MacBookPro5,3
Processor Name: Intel Core 2 Duo
Processor Speed: 2.66 GHz
Number Of Processors: 1
Total Number Of Cores: 2
L2 Cache: 3 MB
Memory: 4 GB
Bus Speed: 1.07 GHz
Boot ROM Version: MBP53.00AC.B03
SMC Version (system): 1.48f2
...
It could be that I have Ruby 1.9.1 as my primary Ruby install, but for
using johnson, I used rvm to switch to 1.8.7, as Aaron has told me of
the bug with compiling and the 'node.h' issue.
Perhaps when I installed 1.8.7, it defaulted to a 32-bit install of Ruby?
I could try using the built-in Ruby, I think if I just manipulate my
PATH a bit I can get it back. Let me try that.
Ed
--
That did the trick:
rake test
...
Finished in 0.52309 seconds.
303 tests, 620 assertions, 0 failures, 0 errors
---
It worked in the regular johnson cloned git:
rake test
...
Finished in 0.619385 seconds.
301 tests, 628 assertions, 0 failures, 0 errors
---
I am sorry that I never thought to try that. I never suspected an arch
difference with rvm. Otherwise it tends to work fine. Have to keep
that in mind.
Thanks for all your help. Now which gem should I install? Haha.
Cheers and Happy New Year!
Ed
> I am sorry that I never thought to try that. I never suspected an arch
> difference with rvm. Otherwise it tends to work fine. Have to keep
> that in mind.
No worries.
If I had to, I'd guess that you did the rvm install with a 32 bit compiler. And now that I think of it, I think this actually got brought on a Moz developer list: the arch detection stuff notes that you're running SL and therefore expects it's going to be built as a 64 bit library. There's no provision for building a 32 bit binary on 64 bit archs: could be done, but they haven't.
If you haven't upgraded your developer tools since upgrading to Snow Leopard, you should. If you do "/Developer/usr/bin/gcc -v", it should give an arch of "Target: i686-apple-darwin10". As long as that's the case, you should be able to just use rvm to uninstall and reinstall ruby and you should end up with a 64 bit ruby.
I've found hat having 32 and 64 bit stuff floating around is just asking for build trouble unless you're trying to do something pretty uncommon.
gcc -v reports:
Target: i686-apple-darwin10
I will uninstall rvm and reinstall it. I might uninstall my source
built 1.9.1 as well and just use it under rvm once I am sure I am
getting a 64 bit build.
How can I check if Ruby is a 64 bit binary?
Thanks,
Ed
--
> gcc -v reports:
> Target: i686-apple-darwin10
That looks right. I guess I don't know what happened, how you managed to get a 32 bit compile of ruby.
> How can I check if Ruby is a 64 bit binary?
Something like "file -L `which ruby`". It should say something like
/Users/smparkes/.rvm/ruby-1.8.6-p383/bin/ruby: Mach-O 64-bit executable
unless it's a fat binary, but I don't think any of the normal ruby installers will generate a fat binary (the apple-provided binaries are fat).