[SOLVED] libpng error: Incompatible libpng version in application and library
SlackwareThis Forum is for the discussion of Slackware Linux.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
libpng error: Incompatible libpng version in application and library
Trying to run Sauerbraten and Frozen-Bubble on Slackware 13.1 - I get ...
sauerbraten:
Code:
libpng warning: Application was compiled with png.h from libpng-1.4.2
libpng warning: Application is running with png.c from libpng-1.2.43
libpng error: Incompatible libpng version in application and library
frozen-bubble:
Code:
libpng warning: Application was compiled with png.h from libpng-1.4.2
libpng warning: Application is running with png.c from libpng-1.2.43
libpng error: Incompatible libpng version in application and library
I've tried recompiling the libpng 1.4.2 package with the ln -sf libpng.so.3 libpng.so.0 uncommented from the Slackbuild script, and recompiled gd, and still haven't had any success.
libpng warning: Application was compiled with png.h from libpng-1.4.2
libpng warning: Application is running with png.c from libpng-1.2.43
libpng error: Incompatible libpng version in application and library
Location: Geneva - Switzerland ( Bordeaux - France / Montreal - QC - Canada)
Distribution: Slackware 14.2 - 32/64bit
Posts: 609
Rep:
Hi
As said, the binary you use was compiled with a different version of the libpng shared library...
You're post is lacking of a lot of context: did you try to compile it yourself ? How did you install that ?
If it's a precompiled binary, it's not compatible with the runtime version installed on your slackware...
If you compiled it yourself, you might have also used a 'custom' version of libpng which is NOT the version installed on your system, but I doubt you did that, and guess that you simply installed a binary.
The version of libpng that I am using is from the source/l/libpng directory of the Slackware 13.1 DVD ISO image downloaded via Bittorent from the Slackware Website. I do recompile the libpng using the libpng.SlackBuild script supplied by the DVD but I uncomment the section:
libpng.SlackBuild
Code:
# I'm ditching this to see if anyone cares.
#
## This symlink is needed to keep old applications running:
## I guess the real lib used the major number 3, then 0 for
## a short while, and now .3 again. Hopefully it will stay
## this way as it was .3 in Slackware 10.2. One can hope.
( cd $PKG/usr/lib${LIBDIRSUFFIX}
if [ ! -e libpng.so.0 -a -e libpng.so.3 ]; then
ln -sf libpng.so.3 libpng.so.0
fi
)
I then recompile libpng and when it is finished I install the newly compiled binary using:
Then per the instructions from the libpng website I recompile gd from the source/l/gd directory of the Slackware 13.1 DVD ISO image and use the gd.SlackBuild to rebuild the package.
The version of libpng that I am using is from the source/l/libpng directory of the Slackware 13.1 DVD ISO image downloaded via Bittorent from the Slackware Website. I do recompile the libpng using the libpng.SlackBuild script supplied by the DVD but I uncomment the section:
libpng.SlackBuild
Code:
# I'm ditching this to see if anyone cares.
#
## This symlink is needed to keep old applications running:
## I guess the real lib used the major number 3, then 0 for
## a short while, and now .3 again. Hopefully it will stay
## this way as it was .3 in Slackware 10.2. One can hope.
( cd $PKG/usr/lib${LIBDIRSUFFIX}
if [ ! -e libpng.so.0 -a -e libpng.so.3 ]; then
ln -sf libpng.so.3 libpng.so.0
fi
)
I then recompile libpng and when it is finished I install the newly compiled binary using:
Why are you recompiling libpng? Do you have a reason for uncommenting the above lines in the build script? Why aren't you using the most up to date version of libpng provided for Slackware 13.1 (1.4.3)?
Quote:
Originally Posted by Stragonian
Then per the instructions from the libpng website I recompile gd from the source/l/gd directory of the Slackware 13.1 DVD ISO image and use the gd.SlackBuild to rebuild the package.
Are you by any chance using a very old set of my font-rendering patches? Say, from before July of 2010? Some early versions (from around that time) had bugs that could cause this problem.
The current versions, needless to say, can run build and run Frozen Bubble just fine. I just tried it.
(Mike_M) I recompiled libpng to begin with because I got the following error when I tried to play Sauerbraten and figure I'd try uncommenting the libpng.so.0 portion of the libpng.Slackbuild script to see if that would help ... it didn't!
Code:
libpng warning: Application was compiled with png.h from libpng-1.4.2
libpng warning: Application is running with png.c from libpng-1.2.43
libpng error: Incompatible libpng version in application and library
I finally got the libpng problem solved. Turns out when I compiled both gd and SDL_image they link with libpng 1.2.43 by default if I recompile the slackware 13.1's libpng.Slackbuild and comment out everything that has to do with libpng 1.2.43 and recompile the package with only the libpng 1.4.2 library then recompile gd and SDL_image I can then play Sauerbraten, after which if I recompile frozen-bubble, and Supertux2 they both work.
gd was:
Code:
checking for libpng12-config... /usr/bin/libpng12-config
checking for libpng-config... /usr/bin/libpng-config
gd now:
Code:
checking for libpng12-config... no
checking for libpng-config... /usr/bin/libpng-config
SDL_image was:
Code:
-- dynamic libpng -> libpng.so.3
SDL_image now:
Code:
-- dynamic libpng -> libpng.so.14
Ok, so here is what I did:
1. I comment out everything libpng 1.2.43 from the DVD libpng.SlackBuild script then recompile and install
2. Recompile gd from the DVD gd.SlackBuild script and got
Code:
checking for libpng12-config... no
checking for libpng-config... /usr/bin/libpng-config or /usr/local/bin/libpng-config
appears in the configuration
3. Recompile SDL_image.SlackBuild using this SDL_image.SlackBuild the script below
Code:
#!/bin/sh
PRGNAM=SDL_image
VERSION=1.2.10
TAG=${TAG:-_SBo}
if [ -z $DISTRIBUTION ]; then
BUILD=${BUILD:-1}
else
BUILD=$DISTRIBUTION
fi
# Automatically determine the architecture we're building on:
if [ -z "$ARCH" ]; then
case "$( uname -m )" in
i?86) ARCH=i486 ;;
arm*) ARCH=arm ;;
# Unless $ARCH is already set, use uname -m for all other archs:
*) ARCH=$( uname -m ) ;;
esac
fi
CWD=$(pwd)
TMP=${TMP:-/tmp/SBo}
PKG=$TMP/package-$PRGNAM
OUTPUT=${OUTPUT:-/tmp}
if [ "$ARCH" = "i686" ]; then
SLKCFLAGS="-O2 -march=i686 -mtune=i686"
ARCHLD="-L/lib -L/usr/lib"
elif [ "$ARCH" = "i486" ]; then
SLKCFLAGS="-O2 -march=i486 -mtune=i686"
ARCHLD="-L/lib -L/usr/lib"
elif [ "$ARCH" = "i386" ]; then
SLKCFLAGS="-O2 -march=i386 -mcpu=i686"
ARCHLD="-L/lib -L/usr/lib"
elif [ "$ARCH" = "s390" ]; then
SLKCFLAGS="-O2"
elif [ "$ARCH" = "x86_64" ]; then
SLKCFLAGS="-O2 -fPIC"
LIBDIRSUFFIX="64"
ARCHLD="-L/lib64 -L/usr/lib64"
fi
set -e
rm -rf $PKG
mkdir -p $TMP $PKG $OUTPUT
cd $TMP
rm -rf $PRGNAM-$VERSION
tar xvf $CWD/$PRGNAM-$VERSION.tar.gz
cd $PRGNAM-$VERSION
chown -R root:root .
chmod -R a-s,u+rw,go+r-w .
LDFLAGS="$ARCHLD" \
CFLAGS="$SLKCFLAGS" \
CXXFLAGS="$SLKCFLAGS" \
./configure \
--prefix=/usr \
--libdir=/usr/lib${LIBDIRSUFFIX} \
--mandir=/usr/man \
--enable-dependency-tracking \
--build=$ARCH-slackware-linux
make
make install DESTDIR=$PKG
find $PKG | xargs file | grep -e "executable" -e "shared object" | grep ELF \
| cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
if [ -d $PKG/usr/man ]; then
( cd $PKG/usr/man
find . -type f -exec gzip -9 {} \;
for i in $(find . -type l) ; do ln -s $(readlink $i).gz $i.gz ; rm $i ; done
)
fi
mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
cp -a \
README COPYING CHANGES \
$PKG/usr/doc/$PRGNAM-$VERSION
cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
mkdir -p $PKG/install
cat $CWD/slack-desc > $PKG/install/slack-desc
cd $PKG
/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz}
and this slack-desc
Code:
# HOW TO EDIT THIS FILE:
# The "handy ruler" below makes it easier to edit a package description. Line
# up the first '|' above the ':' following the base package name, and the '|'
# on the right side marks the last column you can put a character in. You must
# make exactly 11 lines for the formatting to be correct. It's also
# customary to leave one space after the ':'.
|-----handy-ruler------------------------------------------------------|
SDL_image: SDL_image (Sample Image Loading Library for SDL)
SDL_image:
SDL_image: This is a simple library to load images of various formats as SDL
SDL_image: surfaces. This library supports BMP, PPM, PCX, GIF, JPEG, PNG, and
SDL_image: TIFF formats.
SDL_image:
SDL_image:
SDL_image:
SDL_image: License: LGPL
SDL_image: Author: Sam Lantinga and Mattias Engdegård
SDL_image: Website: http://www.libsdl.org/projects/SDL_image/
SDL image dynamicly linked with libpng.so.14
Code:
-- dynamic libpng -> libpng.so.14
4. Reinstall sauerbraten - Works
5. Recompile frozen-bubble from Slackbuild.org - Works
6. Recompile Supertux2 - Works
Fri Jul 29 18:22:40 UTC 2011
patches/packages/dhcpcd-5.2.12-x86_64-1_slack13.1.txz: Upgraded.
Sanitize the host name provided by the DHCP server to insure that it does
not contain any shell metacharacters.
For more information, see:
http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2011-0996
(* Security fix *)
patches/packages/libpng-1.4.8-x86_64-1_slack13.1.txz: Upgraded.
Fixed uninitialized memory read in png_format_buffer()
(Bug report by Frank Busse, related to CVE-2004-0421).
For more information, see:
http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2011-0421
(* Security fix *)
patches/packages/samba-3.5.10-x86_64-1_slack13.1.txz: Upgraded.
Fixed cross-site request forgery and cross-site scripting vulnerability
in SWAT (the Samba Web Administration Tool).
For more information, see:
http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2011-2522
http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2011-2694
(* Security fix *)
I wrote a bash script that fixes this for me, if you have an x86_64 and have not installed Alien Bob's compat32 library's then you'll need to comment out that part of the script.
Code:
#!/bin/bash
# Script to fix libpng error in Slackware 13.1 with gd and SDL_image
DIR=$( pwd )
# Automatically determine the architecture we're building on:
if [ -z "$ARCH" ]; then
case "$( uname -m )" in
i?86) ARCH=i486 ;;
arm*) ARCH=arm ;;
# Unless $ARCH is already set, use uname -m for all other archs:
*) ARCH=$( uname -m ) ;;
esac
fi
if [ "$ARCH" = "i486" ]; then
LIBDIRSUFFIX=""
elif [ "$ARCH" = "i686" ]; then
LIBDIRSUFFIX=""
elif [ "$ARCH" = "x86_64" ]; then
SLKCFLAGS="-O2 -fPIC"
LIBDIRSUFFIX="64"
else
LIBDIRSUFFIX=""
fi
if [ "$ARCH" = "x86_64" ]; then
# remove Alien Bob's compat32 libpng library
removepkg libpng-compat32-1.4.2-x86_64-1
fi
# Find the libpng package files and remove them
LIBPNG_PACKAGE=$(ls /var/log/packages | grep libpng)
removepkg $LIBPNG_PACKAGE
# Clean up the remaining files
rm -f /usr/lib${LIBDIRSUFFIX}/libpng*
rm -fR /usr/doc/libpng-*
# Compile and install libpng 1.4 only package
export DO_INSTALL="YES"
cd ${DIR}/SourceCode/libpng
./libpng-1.4-only.SlackBuild
# Recompile and install gd
export DO_INSTALL="YES"
cd ${DIR}/SourceCode/gd
./gd.SlackBuild
# Recompile and Install SDL_image
export DO_INSTALL="YES"
cd ${DIR}/SourceCode/SDL_image
./SDL_image.SlackBuild
# Find the libpng 1.4-only package files and remove them
LIBPNG_PACKAGE=$(ls /var/log/packages | grep libpng)
removepkg $LIBPNG_PACKAGE
rm -f /usr/lib${LIBDIRSUFFIX}/libpng*
rm -fR /usr/doc/libpng-*
# Recompile and install the original libpng
export DO_INSTALL="YES"
cd ${DIR}/SourceCode/libpng
./libpng.SlackBuild
if [ "$ARCH" = "x86_64" ]; then
# Reinstall Alien Bob's compat32 library
cd ${DIR}/Multilib-13.1/slackware64-compat32/l-compat32
upgradepkg --reinstall --install-new libpng-compat32-1.4.2-x86_64-1.txz
fi
So here is the libpng Sackbuild I modified to only compile the 1.4 library( libpng-1.4-only.SlackBuild )
Code:
#!/bin/sh
# Copyright 2005-2010 Patrick J. Volkerding, Sebeka, MN, USA
# All rights reserved.
#
# Modified for 1.4 library only by Jerry Nettrouer II <j2@inpito.org>
#
# Redistribution and use of this script, with or without modification, is
# permitted provided that the following conditions are met:
#
# 1. Redistributions of this script must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
# VERSION_OLD=1.2.43
VERSION_NEW=1.4.2
BUILD=${BUILD:-1}
# Automatically determine the architecture we're building on:
if [ -z "$ARCH" ]; then
case "$( uname -m )" in
i?86) export ARCH=i486 ;;
arm*) export ARCH=arm ;;
# Unless $ARCH is already set, use uname -m for all other archs:
*) export ARCH=$( uname -m ) ;;
esac
fi
if [ "$ARCH" = "x86_64" ]; then
LIBDIRSUFFIX="64"
else
LIBDIRSUFFIX=""
fi
CWD=$(pwd)
TMP=${TMP:-/tmp}
PKG=$TMP/package-libpng
rm -rf $PKG
mkdir -p $TMP $PKG/usr
build_source() {
cd $TMP
rm -rf libpng-$VERSION
tar xvf $CWD/libpng-$VERSION.tar.?z* || exit 1
cd libpng-$VERSION
chown -R root:root .
find . \
\( -perm 777 -o -perm 775 -o -perm 711 -o -perm 555 -o -perm 511 \) \
-exec chmod 755 {} \; -o \
\( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \
-exec chmod 644 {} \;
# Look like using ./configure is the only way that works now...
./configure --prefix=/usr \
--libdir=/usr/lib${LIBDIRSUFFIX} \
--mandir=/usr/man
make -j4 prefix=/usr LIBPATH=/usr/lib${LIBDIRSUFFIX} ZLIBLIB="-L/usr/lib${LIBDIRSUFFIX} -lm -lz" || exit 1
make install prefix=/usr LIBPATH=/usr/lib${LIBDIRSUFFIX} ZLIBLIB="-L/usr/lib${LIBDIRSUFFIX} -lm -lz" DESTDIR=$PKG
# I'm ditching this to see if anyone cares.
#
## This symlink is needed to keep old applications running:
## I guess the real lib used the major number 3, then 0 for
## a short while, and now .3 again. Hopefully it will stay
## this way as it was .3 in Slackware 10.2. One can hope.
( cd $PKG/usr/lib${LIBDIRSUFFIX}
if [ ! -e libpng.so.0 -a -e libpng.so.3 ]; then
ln -sf libpng.so.3 libpng.so.0
fi
)
# Well, glad I got rid of the above, but <someone> upstream still does not
# grok shared libraries on Linux it seems -- libpng-1.4.0 caused all the
# newly compiled binaries to want libpng.so.14, and now libpng-1.4.1
# wants to change that to libpng14.so.14. Searching online finds that
# we are not the only ones with binaries that want libpng.so.14, so we
# are forced to provide a compatibility symlink again... :-/
#
# We'll try to remove this in 5 to 10 years, just like before.
#( cd $PKG/usr/lib${LIBDIRSUFFIX}
# if [ ! -e libpng.so.14 -a -e libpng14.so.14 ]; then
# ln -sf libpng14.so.14 libpng.so.14
# fi
#)
find $PKG | xargs file | grep -e "executable" -e "shared object" \
| grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null
gzip -9 --force $PKG/usr/man/man?/*.?
mkdir -p $PKG/usr/doc/libpng-$VERSION
cp -a \
ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO \
libpng*.txt example.c \
$PKG/usr/doc/libpng-$VERSION
# If there's a ChangeLog, installing at least part of the recent history
# is useful, but don't let it get totally out of control:
if [ -r ChangeLog ]; then
DOCSDIR=$(echo $PKG/usr/doc/libpng-$VERSION)
cat ChangeLog | head -n 1000 > $DOCSDIR/ChangeLog
touch -r ChangeLog $DOCSDIR/ChangeLog
fi
}
# Build the 1.2 version:
# VERSION=$VERSION_OLD
# build_source
# Build the 1.4 version:
VERSION=$VERSION_NEW
build_source
# Default the includes to version 1.4.x:
( cd $PKG/usr/include ; ln -sf libpng14 libpng )
mkdir -p $PKG/install
cat $CWD/slack-desc > $PKG/install/slack-desc
cd $PKG
/sbin/makepkg -l y -c n $TMP/libpng-$VERSION-$ARCH-only.txz
if [ "$DO_INSTALL" = "YES" ]; then
upgradepkg --reinstall --install-new $TMP/libpng-$VERSION-$ARCH-only.txz
fi
If you want to compile and install through the whole process then add the DO_INSTALL logic to all the affected scripts for compiling.
parent script
Code:
export DO_INSTALL="YES"
child script
Code:
if [ "$DO_INSTALL" = "YES" ]; then
# I just usually copy the makepkg package name
upgradepkg --reinstall --install-new <package name here>
fi
Location: Geneva - Switzerland ( Bordeaux - France / Montreal - QC - Canada)
Distribution: Slackware 14.2 - 32/64bit
Posts: 609
Rep:
Quote:
Originally Posted by Stragonian
...
Code:
#!/bin/bash
# Script to fix libpng error in Slackware 13.1 with gd and SDL_image
DIR=$( pwd )
...
Just a quick reading, and I'd suggest:
Code:
DIR="$(cd "$(dirname "$0")" ; pwd -P)"
instead, so you can launch it from any directory (as far as your script resides in the base directory you're doing your stuff)....
Also a lot of double quotes are missing in the directories name, and so it doesn't handle directories with spaces...
Edit:Sorry for the next remark, you used it well, I don't understand, I might have read to fast, but I can't find the place that shocked my eyes ... My bad...
Edit 2:Oh yes, it was that:
Code:
cd ${DIR}/SourceCode/libpng
As a side note too, ${var} is really necessary, in some case, mostly when you want to merge strings like this:
Code:
MERGED="${PREFIX}suffix"
But it's useless if used glued to other chars not used into variable identifiers like:
Code:
MERGED="$PREFIX-suffix" #<- totally valid..
it's not a big deal, but I find it (personally) easier to read this way.
There might be some more improvements, it was just a quick overview.
Btw, I don't have any problem with this, but thank you anyway, this may be helpful for some users.
Cheers
Garry.
Last edited by NoStressHQ; 11-18-2011 at 11:12 AM.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.