Create a ruby executable with wxruby for linux

2k views Asked by At

I want distribute a application build with ruby and wxruby, but i cant generate one executable, try with ocra , AllInOneRuby but Windows support only and try with rubyscript2exe, but have much errors and doesnt run.

[edit]

With rubyscript2exe first i got rubyscript2exe:5:in replace': can't modify frozen string (TypeError) but i have a solution

later i got require': undefined method `unresolved_deps' for Gem:Module

/usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:35:in `require': undefined method `unresolved_deps' for Gem:Module (NoMethodError)
from /usr/lib/ruby/site_ruby/1.8/rubygems.rb:28
Couldn't execute this command (rc=256):
/usr/bin/ruby -r 'enumerator.so' -r 'rubygems/defaults.rb' -r 'rbconfig.rb' -r 'rubygems/deprecate.rb' -r 'rubygems/exceptions.rb' -r 'rubygems/custom_require.rb' -r 'rubygems.rb' -r 'rubygems/version.rb' -r 'rubygems/requirement.rb' -r 'rubygems/dependency.rb' -r 'rubygems/platform.rb' -r 'rubygems/specification.rb' -r 'rubygems/path_support.rb' -I '/tmp/tar2rubyscript.d.3642.1/rubyscript2exe' -I '/tmp/tar2rubyscript.d.3642.1' -I '/usr/lib64/ruby/gems/1.8/gems/rubyscript2exe-0.5.3/lib' -I '/usr/lib/ruby/site_ruby/1.8' -I '/usr/lib64/ruby/site_ruby/1.8' -I '/usr/lib64/ruby/site_ruby/1.8/x86_64-linux' -I '/usr/lib/ruby/site_ruby' -I '/usr/lib64/ruby/site_ruby' -I '/usr/lib64/site_ruby/1.8' -I '/usr/lib64/site_ruby/1.8/x86_64-linux' -I '/usr/lib64/site_ruby' -I '/usr/lib/ruby/1.8' -I '/usr/lib64/ruby/1.8' -I '/usr/lib64/ruby/1.8/x86_64-linux' -I '.' -I '/home/richie' -I '/tmp/tar2rubyscript.d.3642.1/rubyscript2exe' -I '/tmp/tar2rubyscript.d.3642.1/rubyscript2exe/lib' -I '/tmp/tar2rubyscript.d.3642.1/rubyscript2exe' -I '/tmp/tar2rubyscript.d.3642.1/rubyscript2exe/lib' -r '/tmp/tar2rubyscript.d.3642.1/rubyscript2exe/require2lib.rb' 'Dropbox/15M/src/q.rb'  --require2lib-quiet 

Stopped.

with ruby 1.8.7

any help ?

1

There are 1 answers

2
zipizap On BEST ANSWER

Update: This may not work, because the wxruby gem may use binary "extensions", and that is platform dependent and so may not be easy to get working in Jruby... try and tell

You can try the following workaround with Jruby + warbler gem - it can package your ruby program into a portable JAR (java) file, which you can then copy and run on other computers that have Java installed (only java, ruby will already go packaged in the .jar file :) )

I've made some notes for myself some months ago - they should be enough for the steps involved:

1- install jruby

  • see http://jruby.org/
  • should be as simple as dowload zip file, unzip it, set an environment variable, and execute it (everything is explained it their website, pretty easy)

2- install warbler gem

jruby -S gem install warbler

3- place your .rb files for compile/package with warbler

(see this StackOverflow thread: Create deployable JRuby JAR file? )

mkdir myapp  
mkdir myapp/bin
vim   myapp/bin/myapp.rb  #create .rb file which will be 'booted' (executed) by jar file
mkdir myapp/lib
vim   myapp/lib/my_nice_lib.rb #leave all .rb files to be 'require'd here 
cd myapp  

4- use warbler to compile/package into myapp.jar

warble jar

5- run myapp.jar in any computer with java, with:

java -jar myapp.jar

Hope it helps - report back how it went

Cheers