Ruby distribution woes - bz2 lib and mongrel

S

Stian Haklev

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
 
A

akbarhome

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

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).
 
A

Axel Etzold

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
 
A

Axel Etzold

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
 
S

Stian Haklev

Akbar said:
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 :)

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
 
D

David Mullet

S

Stian Haklev

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
 
M

Mariusz Pękala

--9UV9rz0O2dU/yYYn
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

If I create the binary under Linux on one machine, this works
fine, but when I execute it, I always get:
=20
/bin/sh: /tmp/eee.appl2_linux.2/bin/ruby: cannot execute binary file=20
=20
(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.

--=20
No virus found in this outgoing message.
Checked by 'grep -i virus $MESSAGE'
Trust me.

--9UV9rz0O2dU/yYYn
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7-ecc0.1.6 (GNU/Linux)

iD8DBQFGS0MHsnU0scoWZKARAmAfAJ9uCv55SPCH4lnSyLy2pEuy8CuiwQCg0Xxg
NqvlA74kgECnft4Kfu2u4bc=
=NOt2
-----END PGP SIGNATURE-----

--9UV9rz0O2dU/yYYn--
 
A

Axel Etzold

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 :(
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 Haklev <[email protected]>
An: (e-mail address removed)
Betreff: Re: Ruby distribution woes - bz2 lib and mongrel
 
S

Stian Haklev

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,983
Messages
2,570,187
Members
46,747
Latest member
jojoBizaroo

Latest Threads

Top