syphilis has asked for the wisdom of the Perl Monks concerning the following question:

Hi,
There must be some definitive advice about this problem somewhere, but I haven't yet found it.

I have GD-2.46, jpeg-6b and gd-2.0.35, all built using mingw. When running the t/GD test suite I get:
C:\build\GD-2.46>perl t/GD.t 1..12 Testing using png support. ok 1 ok 2 ok 3 ok 4 ok 5 ok 6 ok 7 ok 8 # Skip, FreeType changes too frequently to be testable ok 9 # Skip, no XPM support gd-jpeg: JPEG library reports unrecoverable error: JPEG parameter stru +ct mismatch: library thinks size is 464, caller expects 432 Can't call method "png" on an undefined value at t/GD.t line 324.
Does anyone know what needs to be done to fix that "unrecoverable error" ?

On another computer (Windows XP), with a slightly different mix of GD, gd, and jpeg versions, I don't have this problem, so I can probably eventually fumble my way to a solution - but any sane advice from someone who actually knows what needs doing (as opposed to the useless drivel that google keeps finding for me) would be appreciated.

I'm on Windows Vista - and experience essentially the same problem for perls 5.8 right through to 5.14 (both 32-bit and 64-bit).

Cheers,
Rob

Replies are listed 'Best First'.
Re: GD and jpeg incompatibility
by BrowserUk (Patriarch) on May 26, 2011 at 07:03 UTC

    Try setting the environment variable: GDIMAGETYPE=jpeg (note the 'e') before you run gd.t.


    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    "Science is about questioning the status quo. Questioning authority".
    In the absence of evidence, opinion is indistinguishable from prejudice.
      Essentially the same thing happens:
      1..12 Testing using jpeg support. ok 1 gd-jpeg: JPEG library reports unrecoverable error: JPEG parameter stru +ct mismatch: library thinks size is 464, caller expects 432 Use of uninitialized value $testNo in concatenation (.) or string at t +/GD.t line 109. Use of uninitialized value $testNo in concatenation (.) or string at t +/GD.t line 130. not ok gd-jpeg: JPEG library reports unrecoverable error: JPEG parameter stru +ct mismatch: library thinks size is 376, caller expects 360 not ok 3 gd-jpeg: JPEG library reports unrecoverable error: JPEG parameter stru +ct mismatch: library thinks size is 376, caller expects 360 not ok 4 gd-jpeg: JPEG library reports unrecoverable error: JPEG parameter stru +ct mismatch: library thinks size is 376, caller expects 360 not ok 5 gd-jpeg: JPEG library reports unrecoverable error: JPEG parameter stru +ct mismatch: library thinks size is 376, caller expects 360 not ok 6 gd-jpeg: JPEG library reports unrecoverable error: JPEG parameter stru +ct mismatch: library thinks size is 376, caller expects 360 not ok 7 ok 8 # Skip, FreeType changes too frequently to be testable ok 9 # Skip, no XPM support gd-jpeg: JPEG library reports unrecoverable error: JPEG parameter stru +ct mismatch: library thinks size is 464, caller expects 432 Can't call method "jpeg" on an undefined value at t/GD.t line 324.
      The XP box, where everything goes fine, has gd-2.0.33 whereas this troublesome Vista box has gd-2.0.35. Other than that, it's the same set up - GD-2.46 and jpeg-6b.

      Later on today I'll upgrade the XP box to gd-2.0.35, and expect to see the same error as occurs on the Vista box.

      All I've managed to ascertain so far is that the "JPEG library reports unrecoverable error" part of the message comes from the gd library (gd-jpeg.c), and the "JPEG parameter struct mismatch: library thinks size is abc , caller expects xyz" from the jpeg library (prototype found in jerror.h).

      Cheers,
      Rob

        My best guess is that the copy of jpeglib.h bundled with gd is out of step with the jpeglib.h from libjpeg.

        Specifically the struct jpeg_decompress_struct are probably different. I tried to compare them, but the source files are so littered with entirely useless comments interleaved around every dratted line that it is impossible to really tell.

        You could try replacing the former with the latter and see what happens, but it seems more likely that you'll have to report the problem to the gd people and wait for them to fix it. (Or just go back to 2.33 until it is fixed.)


        Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
        "Science is about questioning the status quo. Questioning authority".
        In the absence of evidence, opinion is indistinguishable from prejudice.