OpenCV 3.4.3: libjpeg-turbo does not export jpeg_mem_src() or jpeg_mem_dest()

asked 2018-11-20 18:42:57 -0600

According to libjpeg-turbo, I think jpeg_mem_src() and jpeg_mem_dest() should be exported:

From 'https://libjpeg-turbo.org/Documentati...': "libjpeg-turbo 1.3 beta and later add support for the in-memory source/destination managers (jpeg_mem_src() and jpeg_mem_dest()), which were previously only available when emulating the libjpeg v8 API/ABI."

I see that OpenCV 3.4.3 includes libjpeg-turbo 1.5.3. So, I was expecting those symbols (I have set '-DOPENCV_SKIP_VISIBILITY_HIDDEN=ON').

However, they are missing. When I try to link a downstream project with openCV and use jpeg_mem_src() and jpeg_mem_dest(), I'm getting this error:

unresolved external symbol _jpeg_mem_src referenced in function

I've also tried passing '-DWITH_JPEG8=1' to cmake, but that had no effect.

The only thing that worked for me was setting '-DBUILD_JPEG_TURBO_DISABLE=ON' and falling back to the regular libjpeg.

I'm wondering if the source code checked into opencv under /3rdparty/libjpeg-turbo is missing something, or maybe the libjpeg-turbo/CmakeList.txt is missing something?

edit retag flag offensive close merge delete

Comments

there is no higher level api in opencv using either jpeg_mem_src() or jpeg_mem_dest(), so why do you expect that ?

berak gravatar imageberak ( 2018-11-20 18:46:22 -0600 )edit

From my understanding, opencv doesn't need to use the functions for the symbols to be exported. They were exported in previous versions before libjpeg-turbo was added.

ttelsey gravatar imagettelsey ( 2018-11-20 19:16:24 -0600 )edit

After reviewing the libjpeg-turbo source code, I think this is because the CMakeList.txt has been significantly simplified. I have fixed my issue by replacing 'set(JPEG_LIB_VERSION 62)' with 'set(JPEG_LIB_VERSION 80)' in 3rdparty/libjpeg-turbo/CMakeLists.txt.

ttelsey gravatar imagettelsey ( 2018-11-20 19:19:57 -0600 )edit