-
Notifications
You must be signed in to change notification settings - Fork 60
Ruby script crashes on Windows when using hist_find #331
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Hi @niklasweber, Sorry you're having trouble. How did you install ruby, and do you know which msys you have? I know I've had difficulty with the various windows ruby installers in the past. |
Oh, and I guess this is with the libvips binary that gem pulls in for you, is that right? |
I tried with "Ruby+Devkit 3.1.1-1 (x64)" from: https://rubyinstaller.org/downloads/ I ran |
Using the official libvips windows binaries seems to fix this. I made a tiny test prog: require 'vips'
puts "ruby-vips version = #{Vips::VERSION}"
puts "libvips version = #{Vips::LIBRARY_VERSION}" Just after
I downloaded the official libvips zip: And unzipped it over the top of
And your program works fine. |
(this is not a great solution -- it would be better to fix the libvips package in pacman) |
Hi @jcupitt, Thanks for checking up on my issue. Regarding your questions: I installed Ruby+Devkit 2.7.5-1 (x64) with all default options selected. For the ridk tool I chose options 1 and 3 (ridk including the MSYS2 and the MinGW toolchains). Due to other dependencies I cannot update to Ruby 3. I use msys2. The output of your script was
then I ran
but it still crashes, like you already tested. However trying your workaround somehow doesn't work for me.
Did I maybe forget something? |
You need to find out where your current libvips-42.dll is kept and replace that (and also replace all the associated DLLs). It's probably not in |
Sorry, copy, paste error. Of course in my case I copied it to |
Maybe you have two copies of the libvips-42.dll then? It seems it's still finding the old version. |
Okay it's working now. I used $ pacman -Ql mingw-w64-x86_64-libvips
mingw-w64-x86_64-libvips /mingw64/
mingw-w64-x86_64-libvips /mingw64/bin/
mingw-w64-x86_64-libvips /mingw64/bin/batch_crop
mingw-w64-x86_64-libvips /mingw64/bin/batch_image_convert
mingw-w64-x86_64-libvips /mingw64/bin/batch_rubber_sheet
mingw-w64-x86_64-libvips /mingw64/bin/libvips-42.dll
mingw-w64-x86_64-libvips /mingw64/bin/libvips-cpp-42.dll
mingw-w64-x86_64-libvips /mingw64/bin/light_correct
... $ cd /mingw64/
$ pwd -W
C:/Ruby27-x64/msys64/mingw64 So I created a backup of
At least the workaround is working now and I hope the pacman package can be updated soon. |
Great! I wonder what the issue is? There were no bugs fixed around histograms, so I suppose it must be a general build issue in that package. Anyway, hopefully it'll be resolved soon. |
Hi @jcupitt , I'm trying to reproduce the fix, but instead of extracting vips-dev-w64-all-8.12.2.zip over the existing I'm using rubyinstaller-devkit-2.7.5-1-x64.exe, which should support RUBY_DLL_PATH, but seemingly I can't get it to work :-/ I have in require 'vips'
puts "RUBY_DLL_PATH is #{ENV['RUBY_DLL_PATH'].inspect}"
puts "ruby-vips version = #{Vips::VERSION}"
puts "libvips version = #{Vips::LIBRARY_VERSION}" The In
Any ideas what I might be doing wrong here? |
Hi @tknerr, I tried Perhaps rubyinstaller is blocking it? You'd need to dig into the sources to see what's happening. |
@jcupitt thanks for double-checking! So yes, I did dig deeper... :D It seems that an existing Check: libvips was still installed:
So I removed it:
Confirming it's no longer installed:
Et voila, now it's picking up the correct libvips 8.12.2 from the
I'm just afraid that the |
Ah good find. Perhaps they have some code that does something like The best fix would be to get the pacman package updated, of course. |
Just to confirm: yes, with every ruby-vips gem installation or upgrade the libvips msys2_mingw_dependency would be reinstalled again if missing. As we are using bundler to install ruby-vips along with other gems in a consistent / reproducible version (via frozen Gemfile.lock), and there is this commit, I see no chance to bypass installing msys2_mingw_dependencies when using bundler... So the only option that remains would be a manual Having the pacman package updated would fix the original issue of this PR, but it would still not allow to use a reproducible / specific / pinned external libvips version... (but that's another topic -- should we open a separate issue to track the conversation about that?) |
OK, let's close this and switch to the linked enhancement issue. |
Hi, I am having an issue with ruby-vips on windows. When I run some_image.hist_find it seems like ruby crashes. I condensed my problem down to the following script which reliably crashes each time for me:
The output is:
The expected behavior would be that the for loop runs forever, but after around 0.5 seconds it just stops without any other output and
$?
returns false. I initially used a tiff image but the problem persists also if I use jpeg or other image formats. Also very small and very large images do not make a difference. Removingaccess: :sequential
from new_from_file in order to use the defaultVIPS_ACCESS_RANDOM
method also still makes it crash. The problem only occurs if I run hist_find. When leaving outimg.hist_find
it runs fine.This problem only occurs on Windows. On Linux it runs fine.
My setup:
Windows 10
ruby-vips 2.1.4
ruby 2.7.5p203 (2021-11-24 revision f69aeb8314) [x64-mingw32]
To install ruby-vips I put
in my Gemfile and ran
Can someone reproduce this? What could be the problem here?
Thank you very much!
The text was updated successfully, but these errors were encountered: