Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Missing binaries error with image_optim_pack in production

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)
like image 678
Mark Robinson Avatar asked Aug 10 '17 10:08

Mark Robinson


1 Answers

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.

like image 193
sffc Avatar answered Oct 31 '22 17:10

sffc