Ruby distribution woes - bz2 lib and mongrel

Hi everyone,

sometimes it really frustrates me that it’s so difficult to distribute
applications written with Ruby. You hack together something quickly that
works perfectly on your own machine, with all the gems, libraries and
stuff you’ve installed… then you want to move it.

In my concrete case, I’m writing an offline viewer for Wikipedia dump
files (it’s working pretty darn well allready, with repacked files it
gives me 0.2 second load times from inside a packed file with over 2
million objects - 7z just spins for minutes). I want to put the dump
files and this program on a CD / DVD and give it to people, who should
be able to just do put in the CD, and run it straight off the CD (it’s a
mongrel server that serves content to localhost), whether it’s Windows,
Mac or Linux.

I’ve tried with rubyscript2exe, which is a great tool, but it fails
currently. I think it is because I’m using two C extensions - mongrel
and the bz2 library. The bz2 is not even a gem, so I don’t know how I’d
compile it for Windows. Any good ideas on best practices for
distributing this - ideally so that it can run as a “portable app”
without installation.

Thank you so much
Stian

On May 15, 10:54 am, Stian H. [email protected] wrote:

million objects - 7z just spins for minutes). I want to put the dump
without installation.

Thank you so much
Stian


Posted viahttp://www.ruby-forum.com/.

Webrick instead of Mongrel should make more portable.

If you want Linux guy, Windows guy, Mac guy can access your cd, you
must supply ruby (and the whole shebangs) in 3 format (linux, win32,
and mac).

Dear all,

I am writing to say that I am experiencing the same
problems as Stian - I am even experiencing these problems when
I try to run a very small test application, without
any libraries and gems, that just asks the user for
a string and then repeats it.
I repeatedly posted on this list to get some clue
why this is so, but got no response that solves my
problems ( please help again, Erik!):

1.) I would like to be able to start an application,
from a binary, made by tar2rubyscript/rubyscript2exe, that will
run on (m)any Linux - distribution(s) installed on a i386/i586
machine (and, separately, on Windows XP), from the following script:

p ‘Please insert some text’
f.gets
p ‘You typed in:’
p f.chomp

If I create the binary under Linux on one machine, this works
fine, but when I execute it, I always get:

/bin/sh: /tmp/eee.appl2_linux.2/bin/ruby: cannot execute binary file

(appl2_linux is the name of my binary).

2.) I’d like to know how to distribute gems and libraries
with such a binary executable ( I’d need gsl, FXRuby, mostly),
maybe all compiled statically…

Could somebody kindly point me to a tutorial/wiki that describes
this for the utterly confused ? Of course, I read the manuals
for tar2rubyscript, and rubyscript2exe, but I couldn’t yet find
anything solving my difficulties in there.

Thank you for any help.

Best regards,

Axel

Dear all,

I am writing to say that I am experiencing the same
problems as Stian - I am even experiencing these problems when
I try to run a very small test application, without
any libraries and gems, that just asks the user for
a string and then repeats it.
I repeatedly posted on this list to get some clue
why this is so, but got no response that solves my
problems ( please help again, Erik!):

1.) I would like to be able to start an application,
from a binary, made by tar2rubyscript/rubyscript2exe, that will
run on (m)any Linux - distribution(s) installed on a i386/i586
machine (and, separately, on Windows XP), from the following script:

p ‘Please insert some text’
f.gets
p ‘You typed in:’
p f.chomp

If I create the binary under Linux on one machine, this works
fine, but when I execute it, I always get:

/bin/sh: /tmp/eee.appl2_linux.2/bin/ruby: cannot execute binary file

(appl2_linux is the name of my binary).

2.) I’d like to know how to distribute gems and libraries
with such a binary executable ( I’d need gsl, FXRuby, mostly),
maybe all compiled statically…

Could somebody kindly point me to a tutorial/wiki that describes
this for the utterly confused ? Of course, I read the manuals
for tar2rubyscript, and rubyscript2exe, but I couldn’t yet find
anything solving my difficulties in there.

Thank you for any help.

Best regards,

Axel

Akbar H. wrote:

On May 15, 10:54 am, Stian H. [email protected] wrote:

million objects - 7z just spins for minutes). I want to put the dump
without installation.

Thank you so much
Stian


Posted viahttp://www.ruby-forum.com/.

Webrick instead of Mongrel should make more portable.

If you want Linux guy, Windows guy, Mac guy can access your cd, you
must supply ruby (and the whole shebangs) in 3 format (linux, win32,
and mac).

I agree that Webrick would make it eaier, although it’s quite a bit
slower, also - as far as I know - there is no way to put a handler on /
, and another on /search - the /search gets eaten by the /, which makes
for ugly URLs.

The situation with the bz2 library is more serious… I could use the
built-in gzip lib, but the difference is really about 30%, and we’re
talking huge files here - for the English one I’ll have to use a
shoehorn to get it in to one DVD :slight_smile:

And I would be happy to spend the few megabytes needed to supply all of
Ruby, if I could just figure out exactly how. I am also hoping that in
all the frenzy of developing new runtimes for Ruby, people think about
distribution, because it’s horribly stumping when you develop a great
new app, and you can’t get it out to people.

Stian

Thank you all. I guess what I need is to sit down with a computer that
has never had Ruby installed and figure out which files it’s trying to
access and then supply them - whether in the Ruby script or as an
installer.

I also need to figure out how to compile the bzip2 extension for
Windows. I read something about using mingw on Linux that could work. I
guess if I did it in cygwin, the binaries would be huge because they
would contain the entire cygwin package?

Thank you
Stian

On 2007-05-15 17:34:45 +0900 (Tue, May), Axel E. wrote:

If I create the binary under Linux on one machine, this works
fine, but when I execute it, I always get:

/bin/sh: /tmp/eee.appl2_linux.2/bin/ruby: cannot execute binary file

(appl2_linux is the name of my binary).

You may need to check whether the /tmp is not mounted with noexec
option, or just move your binary out of /tmp. The tmp dir is usually
terribly insecure place to store programs.

Just guessing.

I don’t know if this will help or not, but you can specify binaries to
embed in your rubyscript2exe executable…

RUBYSCRIPT2EXE.bin = [“file1”, “file2”]

http://www.erikveen.dds.nl/rubyscript2exe/index.html#3.3.1

And I would be happy to spend the few megabytes needed to supply all of
Ruby, if I could just figure out exactly how.

You might want to check out Erik V.'s AllInOneRuby…

http://www.erikveen.dds.nl/allinoneruby

David

http://rubyonwindows.blogspot.com

Hi Axel,

thanks a lot for the effort. This is definitively not an academic
effort, I really wnat as many people as possible to be able to use it.
I’m not going to be working much on a computer for the next 10 days, but
during that travel I’m getting a new laptop, and I’m going to try to set
up some virtual machines or something so I can play around with getting
it to work on a “clean installation”… It really should be possible, if
I just knew which files to copy to where.

Thanks a lot again, and I might be in touch later.
Stian

Dear Stian,

I have managed to make a binary created from
tar2rubyscript/rubyscript2exe
that runs on another computer, provided that it uses the same
live Linux distribution … so maybe , if you’re developing
essentially for demonstrative purposes ( program sth. for an
academic thesis etc…), you can distribute a Live Linux distribution
alongside your application on a CD…
I know that’s not a mass-market solution yet :frowning:
I will try what I can do for Windows next week.

Actually, I sometimes think the response frequency distribution to
individual threads on this list has changed somewhat to the worse:
say, a year or more ago, my impression is that generally,
the average number of answers to a request used to be smaller,
but many experienced users tried to contribute a lot of information
per post.
Now the number of posts has dramatically increased for some threads,
but there many people just agreeing or disagreeing on some tangential
aspect, whereas many threads get drowned - and unanswered - in a hundred
responses to these big threads (sigh).

Best regards,

Axel

-------- Original-Nachricht --------
Datum: Wed, 16 May 2007 16:53:53 +0900
Von: Stian H. [email protected]
An: [email protected]
Betreff: Re: Ruby distribution woes - bz2 lib and mongrel

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs