30

I am trying to install FreeSurfer: ftp://surfer.nmr.mgh.harvard.edu/pub/dist/freesurfer/6.0.0/freesurfer-Linux-centos6_x86_64-stable-pub-v6.0.0.tar.gz

I am following these steps to install FreeSurfer: https://surfer.nmr.mgh.harvard.edu/fswiki/DownloadAndInstall

When I run following commands:

freeview -v \
    bert/mri/T1.mgz \
    bert/mri/wm.mgz \
    bert/mri/brainmask.mgz \
    bert/mri/aseg.mgz:colormap=lut:opacity=0.2 \
    -f \
    bert/surf/lh.white:edgecolor=blue \
    bert/surf/lh.pial:edgecolor=red \
    bert/surf/rh.white:edgecolor=blue \
    bert/surf/rh.pial:edgecolor=red

I get this error:

freeview.bin: error while loading shared libraries: libpng12.so.0: cannot open shared object file: No such file or directory

And when I am trying to install this package:

sudo apt-get install libpng12.so.0

I am getting this error:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
E: Unable to locate package libpng12.0-0:i386
E: Couldn't find any package by glob 'libpng12.0-0'
E: Couldn't find any package by regex 'libpng12.0-0'

I am totally new to Linux, please help!

2
  • Are you using Ubuntu 16.10?
    – fkraiem
    Commented Mar 23, 2017 at 3:38
  • Yes! I am using Ubuntu 16.10
    – New_Coder
    Commented Mar 23, 2017 at 3:40

14 Answers 14

28

you can either

install the supplied .deb file available from

https://packages.ubuntu.com/xenial/amd64/libpng12-0/download

http://security.ubuntu.com/ubuntu/pool/main/libp/libpng/libpng12-0_1.2.54-1ubuntu1.1_amd64.deb

sudo dpkg -i ./libpng12-0_1.2.54-1ubuntu1.1_amd64.deb

or compile and install :

download source code https://packages.ubuntu.com/xenial/libpng12-0

wget http://archive.ubuntu.com/ubuntu/pool/main/libp/libpng/libpng_1.2.54.orig.tar.xz

tar xvf  libpng_1.2.54.orig.tar.xz 

cd libpng-1.2.54
./autogen.sh
./configure
make -j8 
sudo make install

then update the links with:

sudo ldconfig

prior to any of this assure your machine has these preliminary packages installed ... baseline for any dev kit

sudo apt-get update
sudo apt-get upgrade 
sudo apt-get install libtool autoconf build-essential pkg-config automake tcsh

good news is freesurfer 7 on Ubuntu 20.04 runs fine out of the box

4
  • user@linux:~$ ./autogen.sh running libtoolize libtoolize: error: One of these is required: libtoolize: gm4 gnum4 m4 libtoolize: error: Please install GNU M4, or 'export M4=/path/to/gnu/m4'. ERROR: autogen.sh failed, autogen is incomplete user@linux:~$
    – Sabrina
    Commented Sep 14, 2019 at 2:20
  • @Sabrina see I added the preliminary commands Commented Sep 14, 2019 at 12:44
  • Thanks it worked! - the line ./autogen.sh raised an error but I kept going and it all worked
    – cardamom
    Commented Dec 2, 2020 at 15:24
  • This worked but messed up with my python Qt. Has anyone faced this problem?
    – rvimieiro
    Commented Jan 10, 2022 at 14:04
9

The software you are trying to run requires version 12 of libpng, which is no longer available in Ubuntu 16.10+. The best thing to do would be to install Ubuntu 16.04, or maybe let the developers of the software know about this problem so they can provide a version compatible with Ubuntu 16.10.

8

My attempt to follow other suggestions (notably Scott Stensland's) on Ubuntu 20.04 failed, with the following output:

user@machine:~$ sudo dpkg -i libpng12-0_1.2.54-1ubuntu1.1_amd64.deb
Selecting previously unselected package libpng12-0:amd64.
(Reading database ... 69136 files and directories currently installed.)
Preparing to unpack libpng12-0_1.2.54-1ubuntu1.1_amd64.deb ...
Unpacking libpng12-0:amd64 (1.2.54-1ubuntu1.1) ...
dpkg: error processing archive libpng12-0_1.2.54-1ubuntu1.1_amd64.deb (--install):
 unable to install new version of '/lib/x86_64-linux-gnu/libpng12.so.0': No such file or directory
Processing triggers for libc-bin (2.31-0ubuntu9) ...
Errors were encountered while processing:
 libpng12-0_1.2.54-1ubuntu1.1_amd64.deb

Per Linux Uprising, the previous answers do not work on Ubuntu 19/20 because /lib is now a symlink to /usr/lib, and since the libpng12-0 installation tries to link from /lib/x86_64-linux-gnu/libpng12.so.0 to /usr/lib, the installation will fail.

They offered the following fix, which involves a repacked DEB. With the standard caveats about trusting code from unofficial sources, the following will enable libpng12 to run on Ubuntu 20.

sudo add-apt-repository ppa:linuxuprising/libpng12
sudo apt update
sudo apt install libpng12-0
2
  • 1
    Worked for me on Hirsute (21.04)
    – BobHy
    Commented May 28, 2021 at 17:09
  • not working for Lubuntu Kinetic :(
    – Vitas
    Commented Oct 25, 2022 at 12:44
7

Download the shared library from https://packages.ubuntu.com/xenial/amd64/libpng12-0/download and then run sudo dpkg -i

3

You can find this package at

64b http://packages.ubuntu.com/xenial/amd64/libpng12-0/download

32b https://packages.ubuntu.com/xenial/i386/libpng12-0/download

2
  • 1
    Also works in Ubuntu 18.06.
    – hailinzeng
    Commented Oct 4, 2018 at 5:38
  • These links are no longer supported Commented Nov 19, 2022 at 12:08
3

I was having problems installing SAS on Ubuntu 18.04. Some instructions following will only apply to those installing SAS.

The first problem was that the installation would hang on hot fix W83001. Solution is to move hot fix W83001pt.zip out of the <depot>/hot_fix directory so it is not installed.

The second problem was that the following package was needed and not installed by default on Ubuntu: libjpeg.s0.62. Installation was done as follows:

sudo apt install libjpeg62

The third problem was the missing package discussed on this page, libpng12.so.0. It was downloaded from this link and installed as follows:

sudo apt install ./libpng12-0_1.2.54-1ubuntu1.1_amd64.deb

After this, I was able to run the SAS software. Thanks everyone for posting the tips.

2

You don't need to install or compile anything. You just need the .so.* files for runtime.

So just grab the libpng12 .deb from the links provided by people above, download the libpng12.deb, uncompress it like an archive (right click and choose extract instead of install with your file application, e.g nautilus if you use the default gnome desktop), go to the 'data' subfolder, in it you will find another folder, inside you will find a lib folder. Grab the two .so files (libpng12.so.0.*) and put them somewhere in your LD_LIBRARY_PATH so that your application can find them at run time, that's it.

e.g create a folder called libpng in your home and start you application with a script like

#!/bin/bash

export LD_LIBRARY_PATH=$HOME/libpng:$LD_LIBRARY_PATH

<command to start your application>

make the script executable, give it a name, say, my_app, put it in your $PATH like $HOME/bin (create it if it doesn't exist, then logout and login) or /usr/local/bin (this requires sudo) then invoke your application in the terminal by typing my_app or put Exec=my_app in your .desktop file.

1

Another alternative is to create symbolic links to both PNG and JPEG libraries

sudo ln -s -T /usr/lib/x86_64-linux-gnu/libjpeg.so /usr/lib/x86_64-linux-gnu/libjpeg.so.62
sudo ln -s -T /usr/lib/x86_64-linux-gnu/libpng16.so /usr/lib/x86_64-linux-gnu/libpng12.so.0

It will generate some warnings (libpng warning: Application built with libpng-1.2.7 but running with 1.6.28) when running. However, Freeview works ok.

1
  • 1
    I know it's not the same problem, but for anyone trying to install gmic on gimp (ubuntu 17.10) this trick doesn't work ./gmic_gimp_qt: /usr/lib/x86_64-linux-gnu/libpng12.so.0: version 'PNG12_0' not found (required by ./gmic_gimp_qt). The workaround of @Diogo Alves works though for gmic. Commented Oct 27, 2017 at 13:11
1

You can use:

wget http://mirrors.kernel.org/ubuntu/pool/main/libp/libpng/libpng12-0_1.2.54-1ubuntu1_amd64.deb
sudo dpkg -i libpng12.deb
1

I'm using 16.04 64bit, and the following worked for me.

64bit

sudo apt-get install libpng12-0

32bit

sudo apt-get install libpng12-0:i386
0

This fix also works for CANView Log Viewer, used by Yacht Devices for configuring their NMEA 2000 marine devices.

I don't want to turn this thread into an inventory of all the legacy apps using this library, but Yacht Devices hasn't updated their distribution, and I haven't found their sources (there are many apps with this name).

0

If you are using snap, try this below command:

sudo ln -s -T /snap/core/16091/lib/x86_64-linux-gnu/libpng12.so.0 /usr/lib/x86_64-linux-gnu/libpng12.so.0
0

Often time researchers use older versions of FreeSurfer (and similar tools like AFNI which rely on since deprecated packages, see here for a related issue with libXp.so.6).

To solve on Ubuntu 22.04 LTS, there is a newer default version which you should use, namely libpng16.so.x:

# to install
sudo apt-get install libpng-dev

# confirm installation directory
sudo dpkg -S libpng | grep libpng16.so
  • You can spoof the older version name by symbolic linking to whatever deprecated old version you need. It's not guaranteed your old software will work with the newer binaries but generally speaking should suffice. For example:
cd /usr/lib/x86_64-linux-gnu
sudo ln -s libpng16.so.16 libpng12.so.0
0

Going through the below solved the problem regarding this library for me and running multiple packages dependent on this library:

sudo add-apt-repository ppa:linuxuprising/libpng12

sudo apt install libpng12-0

Install Stata16 on Ubuntu 20.04

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .