Issue with Ocra and win32/api
concaho opened this issue · 1 comments
Hi Guys,
Need your help because I am blocked with a strange issue.
I can't make an Exe with
require("au3") in a rb file.
I think the problem comes from au3 is depending of win32/api
So I did a reproducer with win32/api.
OCRA was able a long time ago to make the script. But I had the ruby 2.3.0...
See a little reproducer:
Create a .rb file with these lines;
#beginningofthescript
puts ENV['GEM_PATH']
ENV['GEM_PATH']='C:/Ruby30/lib/ruby/gems/3.0.0'
ENV['GEM_HOME']='C:/Ruby30/lib/ruby/gems/3.0.0'
Gem.clear_paths
puts ENV['GEM_PATH']
require("win32/api")
#Endofthescript
C:\Users\concaho>ruby LaunchWorkstationTest.rb
C:/Ruby30/lib/ruby/gems/3.0.0
C:\Users\concaho>
Do the same with ocra:
C:\Users\concaho>ocra LaunchWorkstationTest.rb
=== Loading script to check dependencies
C:/Ruby30/lib/ruby/gems/3.0.0
=== Detected gem etc-1.3.0 (loaded, files)
=== 0 files, 0 bytes
=== Detected gem did_you_mean-1.5.0 (loaded, files)
=== 0 files, 0 bytes
=== Detected gem ocra-1.3.11 (loaded, files)
=== 5 files, 271800 bytes
=== Detected gem win32-api-1.10.1-universal-mingw32 (loaded, files)
=== 29 files, 1112578 bytes
=== Including 61 encoding support files (3707392 bytes, use --no-enc to exclude)
=== Building LaunchWorkstationTest.exe
=== Adding user-supplied source files
=== Adding ruby executable ruby.exe
=== Adding detected DLL C:/Ruby30/bin/ruby_builtin_dlls/libgmp-10.dll
=== Adding detected DLL C:/Ruby30/bin/ruby_builtin_dlls/libgcc_s_dw2-1.dll
=== Adding detected DLL C:/Ruby30/msys32/mingw32/bin/libssp-0.dll
=== Adding detected DLL C:/Ruby30/bin/ruby_builtin_dlls/libwinpthread-1.dll
=== Adding detected DLL C:/Ruby30/bin/ruby_builtin_dlls/libffi-8.dll
=== Adding external manifest C:/Ruby30/bin/ruby_builtin_dlls/ruby_builtin_dlls.manifest
=== Adding library files
=== Compressing 11024601 bytes
LZMA 19.00 (x86) : Igor Pavlov : Public domain : 2019-02-21
Input size: 11024601 (10 MiB)
Output size: 2594406 (2 MiB)
=== Finished building LaunchWorkstationTest.exe (2645114 bytes)
Launch now the LaunchWorkstationTest.exe:
C:\Users\concaho>LaunchWorkstationTest.exe
C:\Users\concaho~1\AppData\Local\Temp\1\ocr6FA7.tmp\gemhome
C:/Ruby30/lib/ruby/gems/3.0.0
<internal:C:/Users/concaho~1/AppData/Local/Temp/1/ocr6FA7.tmp/lib/ruby/3.0.0/rubygems/core_ext/kernel_require.rb>:85:in `require': cannot load such file -- C:/Ruby30/lib/ruby/gems/3.0.0/gems/win32-api-1.10.1-universal-mingw32/lib/win32/../../ext/api (LoadError)
from <internal:C:/Users/concaho~1/AppData/Local/Temp/1/ocr6FA7.tmp/lib/ruby/3.0.0/rubygems/core_ext/kernel_require.rb>:85:in `require'
from C:/Ruby30/lib/ruby/gems/3.0.0/gems/win32-api-1.10.1-universal-mingw32/lib/win32/api.rb:79:in `rescue in <top (required)>'
from C:/Ruby30/lib/ruby/gems/3.0.0/gems/win32-api-1.10.1-universal-mingw32/lib/win32/api.rb:2:in `<top (required)>'
from <internal:C:/Users/concaho~1/AppData/Local/Temp/1/ocr6FA7.tmp/lib/ruby/3.0.0/rubygems/core_ext/kernel_require.rb>:160:in `require'
from <internal:C:/Users/concaho~1/AppData/Local/Temp/1/ocr6FA7.tmp/lib/ruby/3.0.0/rubygems/core_ext/kernel_require.rb>:160:in `rescue in require'
from <internal:C:/Users/concaho~1/AppData/Local/Temp/1/ocr6FA7.tmp/lib/ruby/3.0.0/rubygems/core_ext/kernel_require.rb>:149:in `require'
from C:/Users/concaho~1/AppData/Local/Temp/1/ocr6FA7.tmp/src/LaunchWorkstationTest.rb:7:in `<main>'
<internal:C:/Users/concaho~1/AppData/Local/Temp/1/ocr6FA7.tmp/lib/ruby/3.0.0/rubygems/core_ext/kernel_require.rb>:85:in `require': 126: The specified module could not be found. - C:/Ruby30/lib/ruby/gems/3.0.0/gems/win32-api-1.10.1-universal-mingw32/lib/win32/ruby30_32/win32/api.so (LoadError)
from <internal:C:/Users/concaho~1/AppData/Local/Temp/1/ocr6FA7.tmp/lib/ruby/3.0.0/rubygems/core_ext/kernel_require.rb>:85:in `require'
from C:/Ruby30/lib/ruby/gems/3.0.0/gems/win32-api-1.10.1-universal-mingw32/lib/win32/api.rb:73:in `<top (required)>'
from <internal:C:/Users/concaho~1/AppData/Local/Temp/1/ocr6FA7.tmp/lib/ruby/3.0.0/rubygems/core_ext/kernel_require.rb>:160:in `require'
from <internal:C:/Users/concaho~1/AppData/Local/Temp/1/ocr6FA7.tmp/lib/ruby/3.0.0/rubygems/core_ext/kernel_require.rb>:160:in `rescue in require'
from <internal:C:/Users/concaho~1/AppData/Local/Temp/1/ocr6FA7.tmp/lib/ruby/3.0.0/rubygems/core_ext/kernel_require.rb>:149:in `require'
from C:/Users/concaho~1/AppData/Local/Temp/1/ocr6FA7.tmp/src/LaunchWorkstationTest.rb:7:in `<main>'
<internal:C:/Users/concaho~1/AppData/Local/Temp/1/ocr6FA7.tmp/lib/ruby/3.0.0/rubygems/core_ext/kernel_require.rb>:85:in `require': cannot load such file -- win32/api (LoadError)
from <internal:C:/Users/concaho~1/AppData/Local/Temp/1/ocr6FA7.tmp/lib/ruby/3.0.0/rubygems/core_ext/kernel_require.rb>:85:in `require'
from C:/Users/concaho~1/AppData/Local/Temp/1/ocr6FA7.tmp/src/LaunchWorkstationTest.rb:7:in `<main>'
C:\Users\concaho>
Coud you help me ? Or find a way to make an executable ? Thanks a lot!
Gem ENV:
RubyGems Environment:
- RUBYGEMS VERSION: 3.2.33
- RUBY VERSION: 3.0.6 (2023-03-30 patchlevel 216) [i386-mingw32]
- INSTALLATION DIRECTORY: C:/Ruby30/lib/ruby/gems/3.0.0
- USER INSTALLATION DIRECTORY: C:/Users/hormancey/.local/share/gem/ruby/3.0.0
- RUBY EXECUTABLE: C:/Ruby30/bin/ruby.exe
- GIT EXECUTABLE: C:\Program Files\Git\cmd/git.EXE
- EXECUTABLE DIRECTORY: C:/Ruby30/bin
- SPEC CACHE DIRECTORY: C:/Users/hormancey/.local/share/gem/specs
- SYSTEM CONFIGURATION DIRECTORY: C:/ProgramData
- RUBYGEMS PLATFORMS:
- ruby
- x86-mingw32
- GEM PATHS:
- C:/Ruby30/lib/ruby/gems/3.0.0
- C:/Users/concaho/.local/share/gem/ruby/3.0.0
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :backtrace => false
- :bulk_threshold => 1000
- :sources => ["https://rubygems.org/", "http://rubygems.org"]
- :ssl_verify_mode => 0
- REMOTE SOURCES:
- SHELL PATH:
- C:\WINDOWS\system32
- C:\WINDOWS
- C:\WINDOWS\ccm
- C:\WINDOWS\System32\Wbem
- C:\WINDOWS\System32\WindowsPowerShell\v1.0\
- C:\WINDOWS\SysWOW64~FDSTools\SysinternalsSuite
- C:\Program Files\Perforce\
- C:\Program Files (x86)\Microsoft SQL Server\Client SDK\ODBC\130\Tools\Binn\
- C:\Program Files (x86)\Microsoft SQL Server\140\Tools\Binn\
- C:\Program Files (x86)\Microsoft SQL Server\140\DTS\Binn\
- C:\Program Files (x86)\Microsoft SQL Server\140\Tools\Binn\ManagementStudio\
- C:\Program Files\Microsoft SQL Server\110\Tools\Binn\
- C:\Program Files\PuTTY\
- C:\Program Files\Git\cmd
- C:\Strawberry\c\bin
- C:\Strawberry\perl\site\bin
- C:\Strawberry\perl\bin
- C:\node_modules.bin
- C:\WINDOWS\system32
- C:\WINDOWS
- C:\WINDOWS\System32\Wbem
- C:\WINDOWS\System32\WindowsPowerShell\v1.0\
- C:\WINDOWS\System32\OpenSSH\
- C:\Users\concaho\AppData\Roaming\nvm
- C:\Program Files\nodejs
- C:\Program Files\nodejs\
- C:\Program Files (x86)\Yarn\bin\
- C:\Program Files\dotnet\
- C:\Program Files (x86)\IncrediBuild
- C:\Program Files (x86)\Windows Kits\10\Windows Performance Toolkit\
- C:\Program Files\Microsoft SQL Server\150\Tools\Binn\
- C:\Program Files\Microsoft SQL Server\Client SDK\ODBC\170\Tools\Binn\
- C:\Program Files (x86)\GitExtensions\
- C:\Ruby30\bin
- C:\Users\concaho\AppData\Local\Programs\Python\Python310\Scripts\
- C:\Users\concaho\AppData\Local\Programs\Python\Python310\
- C:\Users\concaho\AppData\Local\Microsoft\WindowsApps
- C:\Users\concaho\AppData\Local\Programs\Fiddler
- C:\Users\concaho\AppData\Local\Microsoft\WindowsApps
- C:\Users\concaho\AppData\Roaming\nvm
- C:\Program Files\nodejs
- C:\Users\concaho\AppData\Local\GitHubDesktop\bin
- C:\Users\concaho\AppData\Roaming\npm
- C:\Users\concaho\AppData\Local\Yarn\bin
- C:\Users\concaho\AppData\Local\Programs\Microsoft VS Code\bin
- C:\Users\concaho.dotnet\tools
- C:\Users\concaho\AppData\Local\JetBrains\Toolbox\scripts
Concaho
Hi All,
I found a workaround.
I don't have this error with gem win32-api (1.4.0) instead of win32-api-1.10.1-universal-mingw32.
It does not work with win32-api-1.5.0-universal-mingw32.
As you can see it only works with package without the mingw32:
win32-api (1.10.1 universal-mingw32, 1.5.0 universal-mingw32, 1.4.0)
Thanks,
Concaho