DX8, DevC++(MinGW) problems remix (libjpeg?)

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
yikyak
Posts: 12
Joined: Tue Jan 13, 2004 1:54 am

DX8, DevC++(MinGW) problems remix (libjpeg?)

Post by yikyak »

Hello all,

I'm new to irrlicht, but have been hacking around with the (excellent) engine for the past couple of days. I've had absolutely no problem getting it to work in opengl and software modes, but when I try to use directx I run into problems.

I know the default binaries don't have directx compiled in (or don't seem to?) so I recompiled the engine following hlide's instructions on this page and it compiled fine. But; when I try to load and use a quake map (tutorial 2) using my binaries I get the following error:

JPEG parameter struct mismatch: library thinks size is 464, caller expects 432

This error occurs with the new home-compiled binaries in all rendering modes (video::DT_SOFTWARE, video::DT_OPENGL, and video::DT_DIRECTX8). This is obviously some fundamental library mismatch.

The error being thrown is from libjpeg's jerror.h (~line 66). I did some research and this post (from a libtiff mailing list) seems to sum up the problem:

http://remotesensing.org/pipermail/tiff ... 00082.html

The jpeg_create_decompress() macro is defined on ~line 897 of libjpeg's jpeglib.h. This macro resolves to a function call of:
jpeg_CreateDecompress((cinfo), JPEG_LIB_VERSION, (size_t) sizeof(struct jpeg_decompress_struct)) on something like line 902 of the same file.

The struct in question (struct jpeg_decompress_struct) is fully declared on ~line 411 of jpeglib.h, and is typedef'd on ~line 263.

Does anybody have any knowledge of dealing with this? The strange thing is that the above error gets thrown no matter whether I link against the libjpeg that comes with irrlicht, the libjpeg that comes as a devpack extension to Dev C++, or a self-compiled libjpeg. This would seem to imply that the mismatch is either coming from another library (z or gdi32 maybe) or irrlicht itself.

People on Mapserver seem to be having similar problems, though that seems to be either an incompatibility between jpeg libs or gd relative to the source program.

I wouldn't mind betting that there is a difference in a system typedef or #define somewhere, but I can't find it (yet). Does anyone know the story of the struct's missing 32 bits?

Addition:
Having problems determining whether the values are being reported in bytes or bits. If it's bits than it could be something as simple as system value differences (int vs double etc.) - if it's bytes it implies a much larger inconsistency, or a small one often repeated. Confused...
yikyak
Posts: 12
Joined: Tue Jan 13, 2004 1:54 am

Kindly ignore the parent post!

Post by yikyak »

After having played around with a debugger and a symbol reader with little success (well, technically they were succesful: they just told me what I already knew) I found out what the problem was.

There are two versions of libjpeg that ship with irrlicht. One is in the src directory, the other in the main 'lib' section. After linking with the one in the main lib section, DirectX is working like a charm. Kick-arse!

I'm leaving the parent as a reminder that the first source of errors is usually the stupid coder: i.e. me.

There still is a library discrepancy somewhere though. If anyone knows what it is, I'd be grateful to know. i.e. why the irrlicht-supplied libjpeg exports the correct size and yet all the others don't...
Post Reply