Closed dsisnero closed 2 years ago
Maybe update MSYS2, then run the following?
module UpdateUCRT
class << self
MSYS2_ROOT = 'C:/msys64'
PKG_PRE = 'mingw-w64-ucrt-x86_64-'
def run
# args = '--noconfirm --noprogressbar --needed'
args = '--noprogressbar --needed'
# zlib required by gcc
base_gcc = %w[dlfcn make pkgconf libmangle-git tools-git gcc]
base_ruby = %w[gmp libffi libyaml openssl ragel readline]
pkgs = (base_gcc + base_ruby).unshift('').join " #{PKG_PRE}"
Dir.chdir("#{MSYS2_ROOT}/usr/bin") do
cmd = "#{MSYS2_ROOT}/usr/bin/pacman.exe -S #{args} #{pkgs}"
system cmd
end
end
end
end
UpdateUCRT.run
x64-mingw-ucrt
is the expected ruby and gem platform for RubyInstaller-3.1. See https://rubyinstaller.org/2021/12/31/rubyinstaller-3.1.0-1-released.html
Say I want to install gem like 'tk' F:\programming\source\repos\git\dsisnero\nexcom_drawings>gem install tk Temporarily enhancing PATH for MSYS/MINGW... Installing required msys2 packages: mingw-w64-ucrt-x86_64-tk error: target not found: mingw-w64-ucrt-x86_64-tk pacman failed with the following output: Building native extensions. This could take a while... Successfully installed tk-0.4.0 1 gem installed
But it is not usable because no mingw-w64-ucrt-x86_64
F:\programming\source\repos\git\dsisnero\nexcom_drawings>ruby -r tk -e 'root = TkRoot.new{ title "Hello World"}'
<internal:f:/windows/tools/ruby/Ruby31-x64/lib/ruby/3.1.0/rubygems/core_ext/kernel_require.rb>:85:in require': 126: The specified module could not be found. - f:/windows/tools/ruby/Ruby31-x64/lib/ruby/gems/3.1.0/gems/tk-0.4.0/lib/tcltklib.so (LoadError) from <internal:f:/windows/tools/ruby/Ruby31-x64/lib/ruby/3.1.0/rubygems/core_ext/kernel_require.rb>:85:in
require'
from f:/windows/tools/ruby/Ruby31-x64/lib/ruby/gems/3.1.0/gems/tk-0.4.0/lib/tk.rb:7:in <top (required)>' from <internal:f:/windows/tools/ruby/Ruby31-x64/lib/ruby/3.1.0/rubygems/core_ext/kernel_require.rb>:160:in
require'
from <internal:f:/windows/tools/ruby/Ruby31-x64/lib/ruby/3.1.0/rubygems/core_ext/kernel_require.rb>:160:in rescue in require' from <internal:f:/windows/tools/ruby/Ruby31-x64/lib/ruby/3.1.0/rubygems/core_ext/kernel_require.rb>:149:in
require'
<internal:f:/windows/tools/ruby/Ruby31-x64/lib/ruby/3.1.0/rubygems/core_ext/kernel_require.rb>:85:in require': cannot load such file -- tk (LoadError) from <internal:f:/windows/tools/ruby/Ruby31-x64/lib/ruby/3.1.0/rubygems/core_ext/kernel_require.rb>:85:in
require'
Not sure what the issue is. Try:
ridk enable
pacman -S mingw-w64-ucrt-x86_64-tk
I already had the tk package installed on my system, as it's a dependency of python. gem install tk
worked, but I'm not familiar with it. Did you update msys2 and install the ucrt build tools?
EDIT: I was using a Ruby master ucrt build, I just tried with 3.1.0, and it (again) worked fine. I didn't mention it, but the code above needs the MSYS2_ROOT
constant changed to wherever MSYS2 is installed. Not sure if the path 'difference' between Ruby and MSYS2 will work, but I assume if ridk version
(running in the Ruby 3.1.0 bin folder) is finding it, then gem install
should work...
What problems are you experiencing?
using new ruby 3.1 installer with existing msys2 installation. gem platform is x64-mingw-ucrt so looks for x64-mingw-ucrt libraries instead of x64-mingw libraries
Steps to reproduce
install https://github.com/oneclick/rubyinstaller2/releases/download/RubyInstaller-3.1.0-1/rubyinstaller-3.1.0-1-x64.exe with existing msys2
What's the output from
ridk version
?f:\programming\source\repos\ruby\try_tk>ridk version
ruby: path: f:/windows/tools/ruby/Ruby31-x64 version: 3.1.0 platform: x64-mingw-ucrt ruby_installer: package_version: 3.1.0-1 git_commit: a1972fd msys2: path: F:\windows\scoop\apps\msys2\current cc: gcc (Rev5, Built by MSYS2 project) 11.2.0 sh: GNU bash, version 5.1.8(1)-release (x86_64-pc-msys) os: Microsoft Windows [Version 10.0.18363.1977]