So i am trying to build a standalone .exe from my ruby script with ocra:
#test.rb
require "rubygems"
require "net/ssh"
$hostname = "1.1.1.1"
$username = "root"
$password = "example"
Net::SSH.start($hostname, $username, password: $password, non_interactive: true) do |ssh|
ssh.exec!("exit")
end
puts "Successful!"
When i try to build the executable with ocra using the command ocra --dll ruby_builtin_dlls\libssp-0.dll --console --no-autoload --add-all-core test.rb
i get following output:
=== Loading script to check dependencies
Successful!
=== Detected gem did_you_mean-1.4.0 (loaded, files)
=== 0 files, 0 bytes
=== Detected gem ocra-1.3.11 (loaded, files)
=== 5 files, 271800 bytes
=== Detected gem uri-0.10.0 (loaded, files)
=== 0 files, 0 bytes
=== Detected gem net-ssh-6.1.0 (loaded, files)
=== 83 files, 384755 bytes
=== Detected gem logger-1.4.2 (loaded, files)
=== 0 files, 0 bytes
=== Detected gem etc-1.1.0 (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 strscan-1.0.3 (loaded, files)
=== 0 files, 0 bytes
=== Detected gem delegate-0.1.0 (loaded, files)
=== 0 files, 0 bytes
=== Detected gem zlib-1.1.0 (loaded, files)
=== 0 files, 0 bytes
=== Detected gem io-console-0.5.6 (loaded, files)
=== 0 files, 0 bytes
=== Detected gem fiddle-1.0.0 (loaded, files)
=== 0 files, 0 bytes
=== Including 61 encoding support files (3642880 bytes, use --no-enc to exclude)
=== Will include all ruby core libraries
=== Building test.exe
=== Adding user-supplied source files
=== Adding ruby executable ruby.exe
=== Adding detected DLL C:/Users/UAC7FE/Ruby27-x64/bin/ruby_builtin_dlls/libgmp-10.dll
=== Adding detected DLL C:/Users/UAC7FE/Ruby27-x64/bin/ruby_builtin_dlls/libffi-7.dll
=== Adding detected DLL C:/Users/UAC7FE/Ruby27-x64/bin/ruby_builtin_dlls/ZLIB1.dll
=== Adding external manifest C:/Users/UAC7FE/Ruby27-x64/bin/ruby_builtin_dlls/ruby_builtin_dlls.manifest
=== Adding supplied DLL ruby_builtin_dlls\libssp-0.dll
=== Adding library files
=== Compressing 24627069 bytes
LZMA 19.00 (x86) : Igor Pavlov : Public domain : 2019-02-21
Input size: 24627069 (23 MiB)
Output size: 4498148 (4 MiB)
=== Finished building test.exe (4548856 bytes)
Ocra tells me that the executable has been created Successfully, but when i try to execute it i get this output:
Traceback (most recent call last):
2: from C:/Users/UAC7FE/AppData/Local/Temp/ocrEF8E.tmp/src/test.rb:2:in `<main>'
1: from C:/Users/UAC7FE/AppData/Local/Temp/ocrEF8E.tmp/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:92:in `require'
C:/Users/UAC7FE/AppData/Local/Temp/ocrEF8E.tmp/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:92:in `require': cannot load such file -- net/ssh (LoadError)
21: from C:/Users/UAC7FE/AppData/Local/Temp/ocrEF8E.tmp/src/test.rb:2:in `<main>'
20: from C:/Users/UAC7FE/AppData/Local/Temp/ocrEF8E.tmp/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:156:in `require'
19: from C:/Users/UAC7FE/AppData/Local/Temp/ocrEF8E.tmp/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:168:in `rescue in require'
18: from C:/Users/UAC7FE/AppData/Local/Temp/ocrEF8E.tmp/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:168:in `require'
17: from C:/Users/UAC7FE/AppData/Local/Temp/ocrEF8E.tmp/lib/ruby/gems/2.7.0/gems/net-ssh-6.1.0/lib/net/ssh.rb:12:in `<top (required)>'
16: from C:/Users/UAC7FE/AppData/Local/Temp/ocrEF8E.tmp/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:92:in `require'
15: from C:/Users/UAC7FE/AppData/Local/Temp/ocrEF8E.tmp/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:92:in `require'
14: from C:/Users/UAC7FE/AppData/Local/Temp/ocrEF8E.tmp/lib/ruby/gems/2.7.0/gems/net-ssh-6.1.0/lib/net/ssh/transport/session.rb:6:in `<top (required)>'
13: from C:/Users/UAC7FE/AppData/Local/Temp/ocrEF8E.tmp/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:92:in `require'
12: from C:/Users/UAC7FE/AppData/Local/Temp/ocrEF8E.tmp/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:92:in `require'
11: from C:/Users/UAC7FE/AppData/Local/Temp/ocrEF8E.tmp/lib/ruby/gems/2.7.0/gems/net-ssh-6.1.0/lib/net/ssh/transport/algorithms.rb:1:in `<top (required)>'
10: from C:/Users/UAC7FE/AppData/Local/Temp/ocrEF8E.tmp/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:92:in `require'
9: from C:/Users/UAC7FE/AppData/Local/Temp/ocrEF8E.tmp/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:92:in `require'
8: from C:/Users/UAC7FE/AppData/Local/Temp/ocrEF8E.tmp/lib/ruby/gems/2.7.0/gems/net-ssh-6.1.0/lib/net/ssh/buffer.rb:1:in `<top (required)>'
7: from C:/Users/UAC7FE/AppData/Local/Temp/ocrEF8E.tmp/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:92:in `require'
6: from C:/Users/UAC7FE/AppData/Local/Temp/ocrEF8E.tmp/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:92:in `require'
5: from C:/Users/UAC7FE/AppData/Local/Temp/ocrEF8E.tmp/lib/ruby/gems/2.7.0/gems/net-ssh-6.1.0/lib/net/ssh/transport/openssl.rb:1:in `<top (required)>'
4: from C:/Users/UAC7FE/AppData/Local/Temp/ocrEF8E.tmp/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:92:in `require'
3: from C:/Users/UAC7FE/AppData/Local/Temp/ocrEF8E.tmp/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:92:in `require'
2: from C:/Users/UAC7FE/AppData/Local/Temp/ocrEF8E.tmp/lib/ruby/2.7.0/openssl.rb:13:in `<top (required)>'
1: from C:/Users/UAC7FE/AppData/Local/Temp/ocrEF8E.tmp/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:92:in `require'
C:/Users/UAC7FE/AppData/Local/Temp/ocrEF8E.tmp/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:92:in `require': 126: The specified module could not be found. - C:/Users/UAC7FE/AppData/Local/Temp/ocrEF8E.tmp/lib/ruby/2.7.0/x64-mingw32/openssl.so (LoadError)
I am very confused because i cannot pin down the problem. It seems that it cannot load net-ssh and openssl.so(?), but why?
Does anyone know what i am doing wrong? Thanks in advance!