ruby-on-railsrhel8libvips

Error on libvips library when installing Ruby on Rails 7.0 app in RHEL8


Trying to install a Ruby on Rails app that uses Rails 7+. Get this error:

Could not open library 'vips.so.42': vips.so.42: cannot open shared object file: No such file or directory. Could not open library 'libvips.so.42': libvips.so.42: cannot open shared object file: No such file or directory.

when running rake secret, but appears to be a much larger issue. Rails 7+ has switched to using libvips over imagemagick, and this application was coded to use libvips over it, so I can't just change it with the option:

config.active_storage.variant_processor = :mini_magick

instead of

config.active_storage.variant_processor = :vips

I'm trying to do this on RHEL8, which seemingly has no package repositories for libvips and its large amount of dependencies. I found this strange

I've tried to use snapd to install the libvips snap, had no change though seemed successful but the snap is pretty old. I've tried to compile from source, but sourcing all of the dependencies has proved very challenging.

Has anyone successfully used a Rails 7+ app with libvips on RHEL8/CentOS?


Solution

  • libvips is available in Remi Collet's RPM repository:

    https://rpms.remirepo.net/

    Kleis Auke wrote some notes on using Remi's rpms in RHEL9 which you should be able to adapt:

    https://github.com/libvips/pyvips/issues/356#issuecomment-1287872830

    Notes for rhel9:

    # Install the EPEL repository configuration package
    dnf install https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm
    
    # Enable the CodeReady Builder repository since EPEL packages may depend on packages from it
    crb enable
    # or:
    # subscription-manager repos --enable codeready-builder-for-rhel-9-$(arch)-rpms
    
    # Install the Remi repository configuration package
    dnf install https://rpms.remirepo.net/enterprise/remi-release-9.rpm
    
    # Enable Remi's RPM repository
    dnf config-manager --set-enabled remi
    
    # Install libvips (+ development files and command-line tools)
    dnf install vips vips-devel vips-tools
    
    ## Install optional modules
    ## See: https://github.com/remicollet/remirepo/issues/171
    
    # HEIC / AVIF support via libheif
    dnf install --nogpgcheck https://mirrors.rpmfusion.org/free/el/rpmfusion-free-release-9.noarch.rpm
    dnf install vips-heif
    
    # JPEG-XL support via libjxl
    dnf install vips-jxl
    
    # *Magick support via GraphicsMagick
    dnf install vips-magick-gm
    
    # *Magick support via ImageMagick 6
    dnf install vips-magick-im6
    
    # *Magick support via ImageMagick 7
    dnf install vips-magick-im7
    
    # OpenSlide support
    dnf install vips-openslide
    
    # PDF load support via Poppler
    dnf install vips-poppler