views:

54

answers:

1

I have finished developing a GUI desktop Ruby application that uses Qt through the qtbindings gem, and I need to release it with a few requirements:

  1. The user doesn't have to build or compile anything, especially Qt libraries, installing Ruby and Rubygems is OK, but not more
  2. It must run on Mac and Windows, Linux too preferably

I've tried tar2rubyscript & rubyscript2exe but I failed due to some cryptic errors, as I've described on KDE-bindings mailing list

A helpful guy on #qtruby IRC channel suggested I bundle it as a gem and release it. I've been trying to do that but my problem is, how can I link qtbindings to a static Qt library? I made the gemspec, and I used bundler, but it builds against the native Qt development libraries / headers.. and my users won't have that.

So my questions are, again:

  1. Can I use a gem for this? If so, how can I have the user build qtbindings against a static library of Qt that I provide?
  2. Do you know of any other way to package a qtruby app? Did you do it?
A: 

I have done a lot of development in Qt but I'm still learning Ruby and QtRuby so, please, take this with a grain of salt.

I wouldn't take the gem route and would try to package it just like the commercial Qt application I used to work on.

A single package including everything for the program needs to run. This would include the Qt4 Ruby bindings and Qt libraries and everything else that you need it to run but it's not on [a Windows vanilla install/a MacOS vanilla install/The most commonly supported Linux Standard Base] with the possible exception of the Ruby interpreter in itself.

Wrap your application in script to setup LD_LIBRARY_PATH and other kind of environmental variables to make sure everything works with the dynamic libraries you're shipping but are not installed on Linux target. On Windows just leave them (dynamic libraries) in the main main folder although you can go for the script route too. I never deployed on the Mac so I don't know but I can imagine it to be similar to the Linux route.

I know it's not elegant but at least it works.

Vitor Py
Hmm that's an interesting suggestion, I'm gonna try it out tonight and I'll post back my progress. I have a note though; dynamic libraries can't/shouldn't be packaged, that's why they're dynamic in the first place. I'll build a static version of Qt and try with that. Although as you said, that's not very elegant. Thank you.
amireh
@amireh That's not the only motive libraries should be shared - they can be shared between multiple instances of your application. I didn't have good experiences using static builds of Qt when mixed with X11. X11 loads some libraries dynamically anyway (delayed) and if some structure changes, your application crashes. I really recommend using a shared Qt, even having to ship it. Please, post back your experiences. I'm going to do the same (deploy a QtRuby application) sometime in the future, so I'm interested in helping you out.
Vitor Py