Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ubuntu 17.04 libpng12.so.0: cannot open shared object file #255

Closed
maraisr opened this issue Apr 30, 2017 · 5 comments
Closed

Ubuntu 17.04 libpng12.so.0: cannot open shared object file #255

maraisr opened this issue Apr 30, 2017 · 5 comments

Comments

@maraisr
Copy link

maraisr commented Apr 30, 2017

Error message:

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

From what I can see I'd need to contact you guys?


OS: Ubuntu 17.04
Version:: mozjpeg v4.1.1

Package: sudo apt-get install libpng-dev ran with no errors:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
libpng-dev is already the newest version (1.6.28-1).
0 to upgrade, 0 to newly install, 0 to remove and 0 not to upgrade.

Caveat: mozjpeg is being ran from image-webpack-loader out of webpack. But believe this issue is more-or-less related to this repo.

@maraisr maraisr changed the title Bug: Ubuntu 17.04 libpng12.so.0: cannot open shared object file Ubuntu 17.04 libpng12.so.0: cannot open shared object file Apr 30, 2017
@kornelski
Copy link
Member

kornelski commented Apr 30, 2017

We don't maintain anything for Node.js. If you're using MozJPEG via a Node module (anything installed from npm), please report it to the 3rd party author who made the Node module.

We don't require any particular version of libpng. The tools will link with whatever version was available at the time they were built, which usually means the executable can't be copied to any other system.

You probably have mozjpeg built for a different version of the system (e.g. a Debian one, or for an old version of Ubuntu). You need to recompile it or get a binary compatible with your version of Ubuntu.

@pedroskakum
Copy link

And how is that done? I'm with the same problem. I do not know how to proceed. Thanks

@kornelski
Copy link
Member

kornelski commented May 26, 2017

  1. Ensure your system's libpng is not misconfigured. This should show 1.6.… and include -lpng16:

    pkg-config  --modversion libpng
    pkg-config  --libs libpng
  2. Delete the existing cjpeg binary, and clean build directory (make clean)

  3. Configure and build again from scratch, following regular build instructions in the repo

@cosine
Copy link

cosine commented Apr 10, 2018

I just ran into this problem, and the cause is a cjpeg Linux binary downloaded by the released versions of this project. The cjpeg binary comes from some configuration specified in node_modules/mozjpeg/lib/index.js.

The current workaround is generally to load a copy of libpng12.so from a mirrored copy of the older package.

As more and more Linux distributions are updated to no longer include libpng12.so in favor of libpng16.so, this problem will continue to become more prevalent.

I suggest switching the project to downloading a version of cjpeg that staticly links in libpng12.a (or whatever newer version desired).

@kornelski
Copy link
Member

kornelski commented Apr 10, 2018

@cosine Just to be clear, we don't release any binaries. You've got a node module made by someone else.

Also libpng12 is ancient and buggy. I strongly urge to stop using any OS that still ships it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants