We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 3919

Summary: [Patch] IMG_png.c fails to compile with libpng 1.5
Product: SDL_image Reporter: Ethan Lee <flibitijibibo>
Component: miscAssignee: Sam Lantinga <slouken>
Status: RESOLVED FIXED QA Contact: Sam Lantinga <slouken>
Severity: normal    
Priority: P2 CC: dfdfdafsjhdgfjhgddhgj
Version: unspecified   
Hardware: All   
OS: All   
Attachments: Patch to fix compilation for libpng < 1.6

Description Ethan Lee 2017-10-24 18:57:29 UTC
The latest version of SDL_image will fail to compile as a result of it depending on libpng 1.6. The problem commit is likely this one:

https://hg.libsdl.org/SDL_image/rev/ace61a625208

It probably just needs some new typedefs, similar to this commit:

https://hg.libsdl.org/SDL_image/rev/777206f89dd2
Comment 1 stef 2017-11-15 14:35:07 UTC
It also fails to compile with libsdl 1.2.50.

The necessary typedefs are:

typedef png_structp png_structrp;
typedef png_infop png_inforp;
typedef const png_color * png_const_colorp;

I'd guess, that those also fix building with 1.5
Comment 2 stef 2017-11-15 14:40:23 UTC
> It also fails to compile with libsdl 1.2.50.

sry, s/libsdl/libpng/
Comment 3 Ethan Lee 2017-11-20 18:01:20 UTC
Created attachment 3095 [details]
Patch to fix compilation for libpng < 1.6

Can confirm that stef's fix works for libpng 1.5 as well. Here's the patch to resolve this issue. (Mind the Parent, this was committed on top of my patch for #3972)
Comment 4 Sam Lantinga 2017-11-22 05:38:01 UTC
Added, thanks!
https://hg.libsdl.org/SDL_image/rev/218eb926ba90