Newbie with 32-bit Mac

12 views
Skip to first unread message

Richard Drake

unread,
Apr 13, 2010, 10:36:26 AM4/13/10
to Johnson
Was thinking over the weekend it would be cool to be able to parse
some JS in Ruby. Discovered Johnson (and RKelly and a few other
things). I'm currently using an old (2006) Mac Mini and Snow Leopard:

Model Name: Mac mini
Model Identifier: Macmini1,1
Processor Name: Intel Core Duo
Processor Speed: 1.66 GHz
Number Of Processors: 1
Total Number Of Cores: 2
L2 Cache: 2 MB
Memory: 2 GB
Bus Speed: 667 MHz

I've been reading your back numbers (what fun) and I guess the lack of
full 64-bit may be a snag. But here goes

~ $ ruby -v
ruby 1.8.7 (2008-06-20 patchlevel 22) [i686-darwin8.11.1]
~ $ file -L `which ruby`
/usr/local/bin/ruby: Mach-O universal binary with 2 architectures
/usr/local/bin/ruby (for architecture i386): Mach-O executable i386
/usr/local/bin/ruby (for architecture ppc): Mach-O executable ppc
~ $ sudo gem install johnson -v "2.0.0.pre3"
Building native extensions. This could take a while...
ERROR: Error installing johnson:
ERROR: Failed to build gem native extension.

/usr/local/bin/ruby extconf.rb
checking for jsautocfg.h in /usr/local/lib/ruby/gems/1.8/gems/
johnson-2.0.0.pre3/vendor/tracemonkey... no
checking for jsapi.h in /usr/local/lib/ruby/gems/1.8/gems/
johnson-2.0.0.pre3/vendor/tracemonkey... no
creating Makefile

make
g++ -I. -I/usr/local/lib/ruby/1.8/i686-darwin8.11.1 -I/usr/local/lib/
ruby/1.8/i686-darwin8.11.1 -I. -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -
fno-common -O2 -arch i686 -arch ppc -fno-common -pipe -fno-common -
g -Wall -Wextra -Wcast-qual -Wwrite-strings -Wconversion -
Wmissing-noreturn -Winline -DXP_UNIX -c context.cc
In file included from context.h:4,
from context.cc:1:
tracemonkey.h:9:19: error: jsapi.h: No such file or directory
tracemonkey.h:10:20: error: jshash.h: No such file or directory
etc


That was after trying a few different versions before that ... so it
took less time to fail. The thing is, I can see the jsapi.h and the
rest. I don't want to spend an age on Johnson - this week anyway - but
it would be cool to have the full McCoy if it's possible. If not, I'll
go in another direction.

Thanks in advance. It looks a great concept.

Richard

Steven Parkes

unread,
Apr 13, 2010, 3:41:24 PM4/13/10
to johnso...@googlegroups.com
> g++ -I. -I/usr/local/lib/ruby/1.8/i686-darwin8.11.1 -I/usr/local/lib/
> ruby/1.8/i686-darwin8.11.1 -I. -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -
> fno-common -O2 -arch i686 -arch ppc -fno-common -pipe -fno-common -
> g -Wall -Wextra -Wcast-qual -Wwrite-strings -Wconversion -
> Wmissing-noreturn -Winline -DXP_UNIX -c context.cc
> In file included from context.h:4,
> from context.cc:1:
> tracemonkey.h:9:19: error: jsapi.h: No such file or directory
> tracemonkey.h:10:20: error: jshash.h: No such file or directory
> etc

I'm not sure why, but that command looks bogus. The '-I.' right before the '-D_XOPEN_SOURCE' is not right: it should point to the vendored tracemonkey, not '.'.

There are two differences between what you have and what I build/test against: I have a 64 bit install and I don't use the native ruby. PL22 seems pretty old. compared to current (at least what RVM installs), which is PL249. 2008-06-20 was quite awhile ago. I wonder if the ext build stuff was broken?

Would using a newer ruby (say, via rvm), be possible for you?

Richard Drake

unread,
Apr 13, 2010, 4:14:31 PM4/13/10
to johnso...@googlegroups.com
Embarrassing, using rvm's latest 1.8.7 seems to have fixed it.

Should have spotted that but thanks.


--
To unsubscribe, reply using "remove me" as the subject.



--
23 Paxton Road, London SE23 2QG
02082442459
07906768867

Richard Drake

unread,
Apr 14, 2010, 6:57:31 PM4/14/10
to Johnson
That worked out really well.

Some questions. On parsing I used to_sexp as I found that form easier
to inspect. Is there a better way? Is there documentation?

Is TraceMonkey the same as SpiderMonkey these days?

Is anyone doing anything serious to link Johnson to V8?

This helped solve a key integration problem for me anyhow. Thanks for
that. I'll return :)

On Apr 13, 9:14 pm, Richard Drake <rdrak...@gmail.com> wrote:
> Embarrassing, using rvm's latest 1.8.7 seems to have fixed it.
>
> Should have spotted that but thanks.
>

Steven Parkes

unread,
Apr 14, 2010, 7:10:17 PM4/14/10
to johnso...@googlegroups.com
> Is TraceMonkey the same as SpiderMonkey these days?

Yes. We're planning on switching back to just calling it all SpiderMonkey.

> Is anyone doing anything serious to link Johnson to V8?

Not that I'm aware of. As it stands, Johnson is pretty tied to the SpiderMonkey API.

> On parsing I used to_sexp as I found that form easier
> to inspect. Is there a better way? Is there documentation?

I leave that to others ...

Richard Drake

unread,
Apr 17, 2010, 7:24:46 AM4/17/10
to Johnson
I wrote up the experience (and a few other things) at

http://rdrake98.posterous.com/ossat-nodejs-and-johnson

Hope it prompts some further interest.
--
Subscription settings: http://groups.google.com/group/johnson-talk/subscribe?hl=en
Reply all
Reply to author
Forward
0 new messages