“arch -i386 ruby†not loading into 32-bit mode in 10.6.3

  • Thread starter Richard Fairbanks
  • Start date
R

Richard Fairbanks

<2.33GHz MBPC2D running OS X 10.6.3>

OSAX calls within the default 64-bit environment of OS X 10.6.3 (I have
not tried with earlier OS X versions) are failing when using what has
been recommended for forcing Ruby to run in 32-bit mode: “#! arch -i386
rubyâ€.

A test script, results, and software versions are appended below.

Thoughts?

Thanks!!

Richard Fairbanks


---- Script ----

#! arch -i386 ruby
require 'rubygems'
require 'appscript'; include Appscript
require 'osax'; include OSAX
p scripting_additions
#=> ["Digital Hub Scripting", "Numerics", "Satimage",
"SpeedDownloadLoader", "StandardAdditions", "XMLLib"]

# so good so far and non-OSAX scripts run as expected, but
# none of the following work:
osax.beep
osax.set_the_clipboard_to("howdy")
osax.say ("Hey, wake up.", :using=>"Victoria")

---- Results ----

RuntimeError: OSAX::ScriptingAddition can't dynamically retrieve
scripting addition terminology within a 64-bit process.
from /Library/Ruby/Site/1.8/osax.rb:153:in `initialize'
from /Library/Ruby/Site/1.8/osax.rb:102:in `new'
from /Library/Ruby/Site/1.8/osax.rb:102:in `osax'
from /Library/Ruby/Site/1.8/osax.rb:124:in `osax'
from (irb):4

---- Software Versions ----

ruby 1.8.7 (2009-06-08 patchlevel 173) [universal-darwin10.0]
RubyGems 1.3.6
StandardAdditions.osax version 2.1.2
# To determine whether Ruby is running in 32bit or 64bit
['foo'].pack('p').size #=> 8 on 64bit, 4 on 32bit, I got “8â€
 
H

hengist podd

Richard said:
<2.33GHz MBPC2D running OS X 10.6.3>

OSAX calls within the default 64-bit environment of OS X 10.6.3 (I have
not tried with earlier OS X versions) are failing when using what has
been recommended for forcing Ruby to run in 32-bit mode: “#! arch -i386
rubyâ€.

Not clear how you ran it, but it sounds as if you're still running in
64-bit mode.

To test the script, I changed the hashbang to '#!/usr/bin/env -i386
ruby', saved it as 'test.rb', chmodded it to make it executable, and ran
it as ./test.rb, and it ran fine in 32-bit.

FWIW, I have a TODO on embedding Standard Additions terminology in the
OSAX module (I've already done this for py-appscript) so that it will
work on 64-bit as well. I still need to figure out Ruby 1.9's text
encoding support before I do a new release though.

HTH

has
 
R

Richard Fairbanks

Not clear how you ran it, but it sounds as if you're still running in
64-bit mode.

I’ve been entering it manually into Terminal and also running it as an
AppleScript:

do shell script "ruby '/Applications/ Scripting/Ruby/Tests/test.rb'"

The results are the same in either case (as in initial post), only the
OSAX calls fail.

AFAICT, it is still in 64-bit mode. Early on I ran the following with
the noted result:

# To determine whether Ruby is running in 32bit or 64bit
['foo'].pack('p').size #=> 8 on 64bit, 4 on 32bit #=> I got “8â€
To test the script, I changed the hashbang to '#!/usr/bin/env -i386
ruby',

I tried that as an initial attempt and it didn’t work either.
chmodded it to make it executable,

I didn’t know that was necessary as other scripts ran fine, only the
OSAX calls failed. Please offer some wisdom as to how to set it as such,
if it is necessary!
and ran it as ./test.rb, and it ran fine in 32-bit.

I would love to be able to get the same results; at least I now know it
is possible in 10.6.3! Any other advice would be greatly appreciated! (I
love AppleScript. Really. I do. ;-) )
FWIW, I have a TODO on embedding Standard Additions terminology in the
OSAX module (I've already done this for py-appscript) so that it will
work on 64-bit as well. I still need to figure out Ruby 1.9's text
encoding support before I do a new release though.

If you would like (yet another) beta-tester, just let me know!

;-)

Thanks for your incredible efforts! Appscript is quite a blessing!

Richard Fairbanks
 
H

hengist podd

Richard said:
I’ve been entering it manually into Terminal and also running it as an
AppleScript:

do shell script "ruby '/Applications/ Scripting/Ruby/Tests/test.rb'"

The hashbang at the top of a script only applies when you execute the
script file directly. Since you're invoking the ruby interpreter
yourself and passing the script path as an argument, it will be ignored.

Use:

do shell script "arch -i386 ruby '/Applications/
Scripting/Ruby/Tests/test.rb'"

If you would like (yet another) beta-tester, just let me know!

It's in the subversion repository if you want to play with it.

HTH

has
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,584
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top