Fix the issue that libpng12-0 is missing in Ubuntu 18.04, 19.10 or 20.04

In this article, you will find a very easy to apply fix that will allow the installation and operation of libpng12-0 In Ubuntu 18.04 LTS (or Linux Mint 19. * based on Ubuntu 18.04) and Ubuntu 19.10 or 20.04. This applies to any Ubuntu or Linux Mint style: Kubuntu, Xubuntu, Ubuntu MATE, Ubuntu Budgie, Linux Mint Xfce, Linux Mint Cinnamon, etc., and Pop! _OS or basic OS.


libpng12 It is no longer available in the Ubuntu repository archive, so some applications that were not built with the newer libpng (libpng16) The library could not be installed. This question is not new because Ubuntu has been removed libpng12 Version 16.10, but users who upgraded from Ubuntu 16.04 to 18.04 LTS and Linux Mint 19. *Users may not know this problem and how to solve it.
This is an example. Ubuntu Software was unable to install WPS Office at all without displaying any error messages, so I opened the WPS Office deb with the following command: gdebi-gtk, It does not allow installation of deb, and displays the following message: “Error: Dependency cannot be met: libpng12-0”:

Attempting to install the same deb from the terminal will result in the following libpng12-0 error:

[email protected]:~$ sudo dpkg -i wps-office_10.1.0.5707_a21_amd64.deb 
[sudo] password for logix: 
Selecting previously unselected package wps-office.
(Reading database ... 354579 files and directories currently installed.)
Preparing to unpack wps-office_10.1.0.5707_a21_amd64.deb ...
Unpacking wps-office ( ...
dpkg: dependency problems prevent configuration of wps-office:
 wps-office depends on libpng12-0; however:
  Package libpng12-0 is not installed.

dpkg: error processing package wps-office (--install):
 dependency problems - leaving unconfigured
Processing triggers for gnome-menus (3.13.3-11ubuntu1) ...
Processing triggers for desktop-file-utils (0.23-1ubuntu3) ...
Processing triggers for mime-support (3.60ubuntu1) ...
Processing triggers for shared-mime-info (1.9-2) ...
Processing triggers for hicolor-icon-theme (0.17-2) ...
Errors were encountered while processing:

Please note that some apps cannot be installed due to missing libpng12-0, And others cannot start at all.

Solution: Install and run applications that require libpng12-0 in Ubuntu 18.04, 19.10 or 20.04 / Linux Mint 19. *

To solve Ubuntu 18.04 / Linux Mint 19. * / Pop! _OS 18.04 / Basic OS 5 or 5.1 issues, please download libpng12-0 Packages for your architecture (you only need one of them, dedicated to your Ubuntu/Linux Mint architecture):

On this page, scroll down to Built files Part, download only libpng12-0 DEB package (for example, in 64-bit: libpng12-0_1.2.54-1ubuntu1.1_amd64.deb)!
Install libpng12-0 By downloading the deb using the link above, you should be able to install and run applications that still depend on the library in Ubuntu 18.04 LTS or Ubuntu 18.10 / Linux Mint 19. To solve this problem on Ubuntu 20.04, 19.10 or 19.04, you can install libpng using the PPA I created with the updated libpng12-0 package. Use the following command to add PPA and install libpng12-0:

sudo add-apt-repository ppa:linuxuprising/libpng12
sudo apt update
sudo apt install libpng12-0

Or download libpng12-0 DEB package From PPA And install it manually (you only need the libpng12-0 DEB package, for example libpng12-0_1.2.54-1ubuntu1.1+1~ppa0~eoan_amd64.deb).
The reason this package needs to be updated for Ubuntu 20.04, 19.10 and 19.04 is that for Ubuntu 19.04, /lib Directory is a symbolic link /usr/lib (This is not the case in Ubuntu 18.04 and earlier versions), which causes libpng12-0 Installation failed because this package tried to create a link from /lib/x86_64-linux-gnu/ to /usr/lib, This is already a symbolic link. Therefore, DEB must be repackaged to run on newer Ubuntu versions.
As a result, when trying to install the old libpng12-0 When packaging on Ubuntu (or Pop!_OS, etc.) 20.04, 19.10 or 19.04, the following error will appear:

dpkg: error processing archive libpng12-0_1.2.54-1ubuntu1.1_amd64.deb (--unpack):
 unable to install new version of '/lib/x86_64-linux-gnu/': No such file or directory
No apport report written because the error message indicates an issue on the local system
Errors were encountered while processing:

This error will no longer occur with the version in the PPA.