Missing binaries error with image_optim_pack in production
Asked Answered
H

2

13

I'm trying to deploy a Rails app with paperclip-optimizer and it's giving me an error about missing binaries. I have bundled image_optim_pack to provide the binaries but still get this:

ImageOptim::BinResolver::Error occurred
pngcrush worker: `pngcrush` not found; please provide proper binary or di=
sable this worker (--no-pngcrush argument or `:pngcrush =3D> false` throu=
gh options)
advpng worker: `advpng` not found; please provide proper binary or disabl=
e this worker (--no-advpng argument or `:advpng =3D> false` through optio=
ns)
optipng worker: `optipng` not found; please provide proper binary or disa=
ble this worker (--no-optipng argument or `:optipng =3D> false` through o=
ptions)
pngquant worker: `pngquant` not found; please provide proper binary or di=
sable this worker (--no-pngquant argument or `:pngquant =3D> false` throu=
gh options)
jhead worker: `jhead` not found, `jpegtran` not found; please provide pro=
per binary or disable this worker (--no-jhead argument or `:jhead =3D> fa=
lse` through options)
jpegoptim worker: `jpegoptim` not found; please provide proper binary or =
disable this worker (--no-jpegoptim argument or `:jpegoptim =3D> false` t=
hrough options)
jpegtran worker: `jpegtran` not found; please provide proper binary or di=
sable this worker (--no-jpegtran argument or `:jpegtran =3D> false` throu=
gh options)
gifsicle worker: `gifsicle` not found; please provide proper binary or di=
sable this worker (--no-gifsicle argument or `:gifsicle =3D> false` throu=
gh options)
  • Server Ubuntu 14.04.5 LTS
  • Rails 5.1.3
  • Ruby 2.4.1
  • nginx 1.9.10
  • passenger 5.0.24
  • image_optim (0.25.0)
  • image_optim_pack (0.5.0.20170803 x86_64-linux)
Hoxie answered 10/8, 2017 at 10:44 Comment(7)
Have you disabled image_optim in your asset pipeline? config.assets.image_optim = false in config/application.rbMohur
@PaulColeman I haven't. I thought that I wanted that to be on so it's doing all assets.Hoxie
@PaulColeman I tried turning it off but it didn't effect uploading a paperclip attachment - which is where I'm seeing the error.Hoxie
Have you SSHed into the machine to verify that the binaries have in fact been installed?Hengelo
It turned out to be an issue with my 64-bit kernel and 32-bit environment. It wasn't able to determine the correct version to link to.Hoxie
@MarkRobinson If you think it's a situation others might run into, would you mind explaining your solution in an answer to your own question?Hengelo
Thanks @Hengelo my solution is to rebuild my production server as fully 64-bit. I tried a few hacks but couldn't get them to work for me. I should reference my github issue on this for folks following: github.com/toy/image_optim_pack/issues/12Hoxie
M
2

tl;dr, the binaries in image_optim_pack were probably built against a newer system than the one you are trying to run it on. Try finding the latest version of image_optim_pack that works on your system. For me, the following versions worked:

gem "image_optim", "~> 0.25"
gem "image_optim_pack", "= 0.2.3"

More details

To get information on what piece is failing, run:

$ bundle exec image_optim --info

I see something like this:

$ bundle exec image_optim --info
image_optim v0.26.1
config:
  verbose: true
nice: 10
threads: 4
pack: true
skip_missing_workers: true
allow_lossy: false
cache_dir:
cache_worker_digests: false
image_optim_pack: jpeg-recompress, jpegoptim, jhead, advpng, jpegtran, gifsicle, pngcrush, optipng from /path/to/gems/ruby-2.4.0/gems/image_optim_pack-0.5.0.20180419-x86_64-linux/vendor/linux-x86_64 failed
No pack for this OS and/or ARCH, check verbose output
Resolved jpegrescan 1a762f62 at /path/to/gems/ruby-2.4.0/gems/image_optim-0.26.1/vendor/jpegrescan
pngcrush worker: `pngcrush` not found; please provide proper binary or disable this worker (--no-pngcrush argument or `:pngcrush => false` through options)
pngout worker: `pngout` not found; please provide proper binary or disable this worker (--no-pngout argument or `:pngout => false` through options)
advpng worker: `advpng` not found; please provide proper binary or disable this worker (--no-advpng argument or `:advpng => false` through options)
optipng worker: `optipng` not found; please provide proper binary or disable this worker (--no-optipng argument or `:optipng => false` through options)
pngquant worker: `pngquant` not found; please provide proper binary or disable this worker (--no-pngquant argument or `:pngquant => false` through options)
jhead worker: `jhead` not found, `jpegtran` not found; please provide proper binary or disable this worker (--no-jhead argument or `:jhead => false` through options)
jpegoptim worker: `jpegoptim` not found; please provide proper binary or disable this worker (--no-jpegoptim argument or `:jpegoptim => false` through options)
jpegtran worker: `jpegtran` not found; please provide proper binary or disable this worker (--no-jpegtran argument or `:jpegtran => false` through options)
gifsicle worker: `gifsicle` not found; please provide proper binary or disable this worker (--no-gifsicle argument or `:gifsicle => false` through options)
svgo worker: `svgo` not found; please provide proper binary or disable this worker (--no-svgo argument or `:svgo => false` through options)
Workers by format:

It doesn't say why the workers failed. But you can run the worker binaries to find out:

# Path from the error message:
$ export IMAGE_OPTIM_BIN="/path/to/gems/ruby-2.4.0/gems/image_optim_pack-0.5.0.20180419-x86_64-linux/vendor/linux-x86_64"
$ ls $IMAGE_OPTIM_BIN
advpng  gifsicle  jhead  jpegoptim  jpeg-recompress  jpegtran  libjpeg.so  libpng.so  libz.so  optipng  pngcrush  pngquant
$ $IMAGE_OPTIM_BIN/advpng
/path/to/gems/ruby-2.4.0/gems/image_optim_pack-0.5.0.20180419-x86_64-linux/vendor/linux-x86_64/advpng: /lib/libc.so.6: version `GLIBC_2.14' not found (required by /path/to/gems/ruby-2.4.0/gems/image_optim_pack-0.5.0.20180419-x86_64-linux/vendor/linux-x86_64/advpng)
/path/to/gems/ruby-2.4.0/gems/image_optim_pack-0.5.0.20180419-x86_64-linux/vendor/linux-x86_64/advpng: /lib/libc.so.6: version `GLIBC_2.14' not found (required by /path/to/gems/ruby-2.4.0/gems/image_optim_pack-0.5.0.20180419-x86_64-linux/vendor/linux-x86_64/libz.so)

I think the important part is:

version `GLIBC_2.14' not found

I checked the version of glibc installed on my system, and it is only 2.12. If you are able to upgrade glibc via your system's package manager, try that first. If you can't upgrade glibc, then just use an older version of the gems as described above.

Magistrate answered 5/6, 2018 at 8:46 Comment(0)
C
0

I had the same issue with image_optim_pack version 0.5.020170815.

Upgrading to the most recent version (0.5.020170831 as of now) fixed the issue for me.

Capricecapricious answered 8/9, 2017 at 15:44 Comment(2)
Thanks but I'm still seeing the error with 0.5.020170831Hoxie
@MarkRobinson is the image_optim_pack entry AFTER the image_optim entry in the Gemfile?Capricecapricious

© 2022 - 2024 — McMap. All rights reserved.