Home » U++ Library support » U++ Library : Other (not classified elsewhere) » libpng on Linux
|
Re: libpng on Linux [message #46694 is a reply to message #46691] |
Wed, 13 July 2016 20:43   |
|
Hi Luigi,
forlano wrote on Wed, 13 July 2016 11:23my 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:23However 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:23Can 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 #46698 is a reply to message #46697] |
Thu, 14 July 2016 14:51   |
|
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 #46702 is a reply to message #46701] |
Fri, 15 July 2016 07:05  |
|
mr_ped wrote on Thu, 14 July 2016 22:24Maybe 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
|
|
|
Goto Forum:
Current Time: Fri Apr 25 19:01:18 CEST 2025
Total time taken to generate the page: 0.00730 seconds
|