imagemin / mozjpeg-bin

mozjpeg bin-wrapper that makes it seamlessly available as a local dependency

Home Page:https://github.com/mozilla/mozjpeg

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Installation fails on Ubuntu 16.10 amd64

bigslycat opened this issue · comments

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.

Hi

Same problem for me. Thanks for the workaround

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

@jeremiahgibson91 thanks, it works

Same issue, Kubuntu 16.10.
@jeremiahgibson91 it works.
But it's not right.

What about to implement platform-adaptive library calls?

commented

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

Hi @jeremiahgibson91, it works for me in Ubuntu 17.04, thanks!!!

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

I also ran into this issue. imagemin/imagemin-mozjpeg#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

@hackel It worked, thanks!

The above fixes didn't work for me on my deployment process docker image.

The one-line command solved it:

echo "deb http://mirrors.kernel.org/ubuntu/ xenial main" | sudo tee -a /etc/apt/sources.list && sudo apt-get update && sudo apt install -y --allow-unauthenticated libpng12-0

Basically it adds another source to apt, updates apt, and installs libpng12-0.

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!

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!

It is not just ubuntu that dropped support for libpng12, but also Debian. Debian Jessie seems to be the last version that supports libpng12, and will no longer be LTS starting today (june 30th 2020). Given that debian is the de-facto base for the popular node images... yet mozjpeg-bin/vendor/linux/cjpeg still explicitly looks for libpng12, can there be a major version bump to change the binary to expect libpng version 1.6? Or better yet be backwards compatible?

The imagemin is widely popular in the node community. If you want to use the latest node versions via docker you can no longer use imagemin. It would be great if they could be aligned.

Also it seems the macos cjpeg binary is expecting the more recent libpng version 1.6 as well, and not libpng12. So if you develop on a mac and then deploy code in linux (a common pattern) there is further confusion of what version of libpng is needed.

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'm glad that the PR was merged so fast!!! ^^

@sindresorhus @1000ch when you are going to release a new version? I would like to start using the libpng16 compatible version as soon as possible ^^

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