Forum: Ruby Re: Trouble running 'rubyscript2exe' for compiling my code

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Jacob Lyles (Guest)
on 2008-11-19 22:46
(Received via mailing list)
I'm also trying to solve the dreaded (RC=256) error when I try to
compile using Rubyscript2exe.

As I understand the problem, Ruby has an imposed limit of 256
characters for commands passed to Ruby (Tell me if my understanding is
incorrect).

With the circular dependencies problem mentioned previously
<https://groups.google.com/group/ruby-talk-google/b...,
rubygems unnecessarily bulks up the Rubyscript2exe compile command
with repeated requires which cause the compile to fail.

I have require "rubygems" as the first line of my init.rb.

I've also tried the "set RUYBOPT=" command (Yes, Eric this works to
unset RUYBOPT on Windows).

I've added
----------
if ENV['RUBYOPT'] and defined? Gem then
  ENV.delete 'RUBYOPT'
end
----------

to the beginning of init.rb (Just before require 'rubygems' )

I  also tried moving my files further up the directory tree (closer to
root-closer to C:\ for you Windows users) so that the paths to the
files I require are shorter.

But, I'm still unable to compile my app (HelloWorld *does* compile
since it's much simpler than my app)

On Aug 1, 2:54 pm, "Erik V." <removed_email_address@domain.invalid> wrote:
> Question: Is it possible to investigate the exact order in which
> libraries are required correctly?

My latest attempt was to try to track down the order of the requires
in my app to see exactly where the repeated requires are being made
(and in what order). For this, I turned to a snibbit of code via
<http://snippets.dzone.com/posts/show/6237>:
----------
require 'logger'

 class Object
    def require(file_name)
      output = "requiring #{file_name}"
      puts output
      log = Logger.new(File.join(File.dirname(__FILE__),
'required.log'))
      log.debug(output)
      super
    end
  end
----------

This spits out a list of 250 calls to requires for my app.
Consolidating and eliminating the repeats, this should actually be 188
and eliminating the calls to modules within requires (like requiring
date/format when date has already been called), further reduces the
*actual* requires to 43 for my app. A quick test of a "HelloWorld"
with requires of Rubygems, logger, and rubyscript2exe has 4 requires
with one repeat.

Obviously, this taly doesn't include whatever is required by rubygems
itself and logger before the actual logging kicks in.

Now, my next question is: Where do I/we go from here?

Is there a way to capture and slim down the command passed off to ruby
to gather up the requires for rubyscript2exe (eliminating
redundancies)?

Or does someone else have another idea?

Thanks,

Jacob
This topic is locked and can not be replied to.