[Pkg-pascal-devel] Bug#820566: Bug#820566: Bug#820566: view3dscene: please stop depending on libpng12-0

Michalis Kamburelis michalis.kambi at gmail.com
Mon Apr 11 13:34:30 UTC 2016


> @Michalis, does view3dscene work with libpng16, or do you first need to
> port view3dscene to that API? If so, we better just drop the dependency
> for now.

Hi,

I'm not sure what is the dependency ldd detects. It seems that
something (possibly some unit inside FPC RTL?) uses the PNG unit
(which links to libpng in a traditional way and will be detected like
this by ldd).

In any case, like Paul writes, view3dscene (actually, Castle Game
Engine underneath) loads png library by dlopen/dlsym. This way things
work smoothly even when libpng is not available. The loading of libpng
library is trivially coded inside CGE in
src/images/castlepng_dynamic.inc (we just try to open libpng12.so.0,
or libpng.so, or libpng14.so.14...). This probably has to be adjusted
to look also for libpng16.so.16, so it will be a 2-line patch to make
view3dscene (actually, Castle Game Engine) in Debian work with libpng
1.6.

We carefully use a small subset on libpng API that is available in at
least libpng 1.2, 1.4. I can test around the weekend whether it also
works with libpng 1.6, from briefly reading about libpng 1.5 and 1.6
-- we should be fine.

So, the things to do here:

1. Make a 2-line change to CGE to src/images/castlepng_dynamic.inc to
try loading libpng16.so.16 .

2. Test whether view3dscene (actually, everything using Castle Game
Engine) works with this libpng version. Probably yes:)

I'll happily do it in a couple of days, around the nearest weekend:)

Sidenotes:

- The way we use libpng can be reconfigured to use static linking by
defining CASTLE_PNG_STATIC at compilation, see castlepng.pas and
castleconf.inc. Although I don't think it's necessary at this point.

- In the future CGE and view3dscene releases (which can be tested
using our GIT or SVN code right now), by default we use the png loader
provided by the FPC fcl-image library. Which uses png reading
implemented natively in Pascal in FPC fcl-image. This removes the
dependency on libpng entirely. It remains configurable anyway (you can
recompile engine with proper options to alternatively use libpng, with
traditional linking or with dlopen/dlsym).

Regards,
Michalis



More information about the Pkg-pascal-devel mailing list