Skip Menu |
 

This queue is for tickets about the Imager CPAN distribution.

Report information
The Basics
Id: 74043
Status: resolved
Priority: 40/
Queue: Imager

People
Owner: Nobody in particular
Requestors: Ralf.Neubauer [...] wido.bv.aok.de
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: (no value)
Fixed in: (no value)



Subject: Can't get to build with PNG on Windows without strange workaround
Date: Mon, 16 Jan 2012 19:04:53 +0100
To: <bug-Imager [...] rt.cpan.org>
From: "Neubauer, Ralf" <Ralf.Neubauer [...] wido.bv.aok.de>
Download (untitled) / with headers
text/plain 1.4k
I am struggling to get PNG support under Windows: libpng needs zlib. I use the official DLL from http://zlib.net/zlib125-dll.zip , which gives me a lib\libzdll.a (via the recommended "copy lib\zdll.lib lib\libzdll.a"). Thus i get a libpng.a, which is only linkable together with libzdll. I.e. if you use -lpng, you also have to pass -lzdll, or the zlib symbols will be missing. (Maybe I'm doing something wrong in this step; as I want/have to build with the compiler perl was built with (MinGW), I can't use the windows build commands distributed with http://download.sourceforge.net/libpng/lpng157.zip). Normally i would just set IM_LFLAGS=-lzdll, but Imager\Probe.pm totally ignores the LFLAGS. And Win32 won't get detected with -lzdll on the command line, because the IM_LIBPATH is ignored by the Win32 probing code, apparently. So I resorted to this workaround: Imager 0.86 and before: perl -i.bak -pe "$q='\\'.chr(34); s/($q-l\$libbase)($q)/$1 -lzdll$2/" lib\Imager\Probe.pm (Note the difficulties with escaping the " for the CMD shell and for the perl running under the shell) Imager 0.87: perl -i.bak -pe "$q='\\'.chr(34); s/($q-l\$req->\{libbase\})($q)/\$req->\{libbase\} eq 'png' ? $1 -lzdll$2 : $1$2/; s/($q-l\$base)($q)/($1$2, \$base eq 'png' ? ($2-lzdll$2) : ())/" lib\Imager\Probe.pm Note the special casing for png. Do you think this could be made easier? E.g. with a zoo of per library environment variables like IM_LFLAGS_PNG, which get evaluated for building and for probing? Ralf
On Mon Jan 16 13:05:07 2012, Ralf.Neubauer@wido.bv.aok.de wrote: Show quoted text
> I am struggling to get PNG support under Windows: > > libpng needs zlib. I use the official DLL from > http://zlib.net/zlib125-dll.zip , which gives me a lib\libzdll.a (via > the recommended "copy lib\zdll.lib lib\libzdll.a"). Thus i get a > libpng.a, which is only linkable together with libzdll. I.e. if you use > -lpng, you also have to pass -lzdll, or the zlib symbols will be > missing. (Maybe I'm doing something wrong in this step; as I want/have > to build with the compiler perl was built with (MinGW), I can't use the > windows build commands distributed with > http://download.sourceforge.net/libpng/lpng157.zip). > > Normally i would just set IM_LFLAGS=-lzdll, but Imager\Probe.pm totally > ignores the LFLAGS. And Win32 won't get detected with -lzdll on the > command line, because the IM_LIBPATH is ignored by the Win32 probing > code, apparently. So I resorted to this workaround: > > Imager 0.86 and before: > perl -i.bak -pe "$q='\\'.chr(34); s/($q-l\$libbase)($q)/$1 -lzdll$2/" > lib\Imager\Probe.pm > > (Note the difficulties with escaping the " for the CMD shell and for the > perl running under the shell) > > Imager 0.87: > perl -i.bak -pe "$q='\\'.chr(34); > s/($q-l\$req->\{libbase\})($q)/\$req->\{libbase\} eq 'png' ? $1 -lzdll$2 > : $1$2/; s/($q-l\$base)($q)/($1$2, \$base eq 'png' ? ($2-lzdll$2) : > ())/" lib\Imager\Probe.pm > > Note the special casing for png. Do you think this could be made easier? > E.g. with a zoo of per library environment variables like IM_LFLAGS_PNG, > which get evaluated for building and for probing?
Sorry I haven't replied earlier. I'll need to think about how to approach this. If libpng and libzdll are both DLL I'm kind of surprised that Windows doesn't load libz by reference from libpng.dll. I'll need to do some testing and experimentation to see how to solve it. The way I've been testing this on Win32 is with the libraries shipped with Strawberry perl, and only -lpng is supplied to the link process there. Tony
Download (untitled) / with headers
text/plain 767b
On Mon Jan 16 13:05:07 2012, Ralf.Neubauer@wido.bv.aok.de wrote: Show quoted text
> I am struggling to get PNG support under Windows: > > libpng needs zlib. I use the official DLL from > http://zlib.net/zlib125-dll.zip , which gives me a lib\libzdll.a (via > the recommended "copy lib\zdll.lib lib\libzdll.a"). Thus i get a > libpng.a, which is only linkable together with libzdll. I.e. if you use > -lpng, you also have to pass -lzdll, or the zlib symbols will be > missing. (Maybe I'm doing something wrong in this step; as I want/have > to build with the compiler perl was built with (MinGW), I can't use the > windows build commands distributed with > http://download.sourceforge.net/libpng/lpng157.zip).
I'm trying to reproduce your problem - how did you build libpng.a? Tony
Subject: RE: [rt.cpan.org #74043] Can't get to build with PNG on Windows without strange workaround
Date: Tue, 17 Apr 2012 10:34:45 +0200
To: <bug-Imager [...] rt.cpan.org>
From: "Neubauer, Ralf" <Ralf.Neubauer [...] wido.bv.aok.de>
Download (untitled) / with headers
text/plain 2.1k
[...] for %%p in (MinGW Tk Win32::FileOP File::Slurp Perl::OSType Module::Metadata) do call ppm install %%p [...] :makezlib cd /d %DOWNLOAD% wget -N http://zlib.net/zlib-1.2.6.tar.gz cd /d %BUILD% gzip -cd %DOWNLOAD%\zlib-1.2.6.tar.gz | tar xvf - cd zlib-1.2.6 perl -i.bak -pe "s/strip/echo/" win32\Makefile.gcc dmake -f win32\Makefile.gcc copy *.h %INCLUDE% copy lib*.a %LIB% copy *.dll %DLL% :makepng cd /d %DOWNLOAD% wget -N http://download.sourceforge.net/libpng/lpng159.zip cd /d %BUILD% unzip %DOWNLOAD%\lpng159.zip cd lpng159 perl -pe "s/^(ZLIBINC = ).*$s/$1$ENV{INCLUDE}/; s/^(ZLIBLIB = ).*$s/$1$ENV{LIB}/; s/^(RANLIB = ).*$/$1echo/; s/^(EXE = ).*$/$1.exe/;" scripts\makefile.gcc > makefile dmake copy *.h %INCLUDE% copy lib*.a %LIB% [...] -- Mit freundlichen Grüßen Ralf Neubauer Arzneimittelinformationssysteme und Analysen Wissenschaftliches Institut der AOK (WIdO) Rosenthaler Straße 31 10178 Berlin www.wido.de Tel.: 030-34646-2583 Fax: 030-34646-2144 E-Mail: Ralf.Neubauer@wido.bv.aok.de Show quoted text
> -----Original Message----- > From: TONYC via RT [mailto:bug-Imager@rt.cpan.org] > Sent: Monday, January 23, 2012 9:16 AM > To: Neubauer, Ralf > Subject: [rt.cpan.org #74043] Can't get to build with PNG on Windows without strange workaround > > <URL: https://rt.cpan.org/Ticket/Display.html?id=74043 > > > On Mon Jan 16 13:05:07 2012, Ralf.Neubauer@wido.bv.aok.de wrote:
> > I am struggling to get PNG support under Windows: > > > > libpng needs zlib. I use the official DLL from > > http://zlib.net/zlib125-dll.zip , which gives me a lib\libzdll.a (via > > the recommended "copy lib\zdll.lib lib\libzdll.a"). Thus i get a > > libpng.a, which is only linkable together with libzdll. I.e. if you use > > -lpng, you also have to pass -lzdll, or the zlib symbols will be > > missing. (Maybe I'm doing something wrong in this step; as I want/have > > to build with the compiler perl was built with (MinGW), I can't use the > > windows build commands distributed with > > http://download.sourceforge.net/libpng/lpng157.zip).
> > I'm trying to reproduce your problem - how did you build libpng.a? > > Tony
On Mon Jan 16 13:05:07 2012, Ralf.Neubauer@wido.bv.aok.de wrote: Show quoted text
> Note the special casing for png. Do you think this could be made easier? > E.g. with a zoo of per library environment variables like IM_LFLAGS_PNG, > which get evaluated for building and for probing?
Hi Ralf, I believe I've fixed this for the next release of Imager. I built and installed libz and libpng per your detailed (thank you!) instructions and reproduced the failure. I made three basic changes: - Imager::Probe now does the testcode check as part of accepting a configuration as good, so if it fails it can go on to test other alternatives - the libbase parameter can now be an arrayref, so I can specify that both libpng and libz are required. - PNG/Makefile.PL now includes extra configurations that test for libpng and libz. If you want to test it out and have a git client, please: git clone git://git.imager.perl.org/imager.git cd imager perl Makefile.PL # the summary should show PNG as detected dmake test Thanks for your help with this Tony
Subject: Abwesenheitsnotiz: [rt.cpan.org #74043] Can't get to build with PNG on Windows without strange workaround
Date: Sat, 28 Apr 2012 04:54:38 +0200
To: "TONYC via RT" <bug-Imager [...] rt.cpan.org>
From: "Neubauer, Ralf" <Ralf.Neubauer [...] wido.bv.aok.de>
Download (untitled) / with headers
text/plain 390b
Guten Tag, vielen Dank für Ihre Nachricht. Am 02. Mai bin ich wieder im Hause. Ihre Mail wird nicht weitergeleitet. In dringenden Fällen können Sie sich, wenn es das Projekt ZenDa betrifft, an die ZenDa-Projektadresse (zenda@wido.bv.aok.de) und bei Fragen zum Projekt pharmPRO an die pharmPRO-Projektadresse (pharmpro@wido.bv.aok.de) wenden. Mit freundlichen Grüßen, Ralf Neubauer
Download (untitled) / with headers
text/plain 1.1k
On Fri Apr 27 22:54:26 2012, TONYC wrote: Show quoted text
> On Mon Jan 16 13:05:07 2012, Ralf.Neubauer@wido.bv.aok.de wrote:
> > Note the special casing for png. Do you think this could be made easier? > > E.g. with a zoo of per library environment variables like IM_LFLAGS_PNG, > > which get evaluated for building and for probing?
> > Hi Ralf, > > I believe I've fixed this for the next release of Imager. > > I built and installed libz and libpng per your detailed (thank you!) > instructions and reproduced the failure. > > I made three basic changes: > > - Imager::Probe now does the testcode check as part of accepting a > configuration as good, so if it fails it can go on to test other > alternatives > > - the libbase parameter can now be an arrayref, so I can specify that > both libpng and libz are required. > > - PNG/Makefile.PL now includes extra configurations that test for libpng > and libz. > > If you want to test it out and have a git client, please: > > git clone git://git.imager.perl.org/imager.git > cd imager > perl Makefile.PL > # the summary should show PNG as detected > dmake test > > Thanks for your help with this
This has been released as Imager 0.90. Thanks, Tony


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.