JPEG parameter struct mismatch

浪尽此生 提交于 2019-12-19 19:55:03

问题


Ater compiling libjpeg and then using it, I stumbled upon the problem:

JPEG parameter struct mismatch: library thinks size is 512, caller expects 492

after which the program halts. This happens specifically with the structs struct jpeg_decompress_struct and struct jpeg_compress_struct. If the checks are removed on these structs, the program crashes with a null pointer exception, and the struct members contain garbage.

The error occurs with either precompiled binaries from version 6b, or with precompiled version 9a, and with the compiled version 9a; compiled with MinGW, MSYS 1.0, on windows (32 bit). Messing around in the config files does not help; the number 492 can change, but never equals 512 in order for the program to function.

The libjpeg compilation did create a valid cjpeg.exe and djpeg.exe.

Any ideas?


回答1:


In my case, the problem was that library and my program were compiled with different values of HAVE_BOOLEAN, so boolean type had different size.

Library was compiled with HAVE_BOOLEAN not defined, so it was using int as defined in libjpeg. Program was compiled with HAVE_BOOLEAN defined, and because some other headers were included before libjpeg, it was using unsigned char as defined in Windows RTL.




回答2:


It seems that the static package architecture does not conform to the current package architecture when the linker is connected. It is recommended to download the source code and compile it into a static library with the same parameters. Try again, remember to quote the correct version.



来源:https://stackoverflow.com/questions/22925171/jpeg-parameter-struct-mismatch

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!