Forums | Admin

Discussion Forums: help

Start New Thread Start New Thread

 

By: Becky Boone
RE: Can't run compiled hello.rb [ reply ]  
2009-08-28 22:37
Fails with "require 'watir'"

By: stefano fusillo
RE: Can't run compiled hello.rb [ reply ]  
2009-08-27 13:02
Ok I succeeded in compiling all my application. Just I had to put my classes required among the others in ruby's relative path. Just I had to copy a couple of file used in the application in the same directory of the .exe. All now works fine and I can launch a ruby GTK application using the .exe
If someone could work to optimize my code it would be fantastic!!!

By: stefano fusillo
RE: Can't run compiled hello.rb [ reply ]  
2009-08-27 07:46
Hi,
I was trying the OCRA 1.1.2 for a simple application (ruby 1.8.6 on windows) and it worked fine for a simple script launching it from the ruby\bin directory. Then I tried to compile a GTK application but I got aware that OCRA doesn't charge GTK libraries then I modified the ocra module adding this raw code

############## GTK ##################
def Ocra.file_GTK(gtkdir,bi,s)
sb=s
base=bi+'lib/GTK'+gtkdir
app=gtkdir
d = Dir.new(b)
d.each{|f|
if f!="." and f!=".." and f!="bin"
if File.directory?(base + '//' + f)
f=app+'/'+f
#puts f
file_GTK(f,bi,sb)
else
sb.createfile(base + '/' +f, 'lib\GTK\\' +app +'\\'+ f)
end
end
}
end
###################################

################## GTK #########################
file_GTK('',bindir.gsub("bin",''),sb) if File.exists?(bindir.gsub("bin",'lib/GTK')) ##############################################

and I got my goal launching on ruby\bin directory!!!
Then I moved the executable on the desktop and launched it from there. Damn it didn't work as before. I did the same with the previous simple script and it failed!!!I catched the temporary dir and I noticed that the file in the require statement where not created as well as when i launched the exe from the ruby\bin directory and the ruby\lib directory wasn't created the same!!!
Someone has any suggestion???

By: Christopher Rasch
RE: Can't run compiled hello.rb [ reply ]  
2009-05-27 18:48
Awesome! Thanks, Lars! I'll try the new version tonight.

By: Lars Christensen
RE: Can't run compiled hello.rb [ reply ]  
2009-05-27 14:38
I've released version 1.1.0 now. It includes a hack using win32-api to detect DLLs. It seems to work with nokogiri and a couple of others I've tried. Please try it out.

By: Tom Paschenda
RE: Can't run compiled hello.rb [ reply ]  
2009-05-27 04:41
Hi Michael!
Determining which dlls a program requires is afaik not a trivial task.
However, rubyscript2exe has some way to do that, but I don't know how it works. Perhaphs you can examine it's source code. Note, that it hides it's source code in a tar-archive, that is extracted only while it is running.
The other way I know of is to use a tool called dependency walker. Just google for that.
Hth
Tom

By: Michael Matti
RE: Can't run compiled hello.rb [ reply ]  
2009-05-26 15:39
Lars -

Looks like those DLLs are the solution to Christopher's original problem. My own project, still failing, relies entirely on wxRuby. Any idea what DLLs I should copy into ruby/bin? For that matter, is there any rule-of-thumb on how to run down DLL dependencies on any gems we're requiring?

Thanks.

- Michael

By: Lars Christensen
RE: Can't run compiled hello.rb [ reply ]  
2009-05-26 08:38
I managed getting your script working with ocra-1.0.3. There are couple of issues:

Previous versions had some issues with selecting the right console/windows runtime. That's why you didn't get any console output.

Second issue is DLLs. I haven't thought of a way to autodetect these yet, so every single one needs to the specified when running Ocra. Furthermore, some of the required dlls are hidden with the nokogiri gem, and Ocra doesn't currently look for them there.

I managed by copying all DLLs from the nokogiri ext directory to the Ruby bin directory and running this command:

ocra --dll ssleay32.dll --dll zlib1.dll --dll libeay32.dll --dll iconv.dll --dll libxml2.dll --dll libexslt.dll --dll libxslt.dll mech.rb

By: Michael Matti
RE: Can't run compiled hello.rb [ reply ]  
2009-05-23 17:26
Hmm ... tried running ocra.rb from the script location, but wound up with the same results. Then, to really bear down on the issue, I copied the script and its dependencies directly into the gem directory at C:\app\ruby\lib\ruby\gems\1.8\gems\ocra-1.0.2\bin.

Ran "ocra.rb main.rbw" from the command line, within ocra's gem folder, and _still_ had the same results.

Sounded like a great idea -- after all, it worked for you -- but still no joy over here. Thanks for the suggestion.

By: David Mullet
RE: Can't run compiled hello.rb [ reply ]  
2009-05-23 15:52
Michael Matti-

I seem to have duplicated your error, and identified a workaround---on my machine, anyway.

Try running ocra.rb from the directory where your script is located. In other words, instead of...

ocra.rb "C:\data\My Dropbox\wxruby\test3.rbw"

...navigate to the "C:\data\My Dropbox\wxruby" directory, then run:

ocra.rb test3.rbw

Does that resolve your problem?

David

By: David Mullet
RE: Can't run compiled hello.rb [ reply ]  
2009-05-23 15:35
Christopher and Lars-

The error appears to be related to the mechanize gem. I compiled Christopher's code with OCRA, then ran the exe and received an error that "libxml2.dll was not found".

I commented out the "require 'mechanize'" and recompiled, which seems to have resolved the problem.

This may not help Christopher immediately (if he needs mechanize), but maybe it will help Lars track down the root cause.

David

By: Michael Matti
RE: Can't run compiled hello.rb [ reply ]  
2009-05-22 21:09
Have a followup: Tried renaming the source file's extension from .rbw to .rb and then ran it from the command line, redirecting output to a text file. Output is "Failed to create directory."

Not clear what directory it's trying to create, but maybe that's a clue.

By: Michael Matti
RE: Can't run compiled hello.rb [ reply ]  
2009-05-18 18:03
Here's the output from ocra's run; the resulting .exe causes an hourglass for two seconds and silently dies. No Ruby session errors reported, and no complaints from ocra either:

=== Loading script to check dependencies
=== Building C:\data\My Dropbox\wxruby\test3.exe
m src
m src\C:
m src\C:\data
m src\C:\data\My Dropbox
m src\C:\data\My Dropbox\wxruby
a src\C:\data\My Dropbox\wxruby\test3.rbw
m bin
a bin\rubyw.exe
a bin\msvcrt-ruby18.dll
m lib
m lib\ruby
m lib\ruby\gems
m lib\ruby\gems\1.8
m lib\ruby\gems\1.8\specifications
a lib\ruby\gems\1.8\specifications\ocra-1.0.2.gemspec
a lib\ruby\gems\1.8\specifications\wxruby-2.0.0-x86-mswin32-60.gemspec
m lib\ruby\site_ruby
m lib\ruby\site_ruby\1.8
m lib\ruby\site_ruby\1.8\rubygems
a lib\ruby\site_ruby\1.8\rubygems\rubygems_version.rb
a lib\ruby\site_ruby\1.8\rubygems\defaults.rb
m lib\ruby\1.8
m lib\ruby\1.8\i386-mswin32
a lib\ruby\1.8\i386-mswin32\thread.so
a lib\ruby\1.8\thread.rb
a lib\ruby\1.8\i386-mswin32\rbconfig.rb
a lib\ruby\site_ruby\1.8\rubygems\exceptions.rb
a lib\ruby\site_ruby\1.8\rubygems\requirement.rb
a lib\ruby\site_ruby\1.8\rubygems\version.rb
a lib\ruby\site_ruby\1.8\rubygems\dependency.rb
a lib\ruby\site_ruby\1.8\rubygems\gem_path_searcher.rb
a lib\ruby\site_ruby\1.8\rubygems\user_interaction.rb
a lib\ruby\site_ruby\1.8\rubygems\platform.rb
a lib\ruby\site_ruby\1.8\rubygems\specification.rb
a lib\ruby\site_ruby\1.8\rubygems\source_index.rb
a lib\ruby\site_ruby\1.8\rubygems\builder.rb
a lib\ruby\1.8\i386-mswin32\stringio.so
m lib\ruby\1.8\yaml
a lib\ruby\1.8\yaml\error.rb
a lib\ruby\1.8\i386-mswin32\syck.so
a lib\ruby\1.8\yaml\ypath.rb
a lib\ruby\1.8\yaml\basenode.rb
a lib\ruby\1.8\yaml\syck.rb
a lib\ruby\1.8\yaml\tag.rb
a lib\ruby\1.8\yaml\stream.rb
a lib\ruby\1.8\yaml\constants.rb
a lib\ruby\1.8\rational.rb
m lib\ruby\1.8\date
a lib\ruby\1.8\date\format.rb
a lib\ruby\1.8\date.rb
a lib\ruby\1.8\yaml\rubytypes.rb
a lib\ruby\1.8\yaml\types.rb
a lib\ruby\1.8\yaml.rb
a lib\ruby\1.8\i386-mswin32\Win32API.so
a lib\ruby\site_ruby\1.8\rubygems\config_file.rb
a lib\ruby\site_ruby\1.8\rubygems\custom_require.rb
a lib\ruby\site_ruby\1.8\rubygems.rb
a lib\ruby\1.8\i386-mswin32\etc.so
a lib\ruby\1.8\fileutils.rb
m lib\ruby\gems\1.8\gems
m lib\ruby\gems\1.8\gems\wxruby-2.0.0-x86-mswin32-60
m lib\ruby\gems\1.8\gems\wxruby-2.0.0-x86-mswin32-60\lib
a lib\ruby\gems\1.8\gems\wxruby-2.0.0-x86-mswin32-60\lib\wxruby2.so
m lib\ruby\gems\1.8\gems\wxruby-2.0.0-x86-mswin32-60\lib\wx
a lib\ruby\gems\1.8\gems\wxruby-2.0.0-x86-mswin32-60\lib\wx\version.rb
a lib\ruby\gems\1.8\gems\wxruby-2.0.0-x86-mswin32-60\lib\wx\helpers.rb
m lib\ruby\gems\1.8\gems\wxruby-2.0.0-x86-mswin32-60\lib\wx\classes
a lib\ruby\gems\1.8\gems\wxruby-2.0.0-x86-mswin32-60\lib\wx\classes\evthandler.rb
a lib\ruby\gems\1.8\gems\wxruby-2.0.0-x86-mswin32-60\lib\wx\classes\acceleratortable.rb
a lib\ruby\gems\1.8\gems\wxruby-2.0.0-x86-mswin32-60\lib\wx\classes\animation.rb
a lib\ruby\gems\1.8\gems\wxruby-2.0.0-x86-mswin32-60\lib\wx\classes\app.rb
a lib\ruby\gems\1.8\gems\wxruby-2.0.0-x86-mswin32-60\lib\wx\classes\artprovider.rb
a lib\ruby\gems\1.8\gems\wxruby-2.0.0-x86-mswin32-60\lib\wx\classes\auinotebook.rb
a lib\ruby\gems\1.8\gems\wxruby-2.0.0-x86-mswin32-60\lib\wx\classes\bitmap.rb
a lib\ruby\gems\1.8\gems\wxruby-2.0.0-x86-mswin32-60\lib\wx\classes\busycursor.rb
a lib\ruby\gems\1.8\gems\wxruby-2.0.0-x86-mswin32-60\lib\wx\classes\checklistbox.rb
a lib\ruby\gems\1.8\gems\wxruby-2.0.0-x86-mswin32-60\lib\wx\classes\choice.rb
a lib\ruby\gems\1.8\gems\wxruby-2.0.0-x86-mswin32-60\lib\wx\classes\clientdc.rb
a lib\ruby\gems\1.8\gems\wxruby-2.0.0-x86-mswin32-60\lib\wx\classes\clipboard.rb
a lib\ruby\gems\1.8\gems\wxruby-2.0.0-x86-mswin32-60\lib\wx\classes\colour.rb
a lib\ruby\gems\1.8\gems\wxruby-2.0.0-x86-mswin32-60\lib\wx\classes\combobox.rb
a lib\ruby\gems\1.8\gems\wxruby-2.0.0-x86-mswin32-60\lib\wx\classes\commandevent.rb
a lib\ruby\gems\1.8\gems\wxruby-2.0.0-x86-mswin32-60\lib\wx\classes\controlwithitems.rb
a lib\ruby\gems\1.8\gems\wxruby-2.0.0-x86-mswin32-60\lib\wx\classes\dataformat.rb
a lib\ruby\gems\1.8\gems\wxruby-2.0.0-x86-mswin32-60\lib\wx\classes\data_object.rb
a lib\ruby\gems\1.8\gems\wxruby-2.0.0-x86-mswin32-60\lib\wx\classes\data_object_simple.rb
a lib\ruby\gems\1.8\gems\wxruby-2.0.0-x86-mswin32-60\lib\wx\classes\dc.rb
a lib\ruby\gems\1.8\gems\wxruby-2.0.0-x86-mswin32-60\lib\wx\classes\event.rb
a lib\ruby\gems\1.8\gems\wxruby-2.0.0-x86-mswin32-60\lib\wx\classes\font.rb
a lib\ruby\gems\1.8\gems\wxruby-2.0.0-x86-mswin32-60\lib\wx\classes\functions.rb
a lib\ruby\gems\1.8\gems\wxruby-2.0.0-x86-mswin32-60\lib\wx\classes\gauge.rb
a lib\ruby\gems\1.8\gems\wxruby-2.0.0-x86-mswin32-60\lib\wx\classes\genericdirctrl.rb
a lib\ruby\gems\1.8\gems\wxruby-2.0.0-x86-mswin32-60\lib\wx\classes\grid.rb
a lib\ruby\gems\1.8\gems\wxruby-2.0.0-x86-mswin32-60\lib\wx\classes\hboxsizer.rb
a lib\ruby\gems\1.8\gems\wxruby-2.0.0-x86-mswin32-60\lib\wx\classes\helpcontroller.rb
a lib\ruby\gems\1.8\gems\wxruby-2.0.0-x86-mswin32-60\lib\wx\classes\simplehelpprovider.rb
a lib\ruby\gems\1.8\gems\wxruby-2.0.0-x86-mswin32-60\lib\wx\classes\helpcontrollerhelpprovider.rb
a lib\ruby\gems\1.8\gems\wxruby-2.0.0-x86-mswin32-60\lib\wx\classes\helpprovider.rb
a lib\ruby\gems\1.8\gems\wxruby-2.0.0-x86-mswin32-60\lib\wx\classes\htmlhelpcontroller.rb
a lib\ruby\gems\1.8\gems\wxruby-2.0.0-x86-mswin32-60\lib\wx\classes\htmlwindow.rb
a lib\ruby\gems\1.8\gems\wxruby-2.0.0-x86-mswin32-60\lib\wx\classes\icon.rb
a lib\ruby\gems\1.8\gems\wxruby-2.0.0-x86-mswin32-60\lib\wx\classes\iconbundle.rb
a lib\ruby\gems\1.8\gems\wxruby-2.0.0-x86-mswin32-60\lib\wx\classes\image.rb
a lib\ruby\gems\1.8\gems\wxruby-2.0.0-x86-mswin32-60\lib\wx\classes\imagelist.rb
a lib\ruby\gems\1.8\gems\wxruby-2.0.0-x86-mswin32-60\lib\wx\classes\listbox.rb
a lib\ruby\gems\1.8\gems\wxruby-2.0.0-x86-mswin32-60\lib\wx\classes\listctrl.rb
a lib\ruby\gems\1.8\gems\wxruby-2.0.0-x86-mswin32-60\lib\wx\classes\locale.rb
a lib\ruby\gems\1.8\gems\wxruby-2.0.0-x86-mswin32-60\lib\wx\classes\mediactrl.rb
a lib\ruby\gems\1.8\gems\wxruby-2.0.0-x86-mswin32-60\lib\wx\classes\menu.rb
a lib\ruby\gems\1.8\gems\wxruby-2.0.0-x86-mswin32-60\lib\wx\classes\menuitem.rb
a lib\ruby\gems\1.8\gems\wxruby-2.0.0-x86-mswin32-60\lib\wx\classes\notebook.rb
a lib\ruby\gems\1.8\gems\wxruby-2.0.0-x86-mswin32-60\lib\wx\classes\object.rb
a lib\ruby\gems\1.8\gems\wxruby-2.0.0-x86-mswin32-60\lib\wx\classes\paintdc.rb
a lib\ruby\gems\1.8\gems\wxruby-2.0.0-x86-mswin32-60\lib\wx\classes\point.rb
a lib\ruby\gems\1.8\gems\wxruby-2.0.0-x86-mswin32-60\lib\wx\classes\previewframe.rb
a lib\ruby\gems\1.8\gems\wxruby-2.0.0-x86-mswin32-60\lib\wx\classes\rect.rb
a lib\ruby\gems\1.8\gems\wxruby-2.0.0-x86-mswin32-60\lib\wx\classes\richtextctrl.rb
a lib\ruby\gems\1.8\gems\wxruby-2.0.0-x86-mswin32-60\lib\wx\classes\size.rb
a lib\ruby\gems\1.8\gems\wxruby-2.0.0-x86-mswin32-60\lib\wx\classes\sizer.rb
a lib\ruby\gems\1.8\gems\wxruby-2.0.0-x86-mswin32-60\lib\wx\classes\sound.rb
a lib\ruby\gems\1.8\gems\wxruby-2.0.0-x86-mswin32-60\lib\wx\classes\standardpaths.rb
a lib\ruby\gems\1.8\gems\wxruby-2.0.0-x86-mswin32-60\lib\wx\classes\styledtextctrl.rb
a lib\ruby\gems\1.8\gems\wxruby-2.0.0-x86-mswin32-60\lib\wx\classes\textctrl.rb
a lib\ruby\gems\1.8\gems\wxruby-2.0.0-x86-mswin32-60\lib\wx\classes\texturlevent.rb
a lib\ruby\gems\1.8\gems\wxruby-2.0.0-x86-mswin32-60\lib\wx\classes\timer.rb
a lib\ruby\gems\1.8\gems\wxruby-2.0.0-x86-mswin32-60\lib\wx\classes\toolbar.rb
a lib\ruby\gems\1.8\gems\wxruby-2.0.0-x86-mswin32-60\lib\wx\classes\toolbartool.rb
a lib\ruby\gems\1.8\gems\wxruby-2.0.0-x86-mswin32-60\lib\wx\classes\treectrl.rb
a lib\ruby\gems\1.8\gems\wxruby-2.0.0-x86-mswin32-60\lib\wx\classes\validator.rb
a lib\ruby\gems\1.8\gems\wxruby-2.0.0-x86-mswin32-60\lib\wx\classes\vboxsizer.rb
a lib\ruby\gems\1.8\gems\wxruby-2.0.0-x86-mswin32-60\lib\wx\classes\window.rb
a lib\ruby\gems\1.8\gems\wxruby-2.0.0-x86-mswin32-60\lib\wx\classes\xmlresource.rb
a lib\ruby\gems\1.8\gems\wxruby-2.0.0-x86-mswin32-60\lib\wx\accessors.rb
a lib\ruby\gems\1.8\gems\wxruby-2.0.0-x86-mswin32-60\lib\wx\keyword_ctors.rb
a lib\ruby\gems\1.8\gems\wxruby-2.0.0-x86-mswin32-60\lib\wx\keyword_defs.rb
a lib\ruby\gems\1.8\gems\wxruby-2.0.0-x86-mswin32-60\lib\wx.rb
m lib\ruby\site_ruby\1.8\i386-msvcrt
a lib\ruby\site_ruby\1.8\i386-msvcrt\zlib.so
a lib\ruby\1.8\i386-mswin32\socket.so
a lib\ruby\1.8\timeout.rb
m lib\ruby\1.8\net
a lib\ruby\1.8\net\protocol.rb
m lib\ruby\1.8\uri
a lib\ruby\1.8\uri\common.rb
a lib\ruby\1.8\uri\generic.rb
a lib\ruby\1.8\uri\ftp.rb
a lib\ruby\1.8\uri\http.rb
a lib\ruby\1.8\uri\https.rb
a lib\ruby\1.8\uri\ldap.rb
a lib\ruby\1.8\uri\mailto.rb
a lib\ruby\1.8\uri.rb
a lib\ruby\1.8\net\http.rb
a lib\ruby\1.8\parsedate.rb
a lib\ruby\1.8\time.rb
a lib\ruby\site_ruby\1.8\rubygems\remote_fetcher.rb
a lib\ruby\site_ruby\1.8\rubygems\spec_fetcher.rb
e RUBYOPT
e RUBYLIB
l bin\rubyw.exe rubyw.exe ÿ\src\C:\data\My Dropbox\wxruby\test3.rbw
=== Compressing
=== Finished (Final size was 2607838)

By: Christopher Rasch
RE: Can't run compiled hello.rb [ reply ]  
2009-05-18 02:57
Hi Lars,

Thanks for the response. There's no output of any kind. The only thing that happens is that the hourglass appears for a few seconds, then stops.

Chris

By: Lars Christensen
RE: Can't run compiled hello.rb [ reply ]  
2009-05-17 12:32
If you have built using --console, can you try look for any output from the executable when you run it? It should output any exceptions raised or errors occuring when trying to run it.

By: Michael Matti
RE: Can't run compiled hello.rb [ reply ]  
2009-05-15 17:16
Just hit exactly the same problem, but for me it's intermittent.

Installed the 1.0.2 gem from the ruby\bin directory, and it completed but complained about not finding "lib".

Tried out ocra.rb with a simple .rbw file that uses the wxRuby widgets. Resulting .exe worked fine that first time.

The weird thing is, ever since then, about two-thirds of the builds are duds. Same as described previously: an hourglass for a few seconds, then nothing. Checked the Windows task manager for any orphaned/hanging processes, but nothing there either. The .exe is instantly dying.

Can upload ocra's output, if interested. Very promising program, so I hope this can be ironed out.

By: Christopher Rasch
Can't run compiled hello.rb [ reply ]  
2009-05-15 08:36
Hi,


I'm having trouble getting the following script to run, after compiling it with ocra on Windows XP:

hello.rb---

require 'rubygems'
require 'mechanize'
require 'hpricot'
require 'ostruct'
require 'faster_csv'

puts "Hello, World!"

----

(Only the stuff between the dashes is in the script).


I have installed ruby via the latest one-click installer on Windows XP.

> ruby -v
ruby 1.8.6 (2008-08-11 patchlevel 287) [i386-mswin32]

The libraries listed have been installed via the gem system, and seem to have installed okay. The script runs when you run it as a ruby script:

>hello.rb
Hello, World!

The script appears to compile correctly.

> ocra --console hello.rb

...

l bin\rubyw.exe rubyw.exe  \src\hello.rb
=== Compressing
=== Finished (Final size was 768702)


A file named hello.exe is created. However, when I run the script, either from the command line:

>hello

...or by double-clicking on it, I get the hourglass for a few seconds, but then nothing happens.

I'm a newbie to windows, so any suggestions would be most appreciated. Thanks!