hardpixel / heroku-buildpack-vips

Heroku buildpack with libvips
MIT License
6 stars 1 forks source link

Vips doesn't seem to be building with HEIF/HEIC support #6

Open davidcelis opened 1 year ago

davidcelis commented 1 year ago

Describe the bug

I use this buildpack in a Rails application that I have running on Dokku. Vips gets installed and is usable with the Rails app but, despite libheif being installed by this buildpack, it doesn't seem that Vips is building with support for it.

To Reproduce

  1. Add ruby-vips to the Gemfile for a Rails application
  2. Add this buildpack to the Rails app and deploy to Heroku or Dokku
  3. Open a Rails console in the live Rails app and run Vips.get_suffixes

Expected behavior

Vips.get_suffixes should return the file extensions that libheif supports (e.g. .heic and heif) but does not. Instead, it only returns:

[
  ".csv",
  ".mat",
  ".raw",
  ".v",
  ".vips",
  ".pbm",
  ".pgm",
  ".ppm",
  ".pfm",
  ".pnm",
  ".hdr",
  ".gif",
  ".dz",
  ".szi",
  ".png",
  ".jpg",
  ".jpeg",
  ".jpe",
  ".webp",
  ".tif",
  ".tiff"
]

Additional context

I'm able to run pkg-config libheif --modversion in my application's container and it successfully returns 1.15.2, leading me to believe further that libheif is being installed but that Vips is not properly building with it linked.

davidcelis commented 1 year ago

I did a couple more quick debugging attempts like checking Vips' config and loaders from my container, and the HEIF-related items do seem to be there:

$ vips --vips-config | grep heif
HEIC/AVIF load/save with libheif: true (dynamic module: true)

$ vips -l | grep heif
        VipsForeignLoadHeif (heifload_base), load a HEIF image, priority=0
          VipsForeignLoadHeifFile (heifload), load a HEIF image (.heic, .heif, .avif), priority=0, is_a, get_flags, header, load
          VipsForeignLoadHeifBuffer (heifload_buffer), load a HEIF image, priority=0, is_a_buffer, get_flags, header, load
          VipsForeignLoadHeifSource (heifload_source), load a HEIF image, priority=0, is_a_source, get_flags, header, load
        VipsForeignSaveHeif (heifsave_base), save image in HEIF format, priority=0, rgba-only
          VipsForeignSaveHeifFile (heifsave), save image in HEIF format (.heic, .heif, .avif), priority=0, rgba-only
          VipsForeignSaveHeifBuffer (heifsave_buffer), save image in HEIF format (.heic, .heif), priority=0, rgba-only
          VipsForeignSaveHeifTarget (heifsave_target), save image in HEIF format (.heic, .heif), priority=0, rgba-only

But yeah, Vips definitely isn't detecting them at runtime, at least not in my Rails app. I found a discussion that seems to be this exact same issue that a different vips buildpack had:

https://github.com/libvips/libvips/issues/1945