Forum: Ruby Ocra: "Failed to create directory"

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.
Da33a4ac652c1c8900392a8599206640?d=identicon&s=25 Thomas B. (tpreal)
on 2009-05-26 21:34
Hello.

I was trying to use Ocra with Ruby 1.9.1 on Windows. It creates the
executable but then when I try to run it, all I get is "Failed to create
directory" on the console, and the program finishes. It's hard to find
any info about this error, so I'm asking if any of you happened to
encounter and solve this problem, and could share their solution?

Thanks
TPR.
08995c0e987a0b6d452a791369f96370?d=identicon&s=25 Alex (Guest)
on 2009-05-26 21:56
(Received via mailing list)
I ran across this blog post that details some of common errors with
Ocra,
which mentions the error that you stated:

http://rubyonwindows.blogspot.com/2009/05/ocra-com...

Hope that is of some help.


Alex
Da33a4ac652c1c8900392a8599206640?d=identicon&s=25 Thomas B. (tpreal)
on 2009-05-26 22:10
Alex wrote:
> http://rubyonwindows.blogspot.com/2009/05/ocra-com...

Thanks, but unfortunately this does not help. Also I tried both the gem
version and the standalone version of Ocra, with the same error.
E7cff3cfd41c495e1012227d7dc24202?d=identicon&s=25 Luis Lavena (luislavena)
on 2009-05-27 02:24
(Received via mailing list)
On May 26, 5:10 pm, "Thomas B." <tpr...@gmail.com> wrote:
> Alex wrote:
> >http://rubyonwindows.blogspot.com/2009/05/ocra-com......
>
> Thanks, but unfortunately this does not help. Also I tried both the gem
> version and the standalone version of Ocra, with the same error.

Can you provide more information about the version of Ruby, RubyGems
and application/script you're trying to package?

is more easy to find the issues if you provide more information about
your environment. "Doesn't work" don't say too much.

ruby -v

gem env

Windows OS version?

If you can reproduce a simple "hello world" with the same problem,
will be great.
Da33a4ac652c1c8900392a8599206640?d=identicon&s=25 Thomas B. (tpreal)
on 2009-05-27 10:43
Luis Lavena wrote:
> Can you provide more information about the version of Ruby, RubyGems
> and application/script you're trying to package?

ruby 1.9.1p0 (2009-01-30 revision 21907) [i386-mswin32]

ocra (1.0.3)

Windows XP SP3

  - RUBYGEMS VERSION: 1.3.3
  - RUBY VERSION: 1.9.1 (2009-01-30 patchlevel 0) [i386-mswin32]
  - RUBYGEMS PLATFORMS:
    - ruby
    - x86-mswin32-60
  - GEM CONFIGURATION:
     - :update_sources => true
     - :verbose => true
     - :benchmark => false
     - :backtrace => false
     - :bulk_threshold => 1000

> If you can reproduce a simple "hello world" with the same problem,
> will be great.

A simple "hello world" program works like it should. If I require and
use any of the files from the standard library (like 'matrix',
'rexml/document') it still works. Now if I require a gem file: for
'syntax' (1.0.0) it works, and for 'log4r'  (1.0.5) it fails with:

C:/DOCUME~1/TPReal/USTAWI~1/Temp/seb3B.tmp/src/_hello.rb:2:in `require':
no such
 file to load -- log4r (LoadError)
        from
C:/DOCUME~1/TPReal/USTAWI~1/Temp/seb3B.tmp/src/_hello.rb:2:in `<mai
n>'

I do require 'rubygems' before 'log4r' in my script.

And to get the "Failed to create directory" error, I need to require my
custom library file, which is located in D:\Ruby\_Files, and is
accessible because "D:/Ruby/_Files" is stored in RUBYLIB environment
variable. Passing it as -I to ruby gives the same result.

Each time I run ocra I get WARNING: Couldn't find enumerator.so. This is
because $"[0] is "enumerator.so" (no full path). I don't know why but I
feel it is not a problem here.

Another question: is it possible with Ocra to include some static
content in the package? I cannot find any info about that.
E7cff3cfd41c495e1012227d7dc24202?d=identicon&s=25 Luis Lavena (luislavena)
on 2009-05-27 13:40
(Received via mailing list)
On May 27, 5:43 am, "Thomas B." <tpr...@gmail.com> wrote:
>   - RUBYGEMS VERSION: 1.3.3
>
>  file to load -- log4r (LoadError)
>
> Each time I run ocra I get WARNING: Couldn't find enumerator.so. This is
> because $"[0] is "enumerator.so" (no full path). I don't know why but I
> feel it is not a problem here.

That is really helpful information Thomas.

In case you're aren't aware, I've been working on a MinGW based
version of Ruby.

Right now, 1.9.1-p129 for mingw32 include all the missing pieces
required to actually run Ruby 1.9 on Windows.

Would you mind try using it instead of mswin32 version?

With the MinGW version, I never got the enumerator.so warning and no
problem with RubyGems at all.

Please see the following posts in my blog about download links and
instructions:

http://blog.mmediasys.com/2009/05/05/rubyinstaller...
http://blog.mmediasys.com/2009/05/17/rubyinstaller...
http://blog.mmediasys.com/2009/05/19/pure-ruby-rea...

>
> Another question: is it possible with Ocra to include some static
> content in the package? I cannot find any info about that.

I think is not, It doesn't assume the current directory or the
directory where the original executable is located, contrary to
RubyScript2Exe which plays with LOAD_PATH.

Maybe the following tips help you out:

http://rubyonwindows.blogspot.com/2009/05/ocra-com...

Please check the mingw32 version and issues with it, and I'll really
love to help you out.
556b0d97becaee7823b8434ca2efd56c?d=identicon&s=25 Domenic P. (domenic)
on 2010-02-24 22:31
I just ran into this exact problem. I fixed my particular problem. Here
is what I did.

I found that I could compile some scripts (even complex ones) but not
others. I finally realized what the problem was. It appears ocra can't
handle if your script changes the working directory in the script. I
believe orca should save the directory it is run in and then reference
that directory but it apparently assumes the directory you start your
script in is the same directory when it finishes. In my case, I am
changing the directory.

in my case, I can reproduce this issue with the following code.

#start of script
puts Dir.pwd
dir = "d:/" #Dir.pwd produces "c:\" so I changed to another drive
(another directory will produce same result)
Dir.chdir(dir)
puts Dir.pwd
puts "script complete"
#end of script

I am not by any means an expert Ruby developer so I'm sure much of my
nomenclature isn't correct but this is what I did to fix my problem.

thanks,
Domenic



Thomas B. wrote:
> Hello.
>
> I was trying to use Ocra with Ruby 1.9.1 on Windows. It creates the
> executable but then when I try to run it, all I get is "Failed to create
> directory" on the console, and the program finishes. It's hard to find
> any info about this error, so I'm asking if any of you happened to
> encounter and solve this problem, and could share their solution?
>
> Thanks
> TPR.
556b0d97becaee7823b8434ca2efd56c?d=identicon&s=25 Domenic P. (domenic)
on 2010-02-24 23:09
Just to be clear, the following runs correctly after compiling:

puts Dir.pwd
olddir = Dir.pwd
dir = "d:\\"
Dir.chdir(dir)
puts Dir.pwd
Dir.chdir(olddir)
puts Dir.pwd
puts "script complete"


whereas this code does not run correctly after compiling.

puts Dir.pwd
olddir = Dir.pwd
dir = "d:\\"
Dir.chdir(dir)
puts Dir.pwd
puts "script complete"

Domenic P. wrote:
> I just ran into this exact problem. I fixed my particular problem. Here
> is what I did.
>
> I found that I could compile some scripts (even complex ones) but not
> others. I finally realized what the problem was. It appears ocra can't
> handle if your script changes the working directory in the script. I
> believe orca should save the directory it is run in and then reference
> that directory but it apparently assumes the directory you start your
> script in is the same directory when it finishes. In my case, I am
> changing the directory.
>
> in my case, I can reproduce this issue with the following code.
>
> #start of script
> puts Dir.pwd
> dir = "d:/" #Dir.pwd produces "c:\" so I changed to another drive
> (another directory will produce same result)
> Dir.chdir(dir)
> puts Dir.pwd
> puts "script complete"
> #end of script
>
> I am not by any means an expert Ruby developer so I'm sure much of my
> nomenclature isn't correct but this is what I did to fix my problem.
>
> thanks,
> Domenic
>
>
>
> Thomas B. wrote:
>> Hello.
>>
>> I was trying to use Ocra with Ruby 1.9.1 on Windows. It creates the
>> executable but then when I try to run it, all I get is "Failed to create
>> directory" on the console, and the program finishes. It's hard to find
>> any info about this error, so I'm asking if any of you happened to
>> encounter and solve this problem, and could share their solution?
>>
>> Thanks
>> TPR.
This topic is locked and can not be replied to.