Bug 691111 - ghostscript-8.71 fails to compile against >=libpng-1.4.0
ghostscript-8.71 fails to compile against >=libpng-1.4.0
Product: Ghostscript
Classification: Unclassified
Component: Build Process
PC Linux
: P4 normal
Assigned To: Hin-Tak Leung
Bug traffic
Depends on:
  Show dependency treegraph
Reported: 2010-02-15 13:40 PST by Timo Gurr
Modified: 2010-06-29 04:44 PDT (History)
0 users

See Also:
Word Size: ---

ghostscript-gpl-8.71-libpng-1.4.0-compile-fix.patch (458 bytes, patch)
2010-02-15 13:42 PST, Timo Gurr
Details | Diff
ghostscript-gpl-8.71-libpng-1.4.0-compile-fix-v2.patch (1.45 KB, patch)
2010-03-08 11:38 PST, Timo Gurr
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Timo Gurr 2010-02-15 13:40:46 PST
On Gentoo Linux we don't use any bundled libraries and try to link as much as 
possible against system-wide libs. I'm aware that the ghostscript bundled 
version is libpng 1.2.42, which works quite fine.

Error when compiling against libpng-1.4.0:

./obj/../soobj/echogs -e .dev -w- -l-dev2 -b -s -l-include
-l./obj/../soobj/page -l-obj ./obj/../soobj/pksmraw ./obj/../soobj/gdevpbm.o
./obj/../soobj/gdevppla.o ./obj/../soobj/gdevmpla.o                             
./obj/../soobj/echogs -e .dev -w- -l-dev2 -b -s -l-include
-l./obj/../soobj/page -l-obj ./obj/../soobj/plan9bm ./obj/../soobj/gdevpbm.o
./obj/../soobj/gdevppla.o ./obj/../soobj/gdevmpla.o
make[1]: *** No rule to make target `src/png.c', needed by
`obj/../soobj/png.o'.  Stop.
make[1]: Leaving directory
make: *** [so] Error 2

Attached is a patch which works around the problem, author of the patch is Lars 
Wendler (Polynomial-C) <polynomial-c@gentoo.org>, added the original bugreport 
on our Gentoo bugtracker in URL.
Comment 1 Timo Gurr 2010-02-15 13:42:20 PST
Created attachment 5955 [details]
Comment 2 Timo Gurr 2010-03-08 11:38:30 PST
Created attachment 6041 [details]
Comment 3 Hin-Tak Leung 2010-05-02 03:12:47 PDT
Grabbing a Ralph's bugs.
Comment 4 Hin-Tak Leung 2010-06-28 03:16:48 PDT
(In reply to comment #2)
> Created an attachment (id=6041) [details]
> ghostscript-gpl-8.71-libpng-1.4.0-compile-fix-v2.patch

Sorry, the patch is wrong - in 1.4.0, png_check_sig() is removed and replaced by    png_sig_cmp() so applying it would break building against linpng 1.2.x .

It would be far better to modify configure to check for a function which is common to both 1.2.x and 1.4.x, rather than switching between the two. e.g. check if png_struct is defined or png_create_write_struct() is defined. (these are actually used by the png device so rather more appropriate than either png_check_sig() or png_sig_cmp()).
Comment 5 Hin-Tak Leung 2010-06-29 04:44:22 PDT
r11449 switches the png test away from png_sig_cmp() (obsolete/removed in libpng 1.4) to png_create_write_struct() which is actually used by the png device, and common to both libpng 1.2.x and 1.4.x , to allow building against either versions.

As explained, the submitted patch was wrong. Also, configure.ac is usually sym-link to "base/configure.ac", so only two files needed to be modified, rather than three.