# Creating "windows binaries" on Linux

**URL:** <https://www.ruby-forum.com/t/creating-windows-binaries-on-linux/64471>\
**Category:** Ruby\
**Created:** [January 23, 2006, 4:44pm UTC](https://www.ruby-forum.com/t/creating-windows-binaries-on-linux/64471 "2006-01-23T16:44:29Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![giom](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/e56c9b/32.png) [@giom](https://www.ruby-forum.com/u/giom)\
**Post date:** [January 23, 2006, 4:44pm UTC](https://www.ruby-forum.com/t/creating-windows-binaries-on-linux/64471/1 "2006-01-23T16:44:29Z")

</div>

There was some discussion about packing Windows executable with  
tar2rubyscript and rubyscript2exe from a Linux box. Wine was proposed  
but I publicly dismissed with the claimed that it didn’t support WinXP  
calls (and thus not win32-utils). ruby-talk:172349

But I was wrong. wine DOES support WinXP calls, ruby and win32-utils. I  
am right now building a cross-platform application with wine 0.9.5, ruby  
1.8.2 (one click installer) and wxruby, all from my Linux machine.  
tar2rubyscript and rubyscript2exe were installed from gems. Here is what  
my rakefile looks like:

* * *

DIST = “deviceproxy2”

task :default =\> [:run\_windows]

task :run\_linux do  
ruby “init.rb”  
end

task :run\_windows do  
sh ‘wine ruby init.rb’  
end

task :pre\_build do  
sh “rm -f #{DIST}.tar #{DIST}.tar.gz”  
sh “darcs dist -d ‘#{DIST}’”  
sh “gunzip #{DIST}.tar.gz”  
end

task :build\_linux =\> [:pre\_build] do  
sh “tar2rubyscript #{DIST}.tar”  
sh “rubyscript2exe #{DIST}.rb”  
end

## task :build\_windows =\> [:pre\_build] do sh \<\<EOF unset TMPDIR wine ruby ‘C:\ruby\bin\tar2rubyscript’ --tar2rubyscript-preserve #{DIST}.tar wine ruby ‘C:\ruby\bin\rubyscript2exe’ #{DIST}.rb EOF end

The only gotcha is --tar2rubyscript-preserve. For some reason, when  
running tar2rubyscript with wine, it fails with an error:

* * *

## c:\windows\temp\tar2rubyscript.d.66.1\tar2rubyscript\tar.exe: Cannot add file _._: No such file or directory

Using a tar ball and --tar2rubyscript-preserve skips this step and  
everything is cool.

Maybe someone will find this information useful,  
Guillaume.

---

<div class="post-metadata">

**Author:** ![giom](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/e56c9b/32.png) [@giom](https://www.ruby-forum.com/u/giom)\
**Post date:** [January 25, 2006, 9:59am UTC](https://www.ruby-forum.com/t/creating-windows-binaries-on-linux/64471/2 "2006-01-25T09:59:28Z")

</div>

> I am right now building a cross-platform application with  
> wine 0.9.5, ruby 1.8.2 (one click installer) and wxruby, all  
> from my Linux machine.

So, cross-compiling wihth RubyScript2Exe is possible? Nice! 🙂

> For some reason, when running tar2rubyscript with wine, it  
> fails with an error:

You can build the RBA with Tar2RubyScript on Linux, even when  
the result will be used in the above mentioned cross-compile  
step. There’s no need to build the RBA on the (faked) target  
platform.

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

---

<div class="post-metadata">

**Author:** ![giom](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/e56c9b/32.png) [@giom](https://www.ruby-forum.com/u/giom)\
**Post date:** [January 25, 2006, 6:06pm UTC](https://www.ruby-forum.com/t/creating-windows-binaries-on-linux/64471/3 "2006-01-25T18:06:36Z")

</div>

Le 25 janv. 06, à 03:58, Erik V. a écrit :

> > I am right now building a cross-platform application with  
> > wine 0.9.5, ruby 1.8.2 (one click installer) and wxruby, all  
> > from my Linux machine.
> 
> So, cross-compiling wihth RubyScript2Exe is possible? Nice! 🙂

Yeah, kind of cool. Thanks for your good work.

Looking back at it, my first attempt was unsuccessful probably because  
of my wine installation and my lack of understanding of wine. After a  
fresh compile/install of wine, things went much smoother.

> > For some reason, when running tar2rubyscript with wine, it  
> > fails with an error:
> 
> You can build the RBA with Tar2RubyScript on Linux, even when  
> the result will be used in the above mentioned cross-compile  
> step. There’s no need to build the RBA on the (faked) target  
> platform.

Good to know, thanks.

Guillaume.
