# Rubyscript2exe windows executables, on Linux

**URL:** <https://www.ruby-forum.com/t/rubyscript2exe-windows-executables-on-linux/134631>\
**Category:** Ruby\
**Created:** [April 13, 2008, 5:25am UTC](https://www.ruby-forum.com/t/rubyscript2exe-windows-executables-on-linux/134631 "2008-04-13T05:25:48Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [April 13, 2008, 5:25am UTC](https://www.ruby-forum.com/t/rubyscript2exe-windows-executables-on-linux/134631/1 "2008-04-13T05:25:48Z")

</div>

I’ve downloaded rubyscript2exe, and:

$ ruby rubyscript2exe.rb HelloWorld.rb

will create a file called HelloWorld\_linux which runs on linux.

The problem is that I’m trying to make a single .exe for windows  
users.

I rm -rf’d the script, and then used ruby gems to install  
rubyscript2exe (although it was stored only on my /var partition and  
had to be moved to my /usr/local/bin) and it produced the same result.

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [April 13, 2008, 7:28am UTC](https://www.ruby-forum.com/t/rubyscript2exe-windows-executables-on-linux/134631/2 "2008-04-13T07:28:16Z")

</div>

I don’t think you can do that. Try running it under Wine.

It bundles ruby.exe and friends into an executable package. Obviously  
Linux systems do not contains ruby.exe. There are probably other issues  
as well.

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [April 13, 2008, 7:44am UTC](https://www.ruby-forum.com/t/rubyscript2exe-windows-executables-on-linux/134631/3 "2008-04-13T07:44:15Z")

</div>

-----BEGIN PGP SIGNED MESSAGE-----  
Hash: SHA1

K. wrote:  
| I’ve downloaded rubyscript2exe, and:  
|  
| $ ruby rubyscript2exe.rb HelloWorld.rb  
|  
| will create a file called HelloWorld\_linux which runs on linux.  
|  
| The problem is that I’m trying to make a single .exe for windows  
| users.  
|  
| I rm -rf’d the script, and then used ruby gems to install  
| rubyscript2exe (although it was stored only on my /var partition and  
| had to be moved to my /usr/local/bin) and it produced the same result.

Compile Ruby with the MinGW32 cross compiler tools. AS to how to obtain  
it, check your distro (`yum install mingw32-tools`, or some such thing).

The wxWidgets (_not_ the wxRuby folks!) have an entry on how to use  
MinGW32 to compile a windows binary:

See [Cross-Compiling Under Linux - WxWiki](http://wiki.wxwidgets.org/Cross-Compiling_Under_Linux)

* * *

Phillip G.  
Twitter: [twitter.com/cynicalryan](http://twitter.com/cynicalryan)

~ The purpose of writing is to inflate weak ideas, obscure pure  
reasoning, and  
inhibit clarity. With a little practice, writing can be an intimidating  
and  
impenetrable fog! – Calvin  
-----BEGIN PGP SIGNATURE-----  
Version: GnuPG v1.4.8 (MingW32)  
Comment: Using GnuPG with Mozilla - [http://enigmail.mozdev.org](http://enigmail.mozdev.org)

iEYEARECAAYFAkgBnY0ACgkQbtAgaoJTgL9VGQCgm/zKbRrtqB8dT5gXUaKJhCQo  
0C0An1UBwn6YoYq6G2jswiyS6QCphjgd  
=M/qF  
-----END PGP SIGNATURE-----

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [April 13, 2008, 1:57pm UTC](https://www.ruby-forum.com/t/rubyscript2exe-windows-executables-on-linux/134631/4 "2008-04-13T13:57:20Z")

</div>

On 13 Apr 2008, at 04:25, K. wrote:

> rubyscript2exe (although it was stored only on my /var partition and  
> had to be moved to my /usr/local/bin) and it produced the same result.

If you alternately pack the executable using 7za.exe (from the extras  
distribution) and p7zip, you can easily achieve this by compressing  
and then:

cp 7za.exe myapp.exe  
cat archive.7z \>\> myapp.exe

or on windows, use copy /b.

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [April 14, 2008, 9:15am UTC](https://www.ruby-forum.com/t/rubyscript2exe-windows-executables-on-linux/134631/5 "2008-04-14T09:15:39Z")

</div>

Sorry, I meant to post:

god@box:~$ ruby -v  
ruby 1.8.5 (2006-08-25) [i486-linux]

Running Debian Etch.

I only have an 8GB HDD, so installing wine was a last resort, but  
thanks for the help.

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [April 13, 2008, 8:33pm UTC](https://www.ruby-forum.com/t/rubyscript2exe-windows-executables-on-linux/134631/6 "2008-04-13T20:33:43Z")

</div>

> I don’t think you can do that. Try running it under Wine.

I actually _think_ it is possible but I never tried it on my own.

After all, one can cross-compile on Linux, for a windows system.

So I am pretty confident that all this _should_ work, but I never tried,  
and would probably not manage anyway - but someone out there would  
definitely manage 🙂

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [April 14, 2008, 11:52am UTC](https://www.ruby-forum.com/t/rubyscript2exe-windows-executables-on-linux/134631/7 "2008-04-14T11:52:18Z")

</div>

On Mon, Apr 14, 2008 at 9:15 AM, K. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Sorry, I meant to post:
> 
> god@box:~$ ruby -v  
> ruby 1.8.5 (2006-08-25) [i486-linux]
> 
> Running Debian Etch.
> 
> I only have an 8GB HDD, so installing wine was a last resort, but  
> thanks for the help.

I think it is possible to generate rubyscript2exe files on unix, BUT:  
you’ll need to rewrite dependency collecting.  
It works by running the program and collecting all required files  
(including the dll files). Since most probably you cannot  
run the script under windows, you have to collect the files manually.  
[1] show the generated file structure.

If you solve this problem, please let Erik know about it. He might be  
interested.

[1] [http://www.erikveen.dds.nl/rubyscript2exe/#2.1.0](http://www.erikveen.dds.nl/rubyscript2exe/#2.1.0)

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [April 14, 2008, 1:44pm UTC](https://www.ruby-forum.com/t/rubyscript2exe-windows-executables-on-linux/134631/8 "2008-04-14T13:44:41Z")

</div>

RubyScript2Exe can’t cross compile directly. However…

It’s possible to run Ruby for Windows on top of Wine on top of  
Linux. And it’s possible to run Ruby for Windows on Windows in  
a virtual machine (e.g. VirtualBox) on top of Linux. In both  
cases (depending on which virtual machine you’re using), you  
can access your native file system with your Ruby scripts.

RubyScript2Exe works in both cases.

I used to use the Wine option, but nowadays, I use the  
VirtualBox option.

gegroet,  
Erik V. - [http://www.erikveen.dds.nl/](http://www.erikveen.dds.nl/)
