Question

I need to upgrade libpng from version 1.2 to 1.5. I need to do so because of this: libpng warning: Application built with libpng-1.2.26 but running with 1.5.2. I am using Lubuntu 11.10 and in the Canonical repositories libnpg 1.5 is not still released although at Debian ones there are testing packages (http://packages.debian.org/search?keywords=libpng) that at first they would fit to me. I added the Debian repositories to Synaptec and I was able to install libpng15, but those packages do not replace libpng12, son when it comes to compile some source code the IDE uses libpng12 instead of libpng15.

To try to solve this I downloaded the libpng15 deb package, uncompressed it and changed the Replaces, Conflicts and Provides tags of the control file with the libpng15 text. Then, I executed the modified deb, but what I only got was a GDebi error and a general system failure because (I think) libpng12 was uninstalled with no replacement and Lubuntu heavily depends on it, which forced me to reinstall Lubuntu because the computer did not boot again in Linux. Yes, this solution is not the neatest way I think.

So, is there any way to upgrade a package and replace the old version whose newer version exists but it is not still in the distribution repository? I found ubuntu repository for libpng and How to upgrade a package in linux that was built from source?. Although not very determinant so far.

Was it helpful?

Solution

I have not found out how to upgrade and replace a package whose newer version is not still in the distribution repository. But I have realized that if some library X relies on a given version of other library Y, there is no way to change the version of that dependence unless you make some change onto the source code of X, that is it, the library X is recompiled to point to the desired version (usually with the help of some configuration tag). Even though some trick could be done as by modifying the symlink of the library Y to point to the newer version. Then, the compiler will complain and ask for the old version.

Maybe this looks obvious now. But if the software that has to be recompiled requires many hours, has unresolved dependences or gives built errors you will try to avoid the compilation no matter if you are violating thermodynamics laws.

So in my case I had to recompile Qt and by using the -system-libpng configuration tag Qt understood it had to use system libpng libraries, not in-built ones. And after 8 hours of compiling I got a successfully built which solved this libpng problem.

Thanks everyone for the comments and suggests.

OTHER TIPS

For all of the trouble you're going through, it might be easier to simply compile from source, and install to /usr/local (instead of /usr, as debs do). I've done this for several library dependencies for programs I've compiled (with make build systems) without any trouble. However, it sounds like the program(s) you're compiling are having trouble choosing the right version of the package. In my opinion, that is the real issue. Having multiple versions of a library installed simultaneously is supported, but perhaps not by apt in the case of mixing Debian and Ubuntu repos.

When you compile your program, use gcc -lpng15 instead of -lpng. According to the gcc info manual, an option of -lname causes the linker to look for libname.a in the lib folders. On my system (Ubuntu 10.04), libpng.a is a symlink to libpng12.a. This is why your program is choosing the wrong lib.

Try adding this ppa: https://launchpad.net/~linaro-maintainers/+archive/overlay. It contains libpng1.5 for Oneiric.

You can install it by running

sudo add-apt-repository ppa:linaro-maintainers/overlay
sudo apt-get update
sudo apt-get install libpng1.5

To properly link against libpng15, you will also need to install libpng15-dev.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top