ruby-vips-lambda icon indicating copy to clipboard operation
ruby-vips-lambda copied to clipboard

thumbnail auto_rotate option doesn't work since vips isn't built with libexif

Open mdoyle13 opened this issue 6 years ago • 8 comments

It's me again :)

I noticed that when compiling vips - its compiled without exif support. Exif support is needed in order for autorotate options when using the thumbnail method. (https://github.com/libvips/libvips/issues/319)

I tried a few things to no avail and will try again soon to get this working but wanted to put some info here

For sure yum needs to install libexif-devel so vips will build with exif support

Then we need to figure out how to referencethe libexif.so files in the layer files somehow. I'm not aware how to do this at this time but I did try symlinking and copying some libexif.so files into share/lib directory without success.

When loading vips the lambda responds with this error:

"errorMessage": "Could not open library 'vips': vips: cannot open shared object file: No such file or directory.\nCould not open library 'libvips.so': libexif.so.12: cannot open shared object file: No such file or directory",

mdoyle13 avatar Jun 07 '19 15:06 mdoyle13

Always a joy to hear from you Mike! :)

Please do investigate more and let me know what you find. Maybe even make work in progress pull request that I can checkout and toy around with too.

metaskills avatar Jun 07 '19 17:06 metaskills

I've recently re-done the whole Dockerfile (for Ruby 2.7) which means it should be easier to add this if needed. Take a look.

metaskills avatar Apr 30 '20 19:04 metaskills

got that working with the latest docker image, hope that helps

# install libexif
RUN git clone https://github.com/libexif/libexif.git && \
  cd libexif && \
  autoreconf -i && \
  ./configure --prefix=/opt && \
  make && \
  make install && \
  ldconfig

RUN cp -a /opt/lib/libexif.so* /build/share/lib && \
  cp -a /opt/lib/libexif.so /build/share/lib

rawpixel-vincent avatar May 28 '20 06:05 rawpixel-vincent

Thanks, mind making a PR to the vips-slim branch? cc @brcarp

metaskills avatar May 28 '20 13:05 metaskills

I can add a commit for it. Looking at this though:

RUN cp -a /opt/lib/libexif.so* /build/share/lib &&
cp -a /opt/lib/libexif.so /build/share/lib

I'm not quite sure what that's designed to achieve. If the goal is to handle the symbolic link properly then I think this needs to be written differently, because: the /opt/lib/libexif.so* glob will also grab /opt/lib/libexif.so so perhaps /opt/lib/libexif.so.* is intended; and cp -a used for both would handle symbolic links the same way. Is there more context for this, @rawpixel-vincent ?

brcarp avatar May 28 '20 13:05 brcarp

Also, after reviewing the dependencies, libexif.so.12()(64bit) is already a dependency for vips.x86_64 0:8.9.2-1.lambda2. In the current build in the vips-slim branch, libexif.so.12.3.3 is installed into the lib directory with libexif.so.12 linked to it. So it's possible that this isn't an issue in the vips-slim branch, but someone would have to test that with a vipsthumbnail example to confirm.

brcarp avatar May 28 '20 13:05 brcarp

Well I went with a complete different solution since I use python 3.7, and I can definitely post the dockerfile here tmr, but at the end we had some issue with this build you are proposing. And I'm not good at devops so was just trying to help here and you know better for sure.

rawpixel-vincent avatar May 28 '20 15:05 rawpixel-vincent

And I'm not good at devops so was just trying to help here and you know better for sure.

And we appreciate that!!!

metaskills avatar May 28 '20 16:05 metaskills