mozjpeg-bin: Installation fails on Ubuntu 16.10 amd64

Module build failed: Error: /home/oleg/projects/main-panel/node_modules/mozjpeg/vendor/cjpeg: error while loading shared libraries: libpng12.so.0: cannot open shared object file: No such file or directory

I fixed it by installing libpng12 but it is not true way.

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Reactions: 25
  • Comments: 18 (3 by maintainers)

Commits related to this issue

Most upvoted comments

I also ran into this issue. https://github.com/imagemin/imagemin-mozjpeg/issues/26 pointed me to the fact that nasm needed to be installed, after which the package built from source just fine instead of using the outdated binary.

First, make sure you have all the build dependencies installed: sudo apt-get install autoconf libtool pkg-config nasm build-essential

Then just rebuild the package: npm rebuild mozjpeg

Potential workaround:

wget -q -O /tmp/libpng12.deb http://mirrors.kernel.org/ubuntu/pool/main/libp/libpng/libpng12-0_1.2.54-1ubuntu1_amd64.deb \
  && dpkg -i /tmp/libpng12.deb \
  && rm /tmp/libpng12.deb

Same problem on Mac OS. I’m using MacPorts and installing libpng did not help.

I’m encountering the same problem with libpng16.so on different Linux platforms.

I had to fix this by running sudo apt-get install libpng16-dev or sudo apt-get install libpng16-16

The newest version uses libpng16. Please install mozjpeg-bin with related dependencies.

Hello

I have probably a proper resolution for this problem. The build image for cjpeg is an ancient debian:8-slim image (so 2 versions behind current stable)

So I updated the image and after rebuild and swap binaries everything seems to work on the current Debian 10 Slim image

https://github.com/imagemin/mozjpeg-bin/pull/61/files

I also had the libpng12.so.0 issue, and fixed with:

wget http://ppa.launchpad.net/hiberis/ppa/ubuntu/pool/main/libp/libpng/libpng12-0_1.2.27-1ubuntu1~ppa1_amd64.deb
sudo dpkg -i libpng12-0_1.2.27-1ubuntu1~ppa1_amd64.deb
sudo apt-get update

elementary OS 5.0 Juno (64-bit) Built on Ubuntu 18.04.2 LTS Linux 4.15.0-51-generic GTK+ 3.22.30

This answer gave the general commands. Thanks @jeremiahgibson91 for the install link!

Potential workaround:

wget -q -O /tmp/libpng12.deb http://mirrors.kernel.org/ubuntu/pool/main/libp/libpng/libpng12-0_1.2.54-1ubuntu1_amd64.deb \
  && dpkg -i /tmp/libpng12.deb \
  && rm /tmp/libpng12.deb

This works for me, Very very thank you!

What about to implement platform-adaptive library calls?