Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » U++ Library : Other (not classified elsewhere) » libpng on Linux
libpng on Linux [message #46691] Wed, 13 July 2016 11:23 Go to next message
forlano is currently offline  forlano
Messages: 1182
Registered: March 2006
Location: Italy
Senior Contributor
Hello,

my programs use the plugins/png. This means, I believe, that does not matter if the user has installed his version of the png library on Linux.
However one of my user reported that upgrading his distro my program stopped to work:

>> ./Vega7: error while loading shared libraries: libpng12.so.0: cannot
>> open shared object file: No such file or directory

Can I compile statically such package. Can I do something to prevent the problem?

Thanks,
Luigi









Re: libpng on Linux [message #46694 is a reply to message #46691] Wed, 13 July 2016 20:43 Go to previous messageGo to next message
dolik.rce is currently offline  dolik.rce
Messages: 1789
Registered: August 2008
Location: Czech Republic
Ultimate Contributor

Hi Luigi,

forlano wrote on Wed, 13 July 2016 11:23
my programs use the plugins/png. This means, I believe, that does not matter if the user has installed his version of the png library on Linux.


It is only compiled statically on windows. Pretty much every linux system with graphic interface has libpng available, so there is no need to compile it statically. Also it is better in terms of security - distributions often update the libraries with security fixes.

forlano wrote on Wed, 13 July 2016 11:23
However one of my user reported that upgrading his distro my program stopped to work:

>> ./Vega7: error while loading shared libraries: libpng12.so.0: cannot
>> open shared object file: No such file or directory

My guess is, that the problem is not actually missing libpng, but rather wrong version of it. libpng12 is rather old (but many stable distros still use it). If you compiled on system with older version of libpng (where the library name is lipng12.so), it won't run on systems where only newer version (e.g. Arch Linux currently uses libpng16.so) is installed.

forlano wrote on Wed, 13 July 2016 11:23
Can I compile statically such package. Can I do something to prevent the problem?

The most common solution is to compile on the same distribution that the end-user uses. Sometimes it is not simple, but it actually prevents many troubles, not just mixed up libs. Alternatively, you could tweak the flags in plugin/png to make it use static compilation.

Best regards,
Honza







[/quote]
Re: libpng on Linux [message #46697 is a reply to message #46694] Thu, 14 July 2016 11:17 Go to previous messageGo to next message
forlano is currently offline  forlano
Messages: 1182
Registered: March 2006
Location: Italy
Senior Contributor
dolik.rce wrote on Wed, 13 July 2016 20:43

The most common solution is to compile on the same distribution that the end-user uses. Sometimes it is not simple, but it actually prevents many troubles, not just mixed up libs. Alternatively, you could tweak the flags in plugin/png to make it use static compilation.


Hi Honza,

thank you very much for the answer.
I am oriented to link statically the png library to prevent future issue on all other libraries.
Just the last problem, Embarassed , how to tweak the flags? I had a look to theide but I have no idea what to do.
Thanks,
Luigi
Re: libpng on Linux [message #46698 is a reply to message #46697] Thu, 14 July 2016 14:51 Go to previous messageGo to next message
dolik.rce is currently offline  dolik.rce
Messages: 1789
Registered: August 2008
Location: Czech Republic
Ultimate Contributor

Hi Luigi,

In theory, it should be simple: Open the package organizer, choose plugin/png, remove the line that specifies linking with png when !WIN32 and add a new compiler option "-DflagWIN32".

In practice however, it results in segfaults, because "Incompatible libpng version in application and library". Upon further inspection, it turns out that libgdk_pixbuf-2.0 is linked against libpng, which causes further problems. You'd have to link that statically as well, but that might be a lot more trouble than with libpng. But it can be avoided simply by using X11 backend.

Of course, this is more complicated than I originally assumed in my first post. It actually might not be a very good idea to do all this just to make things work everywhere. I'd rather suggest to look at OBS or some similar service that would allow you to build your software for wide variety of distributions. Of course it depends whether you deal with open source or proprietary software. There would be probably more work needed to keep the sources private, but it is doable as well - OBS is opensource so you could run your own private instance.

Honza
Re: libpng on Linux [message #46701 is a reply to message #46691] Thu, 14 July 2016 22:24 Go to previous messageGo to next message
mr_ped is currently offline  mr_ped
Messages: 825
Registered: November 2005
Location: Czech Republic - Praha
Experienced Contributor
Maybe adding the missing .so file together with binary for the particular user, and loading it... ?
Re: libpng on Linux [message #46702 is a reply to message #46701] Fri, 15 July 2016 07:05 Go to previous message
dolik.rce is currently offline  dolik.rce
Messages: 1789
Registered: August 2008
Location: Czech Republic
Ultimate Contributor

mr_ped wrote on Thu, 14 July 2016 22:24
Maybe adding the missing .so file together with binary for the particular user, and loading it... ?

It would work too. You'd need to distribute all the libs that the user might be missing and then just set LD_LIBRARY_PATH to load them. If I remember correctly, there are even tools than can help you to do that automatically.

Honza
Previous Topic: can any one use sciter?
Next Topic: Version of libmysqlclient.so
Goto Forum:
  


Current Time: Thu Mar 28 22:01:32 CET 2024

Total time taken to generate the page: 0.01007 seconds