Pngcrush build error with ptrdiff_t when bulding with zlib-1.2.8
Brought to you by:
glennrp
1.8.11 failed to build on x86 (works on x86_64)
Tested with Slackware 14.2, GCC 5.3.0, zlib-1.2.8
Build error:
gcc -c -DLIBPNG_UNIFIED -I. -DNO_GZ -DPNGCRUSH_USE_ARM_NEON -DPNGCRUSH_USE_MPS_MSA -DPNGCRUSH_USE_INTEL_SSE -DPNG_INTEL_SSE -O3 -funroll-loops -fomit-frame-pointer pngcrush.c
gcc -c -DLIBPNG_UNIFIED -I. -DNO_GZ -DPNGCRUSH_USE_ARM_NEON -DPNGCRUSH_USE_MPS_MSA -DPNGCRUSH_USE_INTEL_SSE -DPNG_INTEL_SSE -O3 -funroll-loops -fomit-frame-pointer adler32.c
In file included from adler32.c:8:0:
zutil.h:33:17: error: conflicting types for ‘ptrdiff_t’
typedef long ptrdiff_t; /* guess -- will be caught if guess is wrong */
^
In file included from zconf.h:247:0,
from zlib.h:34,
from zutil.h:22,
from adler32.c:8:
/usr/lib/gcc/i586-slackware-linux/5.3.0/include/stddef.h:149:26: note: previous declaration of ‘ptrdiff_t’ was here
typedef __PTRDIFF_TYPE__ ptrdiff_t;
^
Makefile:71: recipe for target 'adler32.o' failed
make: *** [adler32.o] Error 1
Sorry, i forgot to put a title for this ticket
No problem, I added one.
Please try building with zlib-1.2.11.
Last edit: Glenn Randers-Pehrson 2017-06-01
Hi Glenn,
I'm afraid that's quite complicated in my situation.
zlib is part of Slackware core packages, while pngcrush came in as third party application from SBo project and we have a strict rule that it should build on top of Slackware's core package.
Patrick (Slackware maintainer) is very strict on introducing new version on -stable releases, except for security updates. Since there has been no security vulns report on zlib, i don't really think he would accept this proposal. Also, same code works in x86_64. It's architecture spesific.
but i will try to build with zlib 1.2.11 for testing
I still got the same build failure message on zlib 1.2.11
Thanks. I'll look into this.
Just FYI, i used this source: http://downloads.sourceforge.net/pmt/pngcrush-1.8.11.tar.xz
some other distributions are using -nolib version
Thanks again, that gives more to go on. That should be using the zutil.h that's included in the tar.xz distribution, so I wonder why you are seeing a conflict. Hmm, I see, it's conflicting with the system stddef.h which would be a zlib bug not a pngcrush bug. I'll follow up on that with the zlib dev.
Last edit: Glenn Randers-Pehrson 2017-06-01
Hi Glenn
one of SBo maintainer push this fix in the build script and it worked fine here
sed -i '/typedef long ptrdiff_t;/s,long,__PTRDIFF_TYPE__,' zutil.h
is it possible to change it in upstream code?
thanks
The resulting code is
Thanks, I've reported this upstream and will patch pngcrush.