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 4198

Summary: Failure loading libpng for 2.0.2+ when building with mingw32
Product: SDL_image Reporter: Adam <adam.hzero>
Component: miscAssignee: Sam Lantinga <slouken>
Status: ASSIGNED --- QA Contact: Sam Lantinga <slouken>
Severity: normal    
Priority: P2    
Version: 2.0.2   
Hardware: x86_64   
OS: Windows 10   

Description Adam 2018-06-13 19:36:52 UTC
Overview:

I'm building an SDL application in Go using a sample repository (https://github.com/adam000/go-sdl2-wsl-build-windows) to reproduce the problem. (full repro instructions at https://github.com/veandco/go-sdl2/issues/336 )

I'm building from Windows Subsystem for Linux to create a Windows build (using the bash script in the example). It works for SDL_image version 2.0.1 but not newer versions. On newer versions, it fails with the following message:

> Failed to load PNG: Failed loading libpng16-16.dll: The specified procedure could not be found.

I *can* get newer versions to work simply by replacing the libpng DLL with the one bundled in SDL_image 2.0.1. I noticed that libpng was upgraded after 2.0.1 and before 2.0.2 (revision 518).

Steps to reproduce:

1. On WSL, run `./make-win64-on-wsl.bash` from repository root, optionally providing a destination like `/mnt/c/Users/myuser/Desktop`.
2. Under Windows command line, navigate to the destination and run build.exe

Actual results:

Application crashes with:

> Failed to load PNG: Failed loading libpng16-16.dll: The specified procedure could not be found.

Expected Results:

A png of a drawing of a gopher should appear on the screen for several seconds, then disappear.

Additional information:

Related forum post: https://discourse.libsdl.org/t/sdl2-image-fails-loading-libpng-on-latest-versions-when-cross-compiling/24494