rubyocra

Can't run exes made with ocra -- FATAL ERROR: Failed to create process


I'm trying to package a Ruby program as an .exe on a Windows computer using OCRA. When I tried to use it to create the executable for my program, it threw a weird error at runtime. I tried it with a simple Hello World program, and the error persisted.

I put the following in helloworld.rb:

puts "Hello, World!"

Then, I ran the file through OCRA:

H:\ocra test>ocra --no-dep-run helloworld.rb
=== Detected gem did_you_mean-1.1.0 (loaded, files)
===     14 files, 32780 bytes
=== Detected gem ocra-1.3.8 (loaded, files)
===     5 files, 291748 bytes
=== Including 59 encoding support files (3918740 bytes, use --no-enc to exclude)

=== Building helloworld.exe
=== Adding user-supplied source files
=== Adding ruby executable ruby.exe
=== Adding detected DLL C:/Ruby24-x64/bin/ruby_builtin_dlls/libgmp-10.dll
=== Adding detected DLL C:/Ruby24-x64/bin/ruby_builtin_dlls/libffi-6.dll
=== Adding library files
=== Compressing 7908093 bytes
=== Finished building helloworld.exe (1919669 bytes)

However, when I tried to run this executable, I got the following message:

H:\ocra test>helloworld.exe
FATAL ERROR: Failed to create process (C:\Users\[username]\AppData\Local\Temp\ocr9C6D.tmp\bin\ruby.exe): 14001

Note: This is not a duplicate of this person's question which has the same error message. I am unable to run the EXE on the computer that generated it, whereas the person who asked the linked question was having issues running it on other computers.

Here are the versions of Ruby and OCRA, both of which I believe are the latest version:

H:\ocra test>ruby --version
ruby 2.4.1p111 (2017-03-22 revision 58053) [x64-mingw32]
H:\ocra test>ocra --version
Ocra 1.3.8

I'm on Windows 7 Professional 64 bit.

I also tried running it without the --no-dep-run flag, running the exe on my C: drive instead of H:, and running it in a command prompt with local administrator privileges. All gave the same error message.

How do I fix this?


Solution

  • I was able to fix the issue by uninstalling Ruby and installing an older version (namely 2.3.3) via RubyInstaller. There seems to be an issue with 2.4.1 and ocra. I tested on a couple of fresh computers, and 2.4.1 didn't work even with a fresh install.