larsch/ocra

No such file or directory @ rb_sysopen - ruby2_keywords.rb (Errno::ENOENT)

Closed this issue · 3 comments

OS
Windows 10 Pro

ruby -v
ruby 2.7.0p0 (2019-12-25 revision 647ee6f091) [x64-mingw32]

test.rb
puts "hello"

c:\ok> ocra .\test.rb

=== Loading script to check dependencies
hello
=== Attempting to trigger autoload of Gem::Licenses
=== Attempting to trigger autoload of Gem::DependencyList
=== Attempting to trigger autoload of Gem::Installer
=== Attempting to trigger autoload of Gem::SpecFetcher
=== Attempting to trigger autoload of Gem::SourceList
=== Attempting to trigger autoload of Gem::ConfigFile
=== Attempting to trigger autoload of RubyInstaller::Runtime::Components::Base
=== WARNING: RubyInstaller::Runtime::Components::Base was defined autoloadable, but caused NameError
=== Attempting to trigger autoload of RubyInstaller::Runtime::Colors
=== Attempting to trigger autoload of RubyInstaller::Runtime::ComponentsInstaller
=== Attempting to trigger autoload of RubyInstaller::Runtime::Ridk
=== Attempting to trigger autoload of RubyInstaller::Runtime::PACKAGE_VERSION
=== Attempting to trigger autoload of CGI::HtmlExtension
=== Detected gem did_you_mean-1.4.0 (loaded, files)
===     0 files, 0 bytes
=== Detected gem ocra-1.3.10 (loaded, files)
===     5 files, 210830 bytes
=== Detected gem uri-0.10.0 (loaded, files)
===     0 files, 0 bytes
=== Detected gem fileutils-1.4.1 (loaded, files)
===     0 files, 0 bytes
=== Detected gem ipaddr-1.2.2 (loaded, files)
===     0 files, 0 bytes
=== Detected gem openssl-2.1.2 (loaded, files)
===     0 files, 0 bytes
=== Detected gem stringio-0.1.0 (loaded, files)
===     0 files, 0 bytes
=== Detected gem zlib-1.1.0 (loaded, files)
===     0 files, 0 bytes
=== Detected gem delegate-0.1.0 (loaded, files)
===     0 files, 0 bytes
=== Detected gem etc-1.1.0 (loaded, files)
===     0 files, 0 bytes
=== Detected gem timeout-0.1.0 (loaded, files)
===     0 files, 0 bytes
=== Detected gem date-3.0.0 (loaded, files)
===     0 files, 0 bytes
=== Detected gem cgi-0.1.0 (loaded, files)
===     0 files, 0 bytes
=== Detected gem fiddle-1.0.0 (loaded, files)
===     0 files, 0 bytes
=== Detected gem rake-13.0.1 (loaded, files)
===     51 files, 127713 bytes
=== Detected gem singleton-0.1.0 (loaded, files)
===     0 files, 0 bytes
=== Detected gem ostruct-0.2.0 (loaded, files)
===     0 files, 0 bytes
=== Including 61 encoding support files (3832320 bytes, use --no-enc to exclude)
D:/dev/ruby/Ruby27-x64/lib/ruby/gems/2.7.0/gems/ocra-1.3.10/bin/ocra:997: warning: Win32API is deprecated after Ruby 1.9.1; use fiddle directly instead
=== Building test.exe
=== Adding user-supplied source files
Traceback (most recent call last):
        11: from D:/dev/ruby/Ruby27-x64/lib/ruby/gems/2.7.0/gems/ocra-1.3.10/bin/ocra:1203:in `block in <top (required)>'
        10: from D:/dev/ruby/Ruby27-x64/lib/ruby/gems/2.7.0/gems/ocra-1.3.10/bin/ocra:868:in `build_exe'
         9: from D:/dev/ruby/Ruby27-x64/lib/ruby/gems/2.7.0/gems/ocra-1.3.10/bin/ocra:868:in `new'
         8: from D:/dev/ruby/Ruby27-x64/lib/ruby/gems/2.7.0/gems/ocra-1.3.10/bin/ocra:1041:in `initialize'
         7: from D:/dev/ruby/Ruby27-x64/lib/ruby/gems/2.7.0/gems/ocra-1.3.10/bin/ocra:1041:in `open'
         6: from D:/dev/ruby/Ruby27-x64/lib/ruby/gems/2.7.0/gems/ocra-1.3.10/bin/ocra:1057:in `block in initialize'
         5: from D:/dev/ruby/Ruby27-x64/lib/ruby/gems/2.7.0/gems/ocra-1.3.10/bin/ocra:871:in `block in build_exe'
         4: from D:/dev/ruby/Ruby27-x64/lib/ruby/gems/2.7.0/gems/ocra-1.3.10/bin/ocra:871:in `each'
         3: from D:/dev/ruby/Ruby27-x64/lib/ruby/gems/2.7.0/gems/ocra-1.3.10/bin/ocra:887:in `block (2 levels) in build_exe'
         2: from D:/dev/ruby/Ruby27-x64/lib/ruby/gems/2.7.0/gems/ocra-1.3.10/bin/ocra:1158:in `createfile'
         1: from D:/dev/ruby/Ruby27-x64/lib/ruby/gems/2.7.0/gems/ocra-1.3.10/bin/ocra:1158:in `open'
D:/dev/ruby/Ruby27-x64/lib/ruby/gems/2.7.0/gems/ocra-1.3.10/bin/ocra:1158:in `initialize': No such file or directory @ rb_sysopen - C:/ok/ruby2_keywords.rb (Errno::ENOENT)

I created an empty ruby2_keywords.rb and then ocra compiled my script just fine. It would be great though to find an actual solution :)

It looks like ruby2_keywords.rb has been added as a core ruby feature in 2.7.0.

Calling ruby --disable-all -e 'puts $LOADED_FEATURES' returns:

enumerator.so
thread.rb
rational.so
complex.so
ruby2_keywords.rb
C:/Ruby/Ruby27-x64/lib/ruby/2.7.0/x64-mingw32/enc/encdb.so
C:/Ruby/Ruby27-x64/lib/ruby/2.7.0/x64-mingw32/enc/trans/transdb.so
C:/Ruby/Ruby27-x64/lib/ruby/2.7.0/x64-mingw32/enc/windows_1252.so

This file is nowhere to be found and ocra feature collection interprets it as relative to cwd.

Ruby 2.6.5 does not list this file.

So yeah, until @larsch comes back we will have to live with switching back to 2.6.5 or the monkey patch mentioned in my previous comment.