sdl_image mingw compiling issue

Started by
8 comments, last by AndreasWittmann 12 years, 7 months ago
Hey there. I've got a fresh install of mingw with msys on a windows 7 x64 system.

g++.exe (GCC) 4.5.0
SDL 1.2.14
SDL_image 1.2.10

I was able to compile libz, libpng, libjpeg, libtiff, and SDL, but when I try to compile SDL_image I get the following errors.

IMG_png.c: In function `IMG_InitPNG':
IMG_png.c:250: warning: assignment from incompatible pointer type
IMG_png.c: In function `IMG_LoadPNG_RW':
IMG_png.c:350: error: dereferencing pointer to incomplete type
IMG_png.c:419: error: dereferencing pointer to incomplete type
IMG_png.c:421: error: dereferencing pointer to incomplete type
IMG_png.c:429: error: dereferencing pointer to incomplete type
IMG_png.c:477: error: dereferencing pointer to incomplete type
IMG_png.c:478: error: dereferencing pointer to incomplete type
IMG_png.c:479: error: dereferencing pointer to incomplete type
IMG_png.c:480: error: dereferencing pointer to incomplete type
IMG_png.c:481: error: dereferencing pointer to incomplete type
IMG_png.c:482: error: dereferencing pointer to incomplete type
make: *** [IMG_png.lo] Error 1


I've run
./configure --prefix=/mingw
make


Can anyone help me out here?
Advertisement
Bump, any help here guys? Or at least a suggestion for a better place to ask this question?

Since I'm new to gamedev.net I figured I should post in the newbie section. Searches also turned up nothing much on this topic, most of the problems were unrelated, or boilded down to "I give up"
Have you tried a different compiler?

Yo dawg, don't even trip.

No, I haven't tried another one. MinGW has worked for every other project I've ever used it on. It uses the gnu compiler, which I think is what most windows based, non-Microsoft toolsets use. If I'm right on that, then switching to an IDE will just give me a graphical window instead of a command line.
Quote:
Or at least a suggestion for a better place to ask this question?

The SDL mailing list would be the best place to ask.

Are you sure you need to compile these libraries yourself? When I was working with mingw I was able to find pre-built libraries.

Other than that, the most obvious thing that comes to mind is a version mismatch between the libpng that SDL_image was written against and the one you are using.
I know I can use pre-built libraries, but for the sake of learning I try to avoid that. I should be able to compile any open source component my project will include.

I'll post my question to the mailing list. Thanks.
So, that mailing list seems to be for announcements and such only.

The SDL forums only allow people with "special access" to post ...

So, any other suggestions on where to take this question? Or on what to do?

I didn't see what version of libpng (or any other library) is required for SDL_image.

Any info on this would be greatly appreciated.
There are a few lists. Looking at that page I agree it is a little confusing and non-obvious which one you should join. I believe it is this one.
This is the same command line and versions I used for compiling SDL_Image on a 32bit windows, so it seems you have tried correctly -> mailing list.

Or even better: Have you inspected the code yourself? I recently compiled quite a number of libraries, and had to write a handful of patches to get everything compiling. In many cases, this is easy, or at least, a solvable task.

sidenote: For SDL, it is gcc, not g++.
Newer versions of libpng (1.5) won't work with the current release of sdl_image (1.2.10). You'll get errors like:

IMG_png.c: In function 'IMG_LoadPNG_RW':
IMG_png.c:350: error: dereferencing pointer to incomplete type
IMG_png.c:419: error: dereferencing pointer to incomplete type
IMG_png.c:421: error: dereferencing pointer to incomplete type
...
make: *** [IMG_png.lo] Error 1

sdl_image tries to use some internals of libpng but that won't work any longer. A simple quick and dirty workaround for this:

Copy pnginfo.h and pngstruct.h (from the source of your running libpng installation) to your sdl_image source-tree and make the following modifications in IMG_png.c:

Add
#include <pngstruct.h>
#include <pnginfo.h>
after
#include <png.h>

Replace
if ( setjmp(png_ptr->jmpbuf) ) {
with
if ( setjmp(png_ptr->longjmp_buffer) ) {


This simple workaround work's for me! I will create some patches at http://www.wittnet.at in a few days.

This topic is closed to new replies.

Advertisement