Compiling Ruby code

If it is a meaningful additions to this list, I'd like to say that thse
projects exist -

Groovy
http://groovy.codehaus.org/

Jruby
http://jruby.sourceforge.net/

Groovy might be of interst because it is a ruby like language that is
compiled ot the JVM. The understand being that if it can be compiled to
the JVM, it can be compiled to native code. It is a powerful flexible
language like ruby with proper iterator and closure support.

However, as far as I understand, eval style dynamic compilation is not
yet supported.

I really agree with your sentiment about wanting to compile ruby
programs for the purpose of redistribution. That's the problem with all
the ruby code out there - there is no way I can redistribute it without
asking people download the ruby interpreter.
And they they go "whats that ?... " and the whole story telling process
starts.

Taking ruby to a popular VM/runtime or native code, IMHO would be a big
big addition to the acceptibility of the language. I understand that
that it is a mind boggling amount of work to do this, in any acceptible
way.

Regards
Roshan James

InterScan_Disclaimer.txt (520 Bytes)

I really agree with your sentiment about wanting to compile ruby
programs for the purpose of redistribution. That's the problem with all
the ruby code out there - there is no way I can redistribute it without
asking people download the ruby interpreter.
And they they go "whats that ?... " and the whole story telling process
starts.

As has been said before, there _is_ a way to redistribute your
application without asking people to download the
interpreter... Actually, there are 2 ways, the first one is called
Exerb and the second one is called RubyScript2Exe.

I made a very small test application in ruby, turned it into one
executable with RubyScript2Exe, then i used HM NIS Edit to make an
initial script for NSIS (Nullsoft Scriptable Install System), which
gave me a simple "Setup.exe". I have to admit it was a very, very
simple thing, but still it surprised me that it went so easy to make a
good looking installer for it. The only thing the user has to do, is
to run the "setup.exe", no need to even talk about ruby.

RubyScript2Exe http://www.erikveen.dds.nl/rubyscript2exe/index.html
NSIS http://nsis.sourceforge.net/
HM NIS Edit http://hmne.sourceforge.net/

Taking ruby to a popular VM/runtime or native code, IMHO would be a big
big addition to the acceptibility of the language. I understand that
that it is a mind boggling amount of work to do this, in any acceptible
way.

I don't really understand why you think it would be a problem to ask
the user to install the ruby interpreter (the one-click installer),
since you seem to think it would not be a problem to ask the user to
first install for example a JVM to run a Java program... ?

That being said, I would love to see a compiler (to bytecode or to
native code) for ruby too, but then who doesn't ?

Ruben

···

At Tue, 20 Jul 2004 18:50:43 +0900, James, Roshan (Cognizant) wrote:

Ruben wrote:

>
> I really agree with your sentiment about wanting to compile ruby
> programs for the purpose of redistribution. That's the problem with all
> the ruby code out there - there is no way I can redistribute it without
> asking people download the ruby interpreter.
> And they they go "whats that ?... " and the whole story telling process
> starts.

As has been said before, there _is_ a way to redistribute your
application without asking people to download the
interpreter... Actually, there are 2 ways, the first one is called
Exerb and the second one is called RubyScript2Exe.

These are excellent solutions. Unfortunately, they only work for Windows.
I'm not aware of anything comparable for Mac or 'nix systems.

I made a very small test application in ruby, turned it into one
executable with RubyScript2Exe, then i used HM NIS Edit to make an
initial script for NSIS (Nullsoft Scriptable Install System), which
gave me a simple "Setup.exe". I have to admit it was a very, very
simple thing, but still it surprised me that it went so easy to make a
good looking installer for it. The only thing the user has to do, is
to run the "setup.exe", no need to even talk about ruby.

RubyScript2Exe http://www.erikveen.dds.nl/rubyscript2exe/index.html
NSIS http://nsis.sourceforge.net/
HM NIS Edit http://hmne.sourceforge.net/

> Taking ruby to a popular VM/runtime or native code, IMHO would be a big
> big addition to the acceptibility of the language. I understand that
> that it is a mind boggling amount of work to do this, in any acceptible
> way.

I don't really understand why you think it would be a problem to ask
the user to install the ruby interpreter (the one-click installer),
since you seem to think it would not be a problem to ask the user to
first install for example a JVM to run a Java program... ?

Again, this would be a Windows-only solution.

Anyone who wants to take this approach can do it without the one-click
installer -- you can just install a private version of Ruby used only to run
your app. FreeRIDE does this for its Windows installation (and we have been
considering doing this for other platforms). If you want to see how this
works, install FreeRIDE on windows and take a look at the startup script
"run.bat".

That being said, I would love to see a compiler (to bytecode or to
native code) for ruby too, but then who doesn't ?

Me, too! Anyone who is really interested in this and has some available time
should considering helping the Cardinal project get ruby working with the
Parrot VM.

Curt

···

At Tue, 20 Jul 2004 18:50:43 +0900, > James, Roshan (Cognizant) wrote:

These are excellent solutions. Unfortunately, they only work for Windows.
I'm not aware of anything comparable for Mac or 'nix systems.

Yep, you are right, it would be interesting to have tools similar as
Exerb and RubyScript2Exe for Mac, Linux and BSD systems. And an
installer on those platforms would also be nice (maybe Loki
installer).

> I don't really understand why you think it would be a problem to ask
> the user to install the ruby interpreter (the one-click installer),
> since you seem to think it would not be a problem to ask the user to
> first install for example a JVM to run a Java program... ?

Again, this would be a Windows-only solution.

Wasn't it mentioned before on the list that work is planned/ongoing
for making a one-click installer on other platforms ?

Anyone who wants to take this approach can do it without the one-click
installer -- you can just install a private version of Ruby used only to run
your app. FreeRIDE does this for its Windows installation (and we have been
considering doing this for other platforms). If you want to see how this
works, install FreeRIDE on windows and take a look at the startup script
"run.bat".

If i would 'package' a ruby application for linux, then i would either
do as you said (the ruby interpreter is not that big and then you're
sure your application runs on the ruby version you tested/developed it
on), or either i would make a package (ebuild for Gentoo, rpm for
redhat/mandrake, deb for debian) that depends on the ruby-package
(this has the advantage that you can easily upgrade the ruby
interpreter for better performance, bugfixes,...).

(Now that i think about it, most commercial java-applications do
include a specific JVM in the installation, don't they ?)

> That being said, I would love to see a compiler (to bytecode or to
> native code) for ruby too, but then who doesn't ?

Me, too! Anyone who is really interested in this and has some available time
should considering helping the Cardinal project get ruby working with the
Parrot VM.

".. has some available time..." i think that's the biggest problem
for a lot of people... Even if you're knowledgeable enough about
compilers, then it still takes some time to 'get into' the Cardinal
project and see what they have and how things work, before you can
really contribute to it. (at least, that's how i feel about it)

Ruben

···

At Tue, 20 Jul 2004 21:36:25 +0900, Curt Hibbs wrote:

Under Mac OS X an application presents itself as an executable file, but is in fact a package (i.e. directory). Inside the package is the real executable and any resources (help files, images, sounds, icons, GUI configuration files (nib files), etc.) it needs. It would be easy to include the ruby interpreter and any libraries you need within the package together with your ruby files so I think exerb and friends are probably not needed.

You may even be able to omit the interpreter as Ruby 1.6 is installed as standard (I may be wrong, but I don't think it is part of the developer tools).

Dave.

···

On 20 Jul 2004, at 14:56, Ruben wrote:

At Tue, 20 Jul 2004 21:36:25 +0900, > Curt Hibbs wrote:

These are excellent solutions. Unfortunately, they only work for Windows.
I'm not aware of anything comparable for Mac or 'nix systems.

Yep, you are right, it would be interesting to have tools similar as
Exerb and RubyScript2Exe for Mac, Linux and BSD systems. And an
installer on those platforms would also be nice (maybe Loki
installer).

Ruben wrote:

Wasn't it mentioned before on the list that work is planned/ongoing
for making a one-click installer on other platforms ?

There is no actual work going on. What you read was my desire to add more
platforms to the Ruby Installer project and my call for help in doing so. So
far there have been no volunteers.

Curt

I think it's possible to make a RubyScript2Exe for Linux. Even
cross-compiling (both ways) isn't impossible. Are you really
interested? Would take only a couple of hours... I always
assumed that every Linux distribution comes with Ruby. Maybe
not pre-installed, but at least on CD. So I didn't spend any
time on this issue.

The problem with Linux is how to determine which dependencies
are to be distributed in the binary. On my system (RH8), Ruby
(the core and *.so) needs at least the following files (both
direct and indirect):

/lib/ld-linux.so.2
/lib/libNoVersion.so.1
/lib/libc.so.6
/lib/libcrypt.so.1
/lib/libdl.so.2
/lib/libgcc_s.so.1
/lib/libm.so.6
/lib/libnss_files.so.2
/usr/lib/libgdbm.so.2
/usr/lib/libncurses.so.5
/usr/lib/libreadline.so.4

Can I assume that these are available on all modern
distributions, so I only need to distribute /usr/bin/ruby and
/usr/lib/libruby.so.1.6 (besides the "application-specific"
stripped rubylib tree)? What about the versions? Is 1.8 more
complex? How can I test on several distributions,
cross-distribution? Anybody?

gegroet,
Erik V.

···

On Tue, 20 Jul 2004 22:56:11 +0900, Ruben wrote:

At Tue, 20 Jul 2004 21:36:25 +0900, Curt Hibbs wrote:

> These are excellent solutions. Unfortunately, they only
> work for Windows. I'm not aware of anything comparable for
> Mac or 'nix systems.

Yep, you are right, it would be interesting to have tools
similar as Exerb and RubyScript2Exe for Mac, Linux and BSD
systems. And an installer on those platforms would also be
nice (maybe Loki installer).

It would be easy
to include the ruby interpreter and any libraries
you need within the
package together with your ruby files so I think
exerb and friends are
probably not needed.

That is not the point of having a native compiler. The
point of it is to include it into projects which do
not want the compiler. For example I wanted to include
a ruby script in this OS, but they said they do not
want interpreted languages in the base install. This
also has to do with not wanting to install the ruby
software. That is why I am making a decision. --David
Ross

···

__________________________________
Do you Yahoo!?
Vote for the stars of Yahoo!'s next ad campaign!
http://advision.webevents.yahoo.com/yahoo/votelifeengine/

Hello Erik,

The problem with Linux is how to determine which dependencies
are to be distributed in the binary. On my system (RH8), Ruby
(the core and *.so) needs at least the following files (both
direct and indirect):

/lib/ld-linux.so.2
/lib/libNoVersion.so.1
/lib/libc.so.6
/lib/libcrypt.so.1
/lib/libdl.so.2
/lib/libgcc_s.so.1
/lib/libm.so.6
/lib/libnss_files.so.2
/usr/lib/libgdbm.so.2
/usr/lib/libncurses.so.5
/usr/lib/libreadline.so.4

Can I assume that these are available on all modern
distributions, so I only need to distribute /usr/bin/ruby and
/usr/lib/libruby.so.1.6 (besides the "application-specific"
stripped rubylib tree)? What about the versions? Is 1.8 more
complex? How can I test on several distributions,
cross-distribution? Anybody?

Read Chapter 3 from

http://www.linuxbase.org/modules.php?name=specrev&url=http://www.linuxbase.org/spec/booksets/LSB-Core/LSB-Core.html

···

--
Best regards, emailto: scholz at scriptolutions dot com
Lothar Scholz http://www.ruby-ide.com
CTO Scriptolutions Ruby, PHP, Python IDE 's

Dave Baldwin wrote:

You may even be able to omit the interpreter as Ruby 1.6 is installed as standard (I may be wrong, but I don't think it is part of the developer tools).

This is correct. 1.6 ships with panther and up, 1.8 will be in tiger.

···

--
Rando Christensen
<eyez@illuzionz.org>

Hello Lothar,

Hello Erik,

The problem with Linux is how to determine which dependencies
are to be distributed in the binary. On my system (RH8), Ruby
(the core and *.so) needs at least the following files (both
direct and indirect):

/lib/ld-linux.so.2
/lib/libNoVersion.so.1
/lib/libc.so.6
/lib/libcrypt.so.1
/lib/libdl.so.2
/lib/libgcc_s.so.1
/lib/libm.so.6
/lib/libnss_files.so.2
/usr/lib/libgdbm.so.2
/usr/lib/libncurses.so.5
/usr/lib/libreadline.so.4

Can I assume that these are available on all modern
distributions, so I only need to distribute /usr/bin/ruby and
/usr/lib/libruby.so.1.6 (besides the "application-specific"
stripped rubylib tree)? What about the versions? Is 1.8 more
complex? How can I test on several distributions,
cross-distribution? Anybody?

Read Chapter 3 from

http://www.linuxbase.org/modules.php?name=specrev&url=http://www.linuxbase.org/spec/booksets/LSB-Core/LSB-Core.html

Sorry hit the send button to quickly.
/lib/ld-linux.so.2 is AFAIK always absolutely addressed for security
reasons so you can't change it with your own LD_LIBRARY_PATH accessible lib.
And never bundle libgdbm.so.2/libreadline.so.4 without an explicit
request from the user. They are GPL not LGPL.

···

--
Best regards, emailto: scholz at scriptolutions dot com
Lothar Scholz http://www.ruby-ide.com
CTO Scriptolutions Ruby, PHP, Python IDE 's