Rubyscript2exe problem


#1

Hi all,

This is my first post so forgive me if step on any forum conventions.
I’m not a programmer in any real sense - I just like playing around.
However I’ve managed to build an app that helps me do my work. Other
people in my workplace have now expressed interest in using the app.

I’m trying to convert the ruby app to .exe using the rubyscript2exe gem.

everytime I try I get this:

C:/Ruby/lib/ruby/gems/1.8/gems/rubyscript2exe-0.5.3/bin/rubyscript2exe:5:in
replace': can't modify frozen string (TypeError) from C:/Ruby/lib/ruby/gems/1.8/gems/rubyscript2exe-0.5.3/bin/rubyscript2exe:5 from C:/Ruby/bin/rubyscript2exe:19:inload’
from C:/Ruby/bin/rubyscript2exe:19

The command I run is: rubyscript2exe application.rb
I’m running this from command prompt whilst in the directory containing
the .rb file.

tried updating all gems, completely reinstalling Ruby to the most recent
installation and still have this problem.

I’m assuming that this is caused by some simple oversight. Any
suggestions would be greatly appreciated. :slight_smile:


#2

http://www.ruby-forum.com/topic/170355

http://letmegooglethatforyou.com/?q=rubyscript2exe+modify+frozen+string


#3

The Higgs bozo wrote:

http://www.ruby-forum.com/topic/170355

http://letmegooglethatforyou.com/?q=rubyscript2exe+modify+frozen+string

I have already tried the solution in the first link (see above where I
mention that I have tried a complete reinstall of Ruby) as well as all
others that I could find on google but thanks very much for your helpful
response.

I’m only asking for help because I’ve been unable to find a solution
that worked after several hours of trying.


#4

I’m only asking for help because I’ve been unable to find a solution
that worked after several hours of trying.

Hope you tried the one mentioned at

http://rha7dotcom.blogspot.com/2008/09/rubyscript2exerb-and-623-cant-modify.html

Meanwhile it may also be worthwhile to check out crate for your
packaging needs (see below)

saji

From: Jeremy H. removed_email_address@domain.invalid
Subject: [ANN] crate 0.1.1 Released
To: ruby-talk ML removed_email_address@domain.invalid
Reply-To: removed_email_address@domain.invalid
Mail-Followup-To: Ruby T. removed_email_address@domain.invalid
Date: Tue, 2 Dec 2008 02:12:02 +0900
User-Agent: Mutt/1.5.16 (2007-06-09)
Message-Id: removed_email_address@domain.invalid

I’m pleased to announce that Crate, the project I spoke on at RubyConf
this year, has reached a releasable stage.

gem install crate

Crate is a tool to help package up your application as a custom static
build of the ruby interpreter plus all dependant binary extensions.
All the pure ruby code (the ruby application, the ruby stdlib, etc) is
packed into one or more SQLite databases.

The final distributable pieces are a single executable and a few SQLite
databases which can be then wrapped up appropriately as an OS X App; a
self extracting executable for Windows; a shar archive, rpm or tarball
for Unixes.

Project: http://copiousfreetime.rubyforge.org/crate/
Tutorial:
http://copiousfreetime.org/articles/2008/11/30/package-an-application-
with-crate.html


Posted via http://www.ruby-forum.com/.


Saji N. Hameed

APEC Climate Center +82 51 668 7470
National Pension Corporation Busan Building 12F
Yeonsan 2-dong, Yeonje-gu, BUSAN 611705 removed_email_address@domain.invalid
KOREA


#5

Saji N. Hameed wrote:

I’m only asking for help because I’ve been unable to find a solution
that worked after several hours of trying.

Hope you tried the one mentioned at

http://rha7dotcom.blogspot.com/2008/09/rubyscript2exerb-and-623-cant-modify.html

Meanwhile it may also be worthwhile to check out crate for your
packaging needs (see below)

saji

Hi Saji

Thanks for the response.

Yes I have tried the solution in the link and it didn’t make any
noticable difference (the actual line it refers to wasn’t exactly where
the solution says it’s supposed to be so I figure its refering to an
older version - i tried the fix regardless).

As for Crate - thanks for the tip. I’ll give it a go. :slight_smile:


#6

On Wed, Dec 03, 2008 at 07:45:38PM +0900, Mew Shew wrote:

Yes I have tried the solution in the link and it didn’t make any
noticable difference (the actual line it refers to wasn’t exactly where
the solution says it’s supposed to be so I figure its refering to an
older version - i tried the fix regardless).

As for Crate - thanks for the tip. I’ll give it a go. :slight_smile:

This sounds like a perfect opportunity to use crate on windows. Please
let me
know how I can help, I have yet to distribute a windows application with
it.
And I want to make sure windows is supported, feel free to contact me on
or off
list and we can get you up and running.

enjoy,

-jeremy


#7

Mew Shew wrote:

The Higgs bozo wrote:

http://www.ruby-forum.com/topic/170355

http://letmegooglethatforyou.com/?q=rubyscript2exe+modify+frozen+string

I have already tried the solution in the first link (see above where I
mention that I have tried a complete reinstall of Ruby)

You said that you installed “to the most recent installation”, but the
first link suggests not using the most recent. Are you sure you tried
ruby186-26.exe? Your error is exactly the same as the one myself and
others had, which was solved by going back to that version.


#8

Jeremy H. wrote:

This sounds like a perfect opportunity to use crate on windows. Please
let me
know how I can help, I have yet to distribute a windows application with
it.
And I want to make sure windows is supported, feel free to contact me on
or off
list and we can get you up and running.

enjoy,

-jeremy

Hey Jeremy,

Thanks very much for the response. I thought your name looked familiar.
I’ve been reading through the crate tutorial on your website.

I extremely keen to get my app working as a self-contained executable
but have so far been unsucessful. I followed your tutorial and hit a
problem quite early. See below:

C:>gem install crate
Successfully installed crate-0.1.1
1 gem installed
Installing ri documentation for crate-0.1.1…
Installing RDoc documentation for crate-0.1.1…

C:>crate -v
C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in
gem_original_require': no such file to load -- logging (LoadError) from C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:inrequire’
from C:/Ruby/lib/ruby/gems/1.8/gems/crate-0.1.1/lib/crate.rb:7
from
C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in
gem_original_require' from C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:inrequire’
from
C:/Ruby/lib/ruby/gems/1.8/gems/crate-0.1.1/lib/crate/main.rb:1
from
C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in
gem_original_require' from C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:inrequire’
from C:/Ruby/lib/ruby/gems/1.8/gems/crate-0.1.1/bin/crate:7
from C:/Ruby/bin/crate:19:in `load’
from C:/Ruby/bin/crate:19

C:>

I can’t help but get the impression that there is something that I’m
doing wrong or something wrong with my installation (though I have
reinstalled Ruby and all gems with the same result).

If you can provide any insight or assistence it would be greatly
appreciated. :slight_smile:


#9

The Higgs bozo wrote:

Mew Shew wrote:

The Higgs bozo wrote:

http://www.ruby-forum.com/topic/170355

http://letmegooglethatforyou.com/?q=rubyscript2exe+modify+frozen+string

I have already tried the solution in the first link (see above where I
mention that I have tried a complete reinstall of Ruby)

You said that you installed “to the most recent installation”, but the
first link suggests not using the most recent. Are you sure you tried
ruby186-26.exe? Your error is exactly the same as the one myself and
others had, which was solved by going back to that version.

I realised that the version of Ruby on my home PC was ruby186-26, tried
it out and it worked. Thanks a bunch.


#10

On Fri, Dec 05, 2008 at 01:35:03PM +0900, Mew Shew wrote:

enjoy,
problem quite early. See below:
from
C:/Ruby/lib/ruby/gems/1.8/gems/crate-0.1.1/lib/crate/main.rb:1
C:>

I can’t help but get the impression that there is something that I’m
doing wrong or something wrong with my installation (though I have
reinstalled Ruby and all gems with the same result).

If you can provide any insight or assistence it would be greatly
appreciated. :slight_smile:

No, this is my mistake, I forgot to include logging as a gem dependency.
if you run ‘gem install logging’ then this error will clear up. I’ll
push a new
version of crate out by monday that has this fix in it.

enjoy,

-jeremy


#11

The Higgs bozo wrote:

http://www.ruby-forum.com/topic/170355

http://letmegooglethatforyou.com/?q=rubyscript2exe+modify+frozen+string

This fix is not reliable; assignment to $0 doesn’t reallocate it’s
buffer, hence the new string may be truncated.

Try this in a file test.rb:

10.times do
$0 = $0 + “.”
puts “#{$0} (#{$0.size})”
end

You’ll see the output:

ruby test.rb
test.rb. (8)
test.rb… (9)
test.rb… (10)
test.rb… (11)
test.rb… (11)
test.rb… (11)
test.rb… (11)
test.rb… (11)
test.rb… (11)
test.rb… (11)
Exit code: 0

The fix is to alias $0:

$progname = $0
alias $PROGRAM_NAME $0
alias $0 $progname

10.times do
$0 = $0 + “.”
puts “#{$0} (#{$0.size})”
end

The output is then correct:

ruby test.rb
test.rb. (8)
test.rb… (9)
test.rb… (10)
test.rb… (11)
test.rb… (12)
test.rb… (13)
test.rb… (14)
test.rb… (15)
test.rb… (16)
test.rb… (17)
Exit code: 0

See http://github.com/cowlibob/rubyscript2exe for the complete fixed
script.

Cowlibob.