Rubyscript2exe / hiki

Hello,

Currently it is not easy to use rubyscript2exe to make an EXE

containing a ruby-gtk2 application on win32.
on the ruby-gnome2 site, there is a HOWTO:
http://ruby-gnome2.sourceforge.jp/hiki.cgi?tips_rubyscript2exe

But it is really complicated, requires touching your ruby directory,

your ruby application, and personally I didn’t succeed in making it
work. I wanted to update that page, adding a second solution I managed
to make work. Here is the text that I wrote for the Hiki (before I
realised I need a login to write on it):


== rubyscript2exe on Windows, solution 2

Another solution is to copy all the needed files inside the temporary
directory created by rubyscript2exe, each time the application starts.
You put all the needed GTK files and folders in a subfolder of your
source code, and copy those files in the rubyscript2exe directory at
startup. That way, you don’t have to touch your ruby installation or
make it possible to run your ruby program from any folder.

Let’s create a “run_dep” folder under the folder where you have the
source code of your application.
In that folder, copy the etc/, lib/ and share/ from your GTK
installation. The GTK installation is in c:\gtk or C:\Program
Files\Common Files\GTK\2.0. You can safely remove the “doc” and
“gtk-doc” subfolders of the “share”, to save some space.
In share\locale, you can remove the locales you don’t need if you want,
to save more space (locales take ~20Mb). You can remove all the contents
of the share\locale folder if you want, the english/US is always
shipped.
For me, I could also remove *.lib in lib (10Mb), and lib\locale (15Mb).

Then, add the following lines at the start of your main .rb file:

require ‘rubyscript2exe’
require ‘fileutils’
require ‘pathname’

p0 = Pathname.new(RUBYSCRIPT2EXE.appdir)
root_runtime = p0.parent.to_s
begin
FileUtils.cp_r(‘run_dep/.’, root_runtime)
rescue
end

Those lines copy all the files & folders inside the “run_dep” folder to
the folder where rubyscript2exe will extract your application. The
begin/rescue is needed because that fails when you run your application
the first time in rubyscript2exe, to create the .exe.

Regenerate your application, and run the exe… it should work now!

In the end, to ship my application I need 6Mb exe and 1.26Mb “run_dep”,
plus the glade files. And it seems no GTK installation is needed on the
target computer!

If someone thinks it's a useful addtion to the Hiki, could someone

add it (or give me a password)? Thanks!

emmanuel


Using Tomcat but need to do more? Need to support web services,
security?
Get stuff done quickly with pre-integrated technology to make your job
easier.
Download IBM WebSphere Application Server v.1.0.1 based on Apache
Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642

Hi!

I’m glad this project was born.
I’ve tried experimenting, and run into the following:

I have GTK 2.10.6 runtime environment

I’ve installed ruby 185-21 one click installer.
I’ve installed ruby-gnome with GTK and without registering environment
variables.

I’ve created an executable following your description.
However, I copied the files from your gtk bin, which is in a ruby
subfolder.

Then I ran the exe, and get a nasty: entry point not found in dll.
Not closing that dialog, and peeking into $TEMP, I realized, that the
dlls of MY gtk runtime environment was used.

Did I do something wrong?

Gergo


±[ Gergely K. [email protected] ]------------------+
| |
| Mobile:(+36 20)356 9656 |
| |
± “Olyan lángész vagyok, hogy poroltóval kellene járnom!” -+


Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net’s Techsay panel and you’ll get the chance to share
your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

Gergo,

Not sure of your exact problem, but you might try this thread for ideas:
http://sourceforge.net/mailarchive/message.php?msg_id=14765482

Curtis

Gergely K. wrote:


Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net’s Techsay panel and you’ll get the chance to share
your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

Hello,

Ah, you’re using the “run_dep” method, not the first one, i thought you
were using the first one. I wrote the FAQ about the run_dep method, so
I’ll answer that.

WITH gtk runtime, without setting PATH

Just a note: when I used the run_dep method, I installed the GTK from
gladewin32 as suggested by the ruby-gnome2 developers, and installed
ruby-gtk2 through the ZIP not the installer. So our different setups are
probably the reason why it doesn’t work for you. But I don’t understand
why right now.
The code that you added to the main ruby application is pretty
transparent: it copies the GTK DLLs that you put in run_dep to the
temporary directory where your application will run. Normally when using
that method, the EXE will run even if GTK is not installed on the target
computer, however you must ship the run_dep folder with the EXE.

What exactly appears in the folder where the application is running?
which files are present?

emmanuel

PS: maybe we can continue that conversation in private mail, so that we
don’t send too much on the list


Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net’s Techsay panel and you’ll get the chance to share
your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

Hi!

Thanks for the reply.

I’ve searched for iconv.dll, and all have the same size.

So I’ll try to explain more elaborate.

To reproduce the problem:

  1. Install gtk runtime 2.10.6 from here
    http://gimp-win.sourceforge.net/stable.html
  2. Install ruby 185-21
  3. Install ruby-gnome2 from here
    Download ruby-gnome2-0.16.0-1-i386-mswin32.exe (Ruby-GNOME 2)
    WITH gtk runtime, without setting PATH
  4. Create a hello world app
  5. copy under run_dep the folders mentioned from the ruby dir
  6. run rubyscript2exe (app starts correctly)
  7. run the freshly created exe
  8. do not press ok to the error dialog
  9. locate your app in $TEMP and compare the mentioned dll with the one
    in the ruby dir. They’ll differ.

If I understand correctly the guide, ruby should always find the
installed gtk in the ruby-gnome2 package. But this is not the case.

On 2/20/07, Curtis S. [email protected] wrote:

However, I copied the files from your gtk bin, which is in a ruby subfolder.


±[ Gergely K. [email protected] ]------------------+
| |
| Mobile:(+36 20)356 9656 |
| |
± “Olyan lángész vagyok, hogy poroltóval kellene járnom!” -+


Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net’s Techsay panel and you’ll get the chance to share
your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

Hello,

Ok, removed the other GTK, and letting ruby-gnome2-s GTK set the
environment variable solves this problem.

The next one is the problem with pango:

(app starts, but letters are squares :frowning:

So, after off-list discussion with Gergely K., we discovered that
having GTK installed from the GIMP installer causes problems with that
method of using rubyscript2exe. The solution is not to have GTK
installed from the gimp-win32 project; you can run GIMP with no problems
with the gladewin32 GTK.

I updated the rubyscript2exe wiki page with that text:

Note: that method will work if the target computer has no GTK
installed or the gladewin32 GTK. If the user installed the GTK that
comes with gimp for windows, it will not work, because that version of
GTK will be used instead of the one that comes with your program, and
that version does not work well. In that case, the best is for the
user to uninstall that special version of GTK and use the gladewin32
version, which works fine with GIMP (and GAIM) on windows, and allows
running such ruby-gtk2 programs.
emmanuel


Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net’s Techsay panel and you’ll get the chance to share
your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

Ok, removed the other GTK, and letting ruby-gnome2-s GTK set the
environment variable solves this problem.

The next one is the problem with pango:

(app starts, but letters are squares :frowning:

Creating runs fine, but when I try to execute the exe I get:
t:/tmp/eee.hello.exe.2/lib/rubygems/custom_require.rb: line 27
Pango-WARNING **:No builtin or dynamically
loaded modules were found. Pango will not work correctly.
This probably means there was an error in the creation of:
‘t:\tmp\eee.hello.exe.2\etc\pango\pango.modules’
You should create this file by running pango-querymodules.
t:/tmp/eee.hello.exe.2/lib/rubygems/custom_require.rb: line 27
Pango-WARNING **:pango_shape called with bad font, expect ugly output
t:/tmp/eee.hello.exe.2/lib/rubygems/custom_require.rb: line 27
Pango-WARNING **:pango_font_get_glyph_extents called with bad font,
expect ug
ly output
t:/tmp/eee.hello.exe.2/lib/rubygems/custom_require.rb: line 27
Pango-WARNING **:pango_font_get_font_map called with bad font, expect
ugly ou
tput
t:/tmp/eee.hello.exe.2/lib/rubygems/custom_require.rb: line 27
Pango-CRITICAL **:_pango_cairo_font_map_get_renderer: assertion
PANGO_IS_CAI RO_FONT_MAP (fontmap)' failed t:/tmp/eee.hello.exe.2/lib/rubygems/custom_require.rb: line 27 Pango-WARNING **:_pango_cairo_font_install called with bad font, expect ugly output t:/tmp/eee.hello.exe.2/lib/rubygems/custom_require.rb: line 27 Pango-CRITICAL **:_pango_cairo_font_map_get_renderer: assertion PANGO_IS_CAI
RO_FONT_MAP (fontmap)’ failed
t:/tmp/eee.hello.exe.2/lib/rubygems/custom_require.rb: line 27
Pango-CRITICAL **:_pango_cairo_font_map_get_renderer: assertion
PANGO_IS_CAI RO_FONT_MAP (fontmap)' failed t:/tmp/eee.hello.exe.2/lib/rubygems/custom_require.rb: line 27 Pango-CRITICAL **:_pango_cairo_font_map_get_renderer: assertion PANGO_IS_CAI
RO_FONT_MAP (fontmap)’ failed
t:/tmp/eee.hello.exe.2/lib/rubygems/custom_require.rb: line 27
Pango-CRITICAL **:_pango_cairo_font_map_get_renderer: assertion
PANGO_IS_CAI RO_FONT_MAP (fontmap)' failed t:/tmp/eee.hello.exe.2/lib/rubygems/custom_require.rb: line 27 Pango-CRITICAL **:_pango_cairo_font_map_get_renderer: assertion PANGO_IS_CAI
RO_FONT_MAP (fontmap)’ failed
t:/tmp/eee.hello.exe.2/lib/rubygems/custom_require.rb: line 27
Pango-CRITICAL **:_pango_cairo_font_map_get_renderer: assertion
`PANGO_IS_CAI
RO_FONT_MAP (fontmap)’ failed


±[ Gergely K. [email protected] ]------------------+
| |
| Mobile:(+36 20)356 9656 |
| |
± “Olyan lángész vagyok, hogy poroltóval kellene járnom!” -+


Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net’s Techsay panel and you’ll get the chance to share
your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

Thanks, the problem is solved (workaround), I installed the
gladewin32’s gtk, and it works with GIMP also.
And Emmanuel updated the FAQ.
It seems that ruby-gnome2’s gtk is not used, if it is not on the PATH.

On 2/22/07, Masao M. [email protected] wrote:

(app starts, but letters are squares :frowning:

http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV


ruby-gnome2-devel-en mailing list
[email protected]
ruby-gnome2-devel-en List Signup and Options


±[ Gergely K. [email protected] ]------------------+
| |
| Mobile:(+36 20)356 9656 |
| |
± “Olyan lángész vagyok, hogy poroltóval kellene járnom!” -+


Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net’s Techsay panel and you’ll get the chance to share
your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

Hi,

On Wed, 21 Feb 2007 10:38:44 +0100
“Gergely K.” [email protected] wrote:

loaded modules were found. Pango will not work correctly.
You need to run GTK/bin/reconfig.bat first.
It makes the configuration files where the modules are.

I don’t have any knowhow about rubyscript2exe …,

If it includes all of c:\ruby and extract it a new tempolary directory,
you need to call (the new directory/lib/GTK/bin/reconfig.bat), before
executing ruby program.

HTH,


Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net’s Techsay panel and you’ll get the chance to share
your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

I am encountering the exact problem the Gergely encountered but the
solutions that were previously mentioned are not working. I installed
gladeWin32 from
http://gladewin32.sourceforge.net/modules/news/ and I followed the
directions mentioned by Emmanuel to no avail. Does anyone know of any
other reason this would happen?

Gergely K. wrote:

Thanks, the problem is solved (workaround), I installed the
gladewin32’s gtk, and it works with GIMP also.
And Emmanuel updated the FAQ.
It seems that ruby-gnome2’s gtk is not used, if it is not on the PATH.

On 2/22/07, Masao M. [email protected] wrote:

(app starts, but letters are squares :frowning:

http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV


ruby-gnome2-devel-en mailing list
[email protected]
ruby-gnome2-devel-en List Signup and Options


±[ Gergely K. [email protected] ]------------------+
| |
| Mobile:(+36 20)356 9656 |
| |
± “Olyan l�ng�sz vagyok, hogy porolt�val kellene j�rnom!” -+


Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net’s Techsay panel and you’ll get the chance to share
your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV