Fail to load the win32-api gem when running OCRA

Hi,

I’m trying to run ocra but I seem to have a problem with win32-api. I’m
running this on cygwin and have also tried in an Ubuntu server. Running
ocra outputs an error that tells me to install win32-api, which I do,
but after that I still get the same error.

I’ve also tried running ocra with --no-autodll option but then the
resulting exe file won’t run.

I don’t know what I’m missing. I hope somebody can help. Thanks a lot!

Cheers, Manuel

manuel@songoku ~/Mis documentos/Tasks/20090807___STBAR___API-BSH
$ ruby helloworld.rb
Hello World

manuel@songoku ~/Mis documentos/Tasks/20090807___STBAR___API-BSH
$ ocra helloworld.rb
=== Loading script to check dependencies
Hello World
=== ERROR: Failed to load the win32-api gem. Install win32-api or use
–no-autod
ll.
=== CAUSE: LoadError: Permission denied -
/usr/lib/ruby/gems/1.8/gems/win32-api-
1.4.3-x86-mswin32-60/lib/win32/api.so

manuel@songoku ~/Mis documentos/Tasks/20090807___STBAR___API-BSH
$ gem install win32-api
Successfully installed win32-api-1.4.3-x86-mswin32-60
1 gem installed
Installing ri documentation for win32-api-1.4.3-x86-mswin32-60…
Installing RDoc documentation for win32-api-1.4.3-x86-mswin32-60…

manuel@songoku ~/Mis documentos/Tasks/20090807___STBAR___API-BSH
$ ocra helloworld.rb
=== Loading script to check dependencies
Hello World
=== ERROR: Failed to load the win32-api gem. Install win32-api or use
–no-autod
ll.
=== CAUSE: LoadError: Permission denied -
/usr/lib/ruby/gems/1.8/gems/win32-api-
1.4.3-x86-mswin32-60/lib/win32/api.so

PS: Is this the right way to send my commands? Or should I send an
attached text file?

On Tue, Aug 11, 2009 at 3:58 PM, Manuel Souto
Pico[email protected] wrote:

–no-autod
ll.
=== CAUSE: LoadError: Permission denied -
/usr/lib/ruby/gems/1.8/gems/win32-api-
1.4.3-x86-mswin32-60/lib/win32/api.so

OCRA tries to load win32-api using “require ‘win32/api’”. It looks
like Ruby is trying to load the api.so library, but gets a permission
error. This could be because the library is already open. How do you
load it from your script? (Can you post a simple example script that
reproduces the error?)

What error do you get when using --no-autodll?

Here is my sample script which works with ocra-1.1.2:

require ‘win32/api’
exit if defined?(Ocra)
Win32::API.new(‘MessageBox’, ‘LPPI’, ‘I’, ‘user32’).call(0, “Hello,
World!”, “Greeting”, 0)

You are also welcome to ask your questions at
http://rubyforge.org/forum/forum.php?forum_id=31710

Manuel Souto P. wrote:

I’m
running this on cygwin and have also tried in an Ubuntu server. Running
ocra outputs an error that tells me to install win32-api, which I do,
but after that I still get the same error.

Does ocra work with Linux or another unix-like environment? I thought,
it’s only runnable on Windows, because of win32-api. However, with
–no-autodll I get this on Ubuntu 9.04:

ocra t.rb --no-autodll

=== Loading script to check dependencies
Hello World!
=== Building t.exe
a src\t.rb
/opt/rubies/ruby-1.9.1-p243/lib/ruby/gems/1.9.1/gems/ocra-1.1.2/bin/ocra:440:in
initialize': No such file or directory - /opt/rubies/ruby-1.9.1-p243/bin/ruby.exe (Errno::ENOENT) from /opt/rubies/ruby-1.9.1-p243/lib/ruby/gems/1.9.1/gems/ocra-1.1.2/bin/ocra:440:inopen’
from
/opt/rubies/ruby-1.9.1-p243/lib/ruby/gems/1.9.1/gems/ocra-1.1.2/bin/ocra:440:in
createfile' from /opt/rubies/ruby-1.9.1-p243/lib/ruby/gems/1.9.1/gems/ocra-1.1.2/bin/ocra:281:inblock in build_exe’
from
/opt/rubies/ruby-1.9.1-p243/lib/ruby/gems/1.9.1/gems/ocra-1.1.2/bin/ocra:404:in
block in initialize' from /opt/rubies/ruby-1.9.1-p243/lib/ruby/gems/1.9.1/gems/ocra-1.1.2/bin/ocra:396:inopen’
from
/opt/rubies/ruby-1.9.1-p243/lib/ruby/gems/1.9.1/gems/ocra-1.1.2/bin/ocra:396:in
initialize' from /opt/rubies/ruby-1.9.1-p243/lib/ruby/gems/1.9.1/gems/ocra-1.1.2/bin/ocra:264:innew’
from
/opt/rubies/ruby-1.9.1-p243/lib/ruby/gems/1.9.1/gems/ocra-1.1.2/bin/ocra:264:in
build_exe' from /opt/rubies/ruby-1.9.1-p243/lib/ruby/gems/1.9.1/gems/ocra-1.1.2/bin/ocra:465:inblock in <top (required)>’

I would suggest trying it on a real Windows, not cygwin.

Marvin