ImageMagick / ImageMagick6

🧙‍♂️ ImageMagick 6
https://legacy.imagemagick.org
Other
194 stars 80 forks source link

ImageMagick fails to build since commit 3c357cd "proper chuck length checking" on Ubuntu 16.04 LTS ESM #308

Closed sparrow2009 closed 4 months ago

sparrow2009 commented 4 months ago

ImageMagick version

6.9.13-2

Operating system

Linux

Operating system, version and so on

Ubuntu 16.04 LTS ESM

Description

coders/png.c: In function 'ReadOnePNGImage':
coders/png.c:2418:8: warning: unused variable 'option' [-Wunused-variable]
       *option;
        ^
coders/png.c:2516:40: warning: passing argument 3 of 'png_set_keep_unknown_chunks' discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
   png_set_keep_unknown_chunks(ping, 1, unused_chunks,
                                        ^
In file included from /usr/include/libpng12/png.h:321:0,
                 from coders/png.c:103:
/usr/include/libpng12/png.h:2330:25: note: expected 'png_bytep {aka unsigned char *}' but argument is of type 'const png_byte * {aka const unsigned char *}'
 extern PNG_EXPORT(void, png_set_keep_unknown_chunks) PNGARG((png_structp
                         ^
/usr/include/libpng12/pngconf.h:1535:58: note: in definition of macro 'PNG_EXPORT'
 #  define PNG_EXPORT(type,symbol) PNG_IMPEXP type PNGAPI symbol
                                                          ^
coders/png.c: In function 'Magick_png_set_text':
coders/png.c:8305:12: error: 'png_text {aka struct png_text_struct}' has no member named 'itxt_length'
     text[0].itxt_length=length;
            ^

Steps to Reproduce

Try to build ImageMagick version >= 6.9.13-2 on Ubuntu 16.04 LTS ESM.

Images

No response

dlemstra commented 4 months ago

This issue has been fixed in the most recent version.

sparrow2009 commented 4 months ago

If you refer to version 6.9.13.5, this is at least not true for my attempts. The build log excerpt above is actually from an installation attempt of that exact version.

dlemstra commented 4 months ago

I misread your error message but itxt_length has been added in version 1.0.5j of libpng in 1999 so I would advise you to upgrade that.

sparrow2009 commented 4 months ago

Well, Ubuntu 16.04 certainly ships with a sufficiently current libpng version (1.2). From the header file:

/ pngconf.h - machine configurable file for libpng

From the build log: ... Options used to compile and link: PREFIX = /home/some/local/ EXEC-PREFIX = /home/some/local/ VERSION = 6.9.13-2 CC = gcc CFLAGS = -I/usr/include/libxml2 -I/usr/include/libpng12 -I/usr/include/freetype2 -Wall -g -O2 -mtune=amdfam10 -fexceptions -DMAGICKCORE_HDRI_ENABLE=0 -DMAGICKCORE_QUANTUM_DEPTH=16 CPPFLAGS = -DMAGICKCORE_HDRI_ENABLE=0 -DMAGICKCORE_QUANTUM_DEPTH=16 PCFLAGS = DEFS = -DHAVE_CONFIG_H LDFLAGS = -L/home/some/perl5/perlbrew/perls/perl-5.38.2/lib/5.38.2/x86_64-linux/CORE LIBS = -ljbig -ltiff -lfreetype -ljpeg -lpng12 -llzma -lxml2 -lz -lm CXX = g++ -std=gnu++11 -std=gnu++11 CXXFLAGS = -g -O2 FEATURES = Cipher DPC DELEGATES = freetype jbig jng jpeg lzma png ps tiff xml zlib ...

dlemstra commented 4 months ago

It looks like ancient versions of libpng had a check for those members but this changed in 1.4.0 that was released in 2010. That is over 13 years ago so we won't be adding backwards compatibility for that anymore. Upgrade libpng or even better upgrade your ubuntu installation that is now out of support.

sparrow2009 commented 4 months ago

Ubuntu 16.04 LTS ESM is under Extended Security Maintenance actually. Upgrading the OS is not an option right now.

libpng is also shipped in version 1.6 as OS package. Building IM6 with freetype support using the libfreetype6 OS package however conflicts with having the OS package libpng16-dev installed.

So this leaves us with dropping the png support when building IM6.

As an aside: You might want to lift your libpng version requirement that is at v1.0.0 if I recall correctly from the build log. (Still as IM6 is the legacy version of IM it feels somehow wrong to lift a required version of a dependency that much.)