#29458·opencv

Compilation error: drawing_text.cpp: in function `cv::FontRenderEngine::~FontRenderEngine()':

Author: kiefernforstCreated Jul 6, 2026Updated Sep 16, 2026
Labelsbugcategory: imgproccategory: build/install

System Information

attempt to build git 5.x 77dff6dc75112ac8ba876b6b8837ad2246e5ee1d

Python 3.10 GCC 15.2.1

freetype 2.14.3 harfbuzz 14.2.1

Detailed description

[ 26%] Linking CXX shared library ../../lib/libopencv_imgproc.so
/usr/bin/ld: CMakeFiles/opencv_imgproc.dir/src/drawing_text.cpp.o: in function `cv::FontRenderEngine::~FontRenderEngine()':
drawing_text.cpp:(.text._ZN2cv16FontRenderEngineD2Ev[_ZN2cv16FontRenderEngineD5Ev]+0x3b): undefined reference to `hb_raster_draw_destroy'
/usr/bin/ld: CMakeFiles/opencv_imgproc.dir/src/drawing_text.cpp.o: in function `cv::FontRenderEngine::putText_(cv::Mat&, cv::Size_<int>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, cv::Point_<int>, unsigned char const*, cv::FontFace&, int, int, cv::PutTextFlags, cv::Range, bool, cv::Rect_<int>*) [clone .constprop.0] [clone .isra.0]':
drawing_text.cpp:(.text._ZN2cv16FontRenderEngine8putText_ERNS_3MatENS_5Size_IiEERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEENS_6Point_IiEEPKhRNS_8FontFaceEiiNS_12PutTextFlagsENS_5RangeEbPNS_5Rect_IiEE.constprop.0.isra.0+0x1801): undefined reference to `hb_raster_draw_set_scale_factor'
/usr/bin/ld: drawing_text.cpp:(.text._ZN2cv16FontRenderEngine8putText_ERNS_3MatENS_5Size_IiEERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEENS_6Point_IiEEPKhRNS_8FontFaceEiiNS_12PutTextFlagsENS_5RangeEbPNS_5Rect_IiEE.constprop.0.isra.0+0x1827): undefined reference to `hb_raster_draw_set_extents'
/usr/bin/ld: drawing_text.cpp:(.text._ZN2cv16FontRenderEngine8putText_ERNS_3MatENS_5Size_IiEERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEENS_6Point_IiEEPKhRNS_8FontFaceEiiNS_12PutTextFlagsENS_5RangeEbPNS_5Rect_IiEE.constprop.0.isra.0+0x1855): undefined reference to `hb_raster_draw_glyph'
/usr/bin/ld: drawing_text.cpp:(.text._ZN2cv16FontRenderEngine8putText_ERNS_3MatENS_5Size_IiEERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEENS_6Point_IiEEPKhRNS_8FontFaceEiiNS_12PutTextFlagsENS_5RangeEbPNS_5Rect_IiEE.constprop.0.isra.0+0x185e): undefined reference to `hb_raster_draw_render'
/usr/bin/ld: drawing_text.cpp:(.text._ZN2cv16FontRenderEngine8putText_ERNS_3MatENS_5Size_IiEERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEENS_6Point_IiEEPKhRNS_8FontFaceEiiNS_12PutTextFlagsENS_5RangeEbPNS_5Rect_IiEE.constprop.0.isra.0+0x1897): undefined reference to `hb_raster_image_get_extents'
/usr/bin/ld: drawing_text.cpp:(.text._ZN2cv16FontRenderEngine8putText_ERNS_3MatENS_5Size_IiEERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEENS_6Point_IiEEPKhRNS_8FontFaceEiiNS_12PutTextFlagsENS_5RangeEbPNS_5Rect_IiEE.constprop.0.isra.0+0x18a0): undefined reference to `hb_raster_image_get_buffer'
/usr/bin/ld: drawing_text.cpp:(.text._ZN2cv16FontRenderEngine8putText_ERNS_3MatENS_5Size_IiEERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEENS_6Point_IiEEPKhRNS_8FontFaceEiiNS_12PutTextFlagsENS_5RangeEbPNS_5Rect_IiEE.constprop.0.isra.0+0x19e8): undefined reference to `hb_raster_draw_recycle_image'
/usr/bin/ld: drawing_text.cpp:(.text._ZN2cv16FontRenderEngine8putText_ERNS_3MatENS_5Size_IiEERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEENS_6Point_IiEEPKhRNS_8FontFaceEiiNS_12PutTextFlagsENS_5RangeEbPNS_5Rect_IiEE.constprop.0.isra.0+0x21d7): undefined reference to `hb_raster_draw_create_or_fail'
/usr/bin/ld: drawing_text.cpp:(.text._ZN2cv16FontRenderEngine8putText_ERNS_3MatENS_5Size_IiEERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEENS_6Point_IiEEPKhRNS_8FontFaceEiiNS_12PutTextFlagsENS_5RangeEbPNS_5Rect_IiEE.constprop.0.isra.0+0x2595): undefined reference to `hb_raster_draw_set_glyph_extents'

Steps to reproduce

    cmake -B build -S $pkgname \
        -DWITH_VTK=OFF \
        -DWITH_OPENCL=OFF \
        -DWITH_OPENGL=ON \
        -DWITH_TBB=ON \
        -DBUILD_WITH_DEBUG_INFO=OFF \
        -DBUILD_TESTS=OFF \
        -DBUILD_PERF_TESTS=OFF \
        -DBUILD_EXAMPLES=OFF \
        -DINSTALL_C_EXAMPLES=OFF \
        -DINSTALL_PYTHON_EXAMPLES=OFF \
        -DCMAKE_INSTALL_PREFIX=/usr \
        -DOPENCV_EXTRA_MODULES_PATH="$srcdir/opencv_contrib/modules" \
        -DOPENCV_SKIP_PYTHON_LOADER=ON \
        -DOPENCV_PYTHON3_INSTALL_PATH=/usr/lib/python3.10/site-packages \
        -DLAPACK_LIBRARIES="/usr/lib/liblapack.so;/usr/lib/libblas.so;/usr/lib/libcblas.so" \
        -DLAPACK_CBLAS_H="/usr/include/cblas.h" \
        -DLAPACK_LAPACKE_H="/usr/include/lapacke.h" \
        -DOPENCV_GENERATE_PKGCONFIG=ON \
        -DOPENCV_ENABLE_NONFREE=ON \
        -DOPENCV_GENERATE_SETUPVARS=OFF \
        -DWITH_1394=OFF \
        -DEIGEN_INCLUDE_PATH=/usr/include/eigen3 \
        -DCPU_BASELINE_DISABLE=SSE3,AVX512_SKX \
        -DCPU_DISPATCH= \
        -DBUILD_opencv_java=OFF \
        -DBUILD_opencv_cvv=OFF \
        -DBUILD_opencv_dnn=ON \
        -DBUILD_highgui=ON \
        -DWITH_FFMPEG=ON \
        -DWITH_QT=ON \
        -DWITH_QT=6 \
        -DWITH_PROTOBUF=OFF \
        -DWITH_IPP=OFF \
        -DWITH_ZLIB_NG=ON \
        -DBUILD_opencv_gpubgsegm=OFF \
        -DBUILD_opencv_bgsegm=OFF

Issue submission checklist

  • I report the issue, it's not a question
  • I checked the problem with documentation, FAQ, open issues, forum.opencv.org, Stack Overflow, etc and have not found any solution
  • I updated to the latest OpenCV version and the issue is still there
  • There is reproducer code and related data files (videos, images, onnx, etc)