elixir-image/image

Create natively compiled downloadable libvips and vix

Closed this issue · 6 comments

In the same spirit as Nx and OpenCV it would be great to be able to install a natively compile NIF and a natively compiled libvips if they are available.

This is beyond my competency and a collaborator motivated to dive in would be greatly appreciated!

Hey @kipcole9, just quick update. I think this issue should be addressed at Vix end, and I am working on this.

Currently, I have a working setup which download precompiled libvips with its dependencies. This means, using it with livebook should be a bit easier. No need to install libvips by hand. Currently support linux and macos.

Precompiling the vix.so part is still pending, so we still need gcc & make.

If you want to give it a shot

Mix.install([
  {:vix, github: "akash-akya/vix", branch: "dev"}
])

@akash-akya, what a great holiday gift, thank you!. Worked very smoothly on my M1 Mac with one exception which I suspect is related to the dependency configuration for libvips (I think it needs fftw3?):

warning: Vix.Vips.Operation.fwfft!/1 is undefined or private
  lib/image.ex:4668: Image.fft/1

Ahhhhh, you're using the Sharp build system (smart!). Which doesn't include fftw3 as a dependency. Hmmmm.

I see, maybe it can be marked as optional based depending on if the dependency availability?

Or we can have something like full package, then Image can configure Vix to use that package via config

config :vix,
  precompiled_libvips: "https://path-to-full-package"

But, this would complicate a lot of things and might make debugging hard. Not to mention the effort for maintaining this 😅

I use it only for de-skewing an image so I can make it optional on my side and note that it needs a custom (or platform package) install to work. Using the current build system unchanged makes a lot of sense.

Closing since this is being implemented upstream in Vix.