Packaging a QtRuby app with OCRA?

536 views
Skip to first unread message

Thomas Dall'Agnese

unread,
Apr 1, 2011, 7:45:24 PM4/1/11
to ruby...@googlegroups.com
Dear all,

I continue a post on the old Rubyforge forum here: http://rubyforge.org/forum/message.php?msg_id=96272

Indeed, a basic Hello World script worked with OCRA.
And by the way, it's loading ALL the Qt dlls like QtOpenGL4.dll, QtSql4.dll, ... that are not needed :s I guess and hope there is a way to remove them from the dependencies because a 10 lines Hello World is already 36MB!

Anyway, I tried to find what was messing up everything in my script... and quickly found!
It seems to be one of the required dependencies.

I simply added all the "require" calls of my script to that Hello World, and the error occurred.
With just require 'zip/zipfilesystem', the error occurs... and I need the zip
Here is a minimal script raising the error:

require 'Qt4'
require 'zip/zipfilesystem'
#require 'mime/types'
#require 'rexml/document'
#require 'digest/md5'
#require 'json'
 
app = Qt::Application.new(ARGV)
 
hello = Qt::PushButton.new('Hello World!')
hello.resize(100, 30)
hello.show
 
app.exec


The problem is that I really require that dependencies in my script (all the ones I commented in this script), so how can I load them?

Best regards,

Thomas

Lars Christensen

unread,
Apr 17, 2011, 5:54:59 AM4/17/11
to ruby...@googlegroups.com
Hi Thomas,

Ocra tries to load all modules that are registered using Kernel#autoload, since they are potential dependencies. For some reason, this fails with Qt. You can disable this using --no-autoload, for example:

  ocra --no-autoload script.rb

That seems to work around your problem.

With regard to the size of the executable; Ocra includes all DLL's that are loaded in the Ruby process when the program is tested while creating the executable, so for some reason they are actually loaded by the qtbindings. I don't know if they are actually optional. You can use --no-autodll to prevent this behaviour, but you will need to specify the required DLL's explicitly using --dll. I recommend taking a look at the InnoSetup generator (--innosetup) which installs instead of unpacking.

BR,
Lars

Thomas Dall'Agnese

unread,
Apr 17, 2011, 8:59:48 AM4/17/11
to ruby...@googlegroups.com
Hi Lars,

Indeed, it's working as a charm!
And there is also support for Inno, great.
That's too bad I already moved to Python... :(
I'll use it for my next program, thanks!

Best Regards,
Thomas
Reply all
Reply to author
Forward
0 new messages