Closed vvhh2002 closed 2 years ago
Hi @vvhh2002 Thanks for posting this issue. Since there is something wrong with our OSX machine. I cannot test this issue now.
@cenit Could you please help take a look?
Failure only occurs in release build . What's the difference with Debug Build?
I'm having the same issue with a fresh manual build of OpenCV 3.4.11 on macOS Catalina 10.15.7....
Sorry extremely busy in this period . I will check the issue ASAP
Don't worry, I solved it. The problem is 3rdparty/libjpeg-turbo
in OpenCV >= 3.4.2.
The readme of OpenCV 3.4.11 for instance states:
WITH_JPEG CMake option must be ON to add libjpeg or libjpeg-turbo support to imgcodecs.
BUILD_JPEG=ON selects libjpeg-turbo by default (since OpenCV 3.4.2).
Enable BUILD_JPEG_TURBO_DISABLE=ON to force using of libjpeg (this option is removed in OpenCV 4.0).
They made 3rdparty/libjpeg-turbo
default and this has some defect. The CMakeFile.txt of libjpeg-turbo
contains a
set(JPEG_LIB_VERSION 62)
which in turn leads to an exclusion of the jpeg_default_qtables
implementation by C macro:
#if JPEG_LIB_VERSION >= 70
GLOBAL(void)
jpeg_default_qtables(j_compress_ptr cinfo, boolean force_baseline)
/* Set or change the 'quality' (quantization) setting, using default tables
* and straight percentage-scaling quality scales.
* This entry point allows different scalings for luminance and chrominance.
*/
{
/* Set up two quantization tables using the specified scaling */
jpeg_add_quant_table(cinfo, 0, std_luminance_quant_tbl,
cinfo->q_scale_factor[0], force_baseline);
jpeg_add_quant_table(cinfo, 1, std_chrominance_quant_tbl,
cinfo->q_scale_factor[1], force_baseline);
}
#endif
which in turn leads to the link error.
I solved it by enforcing libjpeg
and excluding tests compilation (which also didn't work for me down the road).
cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_JPEG_TURBO_DISABLE=ON -DBUILD_TESTS=OFF ..
Maybe this gives you a clue in your scenario.
EDIT: Alternatively you can set JPEG_LIB_VERSION to a higher value, e.g. 90 and go with libjpeg-turbo. But the problem compiling the tests remains.
Looks like there is mess with headers and libraries from different locations (for example, libjpeg from one of vcpkg package and opencv/3rdparty).
Look for for jconfig.h
(where JPEG_LIB_VERSION
is stored) and check its content.
You may use -H
option to see full paths of used headers (for compilation of grfmt_jpeg.cpp
).
They made 3rdparty/libjpeg-turbo default and this has some defect.
Actually, this means that FindJPEG.cmake
are failed and OpenCV build scripts fallback on 3rdparty variant.
Thx @neilyoung! But there is a question, the built opencv cannot read jpeg images in this way. How can I solve this?
I have tried to install libjpeg and libjpeg-turbo before building.
@vvhh2002 this issue have been fixed, please get the latest vcpkg version and try again.
Host Environment
vcpkg branch: master To Reproduce Steps to reproduce the behavior:
./vcpkg install openmvs
Failure logs
Additional context