Undefined symbols for architecture x86_64:
"_FT_Done_Face", referenced from:
cv::freetype::FreeType2Impl::~FreeType2Impl() in freetype.o
cv::freetype::FreeType2Impl::loadFontData(cv::String, int) in freetype.o
"_FT_Done_FreeType", referenced from:
cv::freetype::FreeType2Impl::~FreeType2Impl() in freetype.o
"_FT_Init_FreeType", referenced from:
cv::freetype::FreeType2Impl::FreeType2Impl() in freetype.o
cv::freetype::FreeType2Impl::FreeType2Impl() in freetype.o
cv::freetype::createFreeType2() in freetype.o
"_FT_Load_Glyph", referenced from:
cv::freetype::FreeType2Impl::putTextBitmapBlend(cv::_InputOutputArray const&) in freetype.o
cv::freetype::FreeType2Impl::putTextBitmapMono(cv::_InputOutputArray const&) in freetype.o
cv::freetype::FreeType2Impl::putTextOutline(cv::_InputOutputArray const&) in freetype.o
"_FT_New_Face", referenced from:
cv::freetype::FreeType2Impl::loadFontData(cv::String, int) in freetype.o
"_FT_Outline_Decompose", referenced from:
cv::freetype::FreeType2Impl::putTextOutline(cv::_InputOutputArray const&) in freetype.o
"_FT_Outline_Transform", referenced from:
cv::freetype::FreeType2Impl::putTextOutline(cv::_InputOutputArray const&) in freetype.o
"_FT_Outline_Translate", referenced from:
cv::freetype::FreeType2Impl::putTextOutline(cv::_InputOutputArray const&) in freetype.o
"_FT_Render_Glyph", referenced from:
cv::freetype::FreeType2Impl::putTextBitmapBlend(cv::_InputOutputArray const&) in freetype.o
cv::freetype::FreeType2Impl::putTextBitmapMono(cv::_InputOutputArray const&) in freetype.o
"_FT_Set_Pixel_Sizes", referenced from:
cv::freetype::FreeType2Impl::putText(cv::_InputOutputArray const&, cv::String const&, cv::Point_<int>, int, cv::Scalar_<double>, int, int, bool) in freetype.o
"_hb_buffer_add_utf8", referenced from:
cv::freetype::FreeType2Impl::putTextBitmapBlend(cv::_InputOutputArray const&) in freetype.o
cv::freetype::FreeType2Impl::putTextBitmapMono(cv::_InputOutputArray const&) in freetype.o
cv::freetype::FreeType2Impl::putTextOutline(cv::_InputOutputArray const&) in freetype.o
"_hb_buffer_create", referenced from:
cv::freetype::FreeType2Impl::putTextBitmapBlend(cv::_InputOutputArray const&) in freetype.o
cv::freetype::FreeType2Impl::putTextBitmapMono(cv::_InputOutputArray const&) in freetype.o
cv::freetype::FreeType2Impl::putTextOutline(cv::_InputOutputArray const&) in freetype.o
"_hb_buffer_destroy", referenced from:
cv::freetype::FreeType2Impl::putTextBitmapBlend(cv::_InputOutputArray const&) in freetype.o
cv::freetype::FreeType2Impl::putTextBitmapMono(cv::_InputOutputArray const&) in freetype.o
cv::freetype::FreeType2Impl::putTextOutline(cv::_InputOutputArray const&) in freetype.o
"_hb_buffer_get_glyph_infos", referenced from:
cv::freetype::FreeType2Impl::putTextBitmapBlend(cv::_InputOutputArray const&) in freetype.o
cv::freetype::FreeType2Impl::putTextBitmapMono(cv::_InputOutputArray const&) in freetype.o
cv::freetype::FreeType2Impl::putTextOutline(cv::_InputOutputArray const&) in freetype.o
"_hb_buffer_guess_segment_properties", referenced from:
cv::freetype::FreeType2Impl::putTextBitmapBlend(cv::_InputOutputArray const&) in freetype.o
cv::freetype::FreeType2Impl::putTextBitmapMono(cv::_InputOutputArray const&) in freetype.o
cv::freetype::FreeType2Impl::putTextOutline(cv::_InputOutputArray const&) in freetype.o
"_hb_font_destroy", referenced from:
cv::freetype::FreeType2Impl::~FreeType2Impl() in freetype.o
cv::freetype::FreeType2Impl::loadFontData(cv::String, int) in freetype.o
"_hb_ft_font_create", referenced from:
cv::freetype::FreeType2Impl::loadFontData(cv::String, int) in freetype.o
"_hb_shape", referenced from:
cv::freetype::FreeType2Impl::putTextBitmapBlend(cv::_InputOutputArray const&) in freetype.o
cv::freetype::FreeType2Impl::putTextBitmapMono(cv::_InputOutputArray const&) in freetype.o
cv::freetype::FreeType2Impl::putTextOutline(cv::_InputOutputArray const&) in freetype.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
What freetype/hardbuzz version do you have?
Please dump related lines from CMakeCache.txt file (something like grep -E 'FREETYPE|HARFBUZZ' CMakeCache.txt).
128: //Include opencv_freetype module into the OpenCV build
129: BUILD_opencv_freetype:BOOL=OFF
1215: opencv_freetype_BINARY_DIR:STATIC=/Users/logic/Desktop/opencv_contrib/build/modules/freetype
1218: opencv_freetype_LIB_DEPENDS:STATIC=general;opencv_core;general;opencv_imgproc;general;ippicv;general;-framework Accelerate;
1221: opencv_freetype_SOURCE_DIR:STATIC=/Users/logic/Desktop/opencv_contrib/modules/freetype
2193: FREETYPE_CFLAGS:INTERNAL=-I/usr/local/opt/freetype/include/freetype2
2194: FREETYPE_CFLAGS_I:INTERNAL=
2195: FREETYPE_CFLAGS_OTHER:INTERNAL=
2196: FREETYPE_FOUND:INTERNAL=1
2197: FREETYPE_INCLUDEDIR:INTERNAL=/usr/local/opt/freetype/include
2198: FREETYPE_INCLUDE_DIRS:INTERNAL=/usr/local/opt/freetype/include/freetype2
2199: FREETYPE_LDFLAGS:INTERNAL=-L/usr/local/opt/freetype/lib;-lfreetype
2200: FREETYPE_LDFLAGS_OTHER:INTERNAL=
2201: FREETYPE_LIBDIR:INTERNAL=/usr/local/opt/freetype/lib
2202: FREETYPE_LIBRARIES:INTERNAL=freetype
2203: FREETYPE_LIBRARY_DIRS:INTERNAL=/usr/local/opt/freetype/lib
2204: FREETYPE_LIBS:INTERNAL=
2205: FREETYPE_LIBS_L:INTERNAL=
2206: FREETYPE_LIBS_OTHER:INTERNAL=
2207: FREETYPE_LIBS_PATHS:INTERNAL=
2208: FREETYPE_PREFIX:INTERNAL=/usr/local/opt/freetype
2209: FREETYPE_STATIC_CFLAGS:INTERNAL=-I/usr/local/opt/freetype/include/freetype2
2210: FREETYPE_STATIC_CFLAGS_I:INTERNAL=
2211: FREETYPE_STATIC_CFLAGS_OTHER:INTERNAL=
2212: FREETYPE_STATIC_INCLUDE_DIRS:INTERNAL=/usr/local/opt/freetype/include/freetype2
2213: FREETYPE_STATIC_LDFLAGS:INTERNAL=-L/usr/local/opt/freetype/lib;-L/usr/local/Cellar/libpng/1.6.25/lib;-lfreetype;-lz;-lbz2;-lpng16;-lz
2214: FREETYPE_STATIC_LDFLAGS_OTHER:INTERNAL=
2215: FREETYPE_STATIC_LIBDIR:INTERNAL=
2216: FREETYPE_STATIC_LIBRARIES:INTERNAL=freetype;z;bz2;png16;z
2217: FREETYPE_STATIC_LIBRARY_DIRS:INTERNAL=/usr/local/opt/freetype/lib;/usr/local/Cellar/libpng/1.6.25/lib
2218: FREETYPE_STATIC_LIBS:INTERNAL=
2219: FREETYPE_STATIC_LIBS_L:INTERNAL=
2220: FREETYPE_STATIC_LIBS_OTHER:INTERNAL=
2221: FREETYPE_STATIC_LIBS_PATHS:INTERNAL=
2222: FREETYPE_VERSION:INTERNAL=18.6.12
2223: FREETYPE_freetype2_INCLUDEDIR:INTERNAL=
2224: FREETYPE_freetype2_LIBDIR:INTERNAL=
2225: FREETYPE_freetype2_PREFIX:INTERNAL=
2226: FREETYPE_freetype2_VERSION:INTERNAL=
2229: HARFBUZZ_CFLAGS:INTERNAL=-I/usr/local/Cellar/harfbuzz/1.3.3_1/include/harfbuzz;-I/usr/local/Cellar/glib/2.50.2/include/glib-2.0;-I/usr/local/Cellar/glib/2.50.2/lib/glib-2.0/include;-I/usr/local/opt/gettext/include;-I/usr/local/Cellar/pcre/8.39/include
2230: HARFBUZZ_CFLAGS_I:INTERNAL=
2231: HARFBUZZ_CFLAGS_OTHER:INTERNAL=
2232: HARFBUZZ_FOUND:INTERNAL=1
2233: HARFBUZZ_INCLUDEDIR:INTERNAL=/usr/local/Cellar/harfbuzz/1.3.3_1/include
2234: HARFBUZZ_INCLUDE_DIRS:INTERNAL=/usr/local/Cellar/harfbuzz/1.3.3_1/include/harfbuzz;/usr/local/Cellar/glib/2.50.2/include/glib-2.0;/usr/local/Cellar/glib/2.50.2/lib/glib-2.0/include;/usr/local/opt/gettext/include;/usr/local/Cellar/pcre/8.39/include
2235: HARFBUZZ_LDFLAGS:INTERNAL=-L/usr/local/Cellar/harfbuzz/1.3.3_1/lib;-lharfbuzz
2236: HARFBUZZ_LDFLAGS_OTHER:INTERNAL=
2237: HARFBUZZ_LIBDIR:INTERNAL=/usr/local/Cellar/harfbuzz/1.3.3_1/lib
2238: HARFBUZZ_LIBRARIES:INTERNAL=harfbuzz
2239: HARFBUZZ_LIBRARY_DIRS:INTERNAL=/usr/local/Cellar/harfbuzz/1.3.3_1/lib
2240: HARFBUZZ_LIBS:INTERNAL=
2241: HARFBUZZ_LIBS_L:INTERNAL=
2242: HARFBUZZ_LIBS_OTHER:INTERNAL=
2243: HARFBUZZ_LIBS_PATHS:INTERNAL=
2244: HARFBUZZ_PREFIX:INTERNAL=/usr/local/Cellar/harfbuzz/1.3.3_1
2245: HARFBUZZ_STATIC_CFLAGS:INTERNAL=-I/usr/local/Cellar/harfbuzz/1.3.3_1/include/harfbuzz;-I/usr/local/Cellar/glib/2.50.2/include/glib-2.0;-I/usr/local/Cellar/glib/2.50.2/lib/glib-2.0/include;-I/usr/local/opt/gettext/include;-I/usr/local/Cellar/pcre/8.39/include
2246: HARFBUZZ_STATIC_CFLAGS_I:INTERNAL=
2247: HARFBUZZ_STATIC_CFLAGS_OTHER:INTERNAL=
2248: HARFBUZZ_STATIC_INCLUDE_DIRS:INTERNAL=/usr/local/Cellar/harfbuzz/1.3.3_1/include/harfbuzz;/usr/local/Cellar/glib/2.50.2/include/glib-2.0;/usr/local/Cellar/glib/2.50.2/lib/glib-2.0/include;/usr/local/opt/gettext/include;/usr/local/Cellar/pcre/8.39/include
2249: HARFBUZZ_STATIC_LDFLAGS:INTERNAL=-L/usr/local/Cellar/harfbuzz/1.3.3_1/lib;-L/usr/local/Cellar/glib/2.50.2/lib;-L/usr/local/opt/gettext/lib;-L/usr/local/Cellar/pcre/8.39/lib;-lharfbuzz;-framework;ApplicationServices;-lglib-2.0;-lintl;-lpcre;-lintl;-liconv;-Wl,-framework,Carbon;-Wl,-framework,Foundation;-lpcre;-D_THREAD_SAFE;-pthread
2250: HARFBUZZ_STATIC_LDFLAGS_OTHER:INTERNAL=-framework;ApplicationServices;-Wl,-framework,Carbon;-Wl,-framework,Foundation;-D_THREAD_SAFE;-pthread
2251: HARFBUZZ_STATIC_LIBDIR:INTERNAL=
2252: HARFBUZZ_STATIC_LIBRARIES:INTERNAL=harfbuzz;glib-2.0;intl;pcre;intl;iconv;pcre
2253: HARFBUZZ_STATIC_LIBRARY_DIRS:INTERNAL=/usr/local/Cellar/harfbuzz/1.3.3_1/lib;/usr/local/Cellar/glib/2.50.2/lib;/usr/local/opt/gettext/lib;/usr/local/Cellar/pcre/8.39/lib
2254: HARFBUZZ_STATIC_LIBS:INTERNAL=
2255: HARFBUZZ_STATIC_LIBS_L:INTERNAL=
2256: HARFBUZZ_STATIC_LIBS_OTHER:INTERNAL=
2257: HARFBUZZ_STATIC_LIBS_PATHS:INTERNAL=
2258: HARFBUZZ_VERSION:INTERNAL=1.3.3
2259: HARFBUZZ_harfbuzz_INCLUDEDIR:INTERNAL=
2260: HARFBUZZ_harfbuzz_LIBDIR:INTERNAL=
2261: HARFBUZZ_harfbuzz_PREFIX:INTERNAL=
2262: HARFBUZZ_harfbuzz_VERSION:INTERNAL=
2597: //Module opencv_freetype will not be built in current configuration
2598: HAVE_opencv_freetype:INTERNAL=OFF
2750: OPENCV_MODULES_DISABLED_USER:INTERNAL=opencv_world;opencv_contrib_world;opencv_freetype
3186: OPENCV_MODULE_opencv_freetype_BINARY_DIR:INTERNAL=/Users/logic/Desktop/opencv_contrib/build/modules/freetype
3187: //List of opencv_freetype submodules
3188: OPENCV_MODULE_opencv_freetype_CHILDREN:INTERNAL=
3190: OPENCV_MODULE_opencv_freetype_CLASS:INTERNAL=PUBLIC
3191: //Flattened dependencies of opencv_freetype module (for linker)
3192: OPENCV_MODULE_opencv_freetype_DEPS_TO_LINK:INTERNAL=opencv_core;opencv_imgproc
3193: //Brief description of opencv_freetype module
3194: OPENCV_MODULE_opencv_freetype_DESCRIPTION:INTERNAL=FreeType module. It enables to draw strings with outlines and mono-bitmaps/gray-bitmaps.
3195: //List of header files for opencv_freetype
3196: OPENCV_MODULE_opencv_freetype_HEADERS:INTERNAL=/Users/logic/Desktop/opencv_contrib/modules/freetype/include/opencv2/freetype.hpp
3197: OPENCV_MODULE_opencv_freetype_IS_PART_OF_WORLD:INTERNAL=OFF
3198: OPENCV_MODULE_opencv_freetype_LABEL:INTERNAL=Extra;opencv_freetype
3199: OPENCV_MODULE_opencv_freetype_LINK_DEPS:INTERNAL=
3200: //Location of opencv_freetype module sources
3201: OPENCV_MODULE_opencv_freetype_LOCATION:INTERNAL=/Users/logic/Desktop/opencv_contrib/modules/freetype
3202: //Optional dependencies of opencv_freetype module
3203: OPENCV_MODULE_opencv_freetype_OPT_DEPS:INTERNAL=
3204: //Optional private dependencies of opencv_freetype module
3205: OPENCV_MODULE_opencv_freetype_PRIVATE_OPT_DEPS:INTERNAL=
3206: //Required private dependencies of opencv_freetype module
3207: OPENCV_MODULE_opencv_freetype_PRIVATE_REQ_DEPS:INTERNAL=
3208: //Required dependencies of opencv_freetype module
3209: OPENCV_MODULE_opencv_freetype_REQ_DEPS:INTERNAL=opencv_core;opencv_imgproc
3210: //List of source files for opencv_freetype
3211: OPENCV_MODULE_opencv_freetype_SOURCES:INTERNAL=/Users/logic/Desktop/opencv_contrib/modules/freetype/src/freetype.cpp;/Users/logic/Desktop/opencv_contrib/modules/freetype/src/precomp.hpp
3212: //List of wrappers supporting module opencv_freetype
3213: OPENCV_MODULE_opencv_freetype_WRAPPERS:INTERNAL=python2;python3
3643: OPENCV_MODULE_opencv_python2_OPT_DEPS:INTERNAL=opencv_calib3d;opencv_core;opencv_features2d;opencv_flann;opencv_highgui;opencv_imgcodecs;opencv_imgproc;opencv_ml;opencv_objdetect;opencv_photo;opencv_shape;opencv_stitching;opencv_superres;opencv_video;opencv_videoio;opencv_videostab;opencv_aruco;opencv_bgsegm;opencv_bioinspired;opencv_ccalib;opencv_datasets;opencv_dnn;opencv_dpm;opencv_face;opencv_freetype;opencv_fuzzy;opencv_hdf;opencv_line_descriptor;opencv_optflow;opencv_phase_unwrapping;opencv_plot;opencv_reg;opencv_rgbd;opencv_saliency;opencv_structured_light;opencv_surface_matching;opencv_text;opencv_tracking;opencv_xfeatures2d;opencv_ximgproc;opencv_xobjdetect;opencv_xphoto
3655: OPENCV_MODULE_opencv_python3_OPT_DEPS:INTERNAL=opencv_calib3d;opencv_core;opencv_features2d;opencv_flann;opencv_highgui;opencv_imgcodecs;opencv_imgproc;opencv_ml;opencv_objdetect;opencv_photo;opencv_shape;opencv_stitching;opencv_superres;opencv_video;opencv_videoio;opencv_videostab;opencv_aruco;opencv_bgsegm;opencv_bioinspired;opencv_ccalib;opencv_datasets;opencv_dnn;opencv_dpm;opencv_face;opencv_freetype;opencv_fuzzy;opencv_hdf;opencv_line_descriptor;opencv_optflow;opencv_phase_unwrapping;opencv_plot;opencv_reg;opencv_rgbd;opencv_saliency;opencv_structured_light;opencv_surface_matching;opencv_text;opencv_tracking;opencv_xfeatures2d;opencv_ximgproc;opencv_xobjdetect;opencv_xphoto
4354: PROJECT_opencv_freetype_GUID_CMAKE:INTERNAL=5C2487974F9E4F06BB4775C0
4528: __pkg_config_checked_FREETYPE:INTERNAL=1
4529: __pkg_config_checked_HARFBUZZ:INTERNAL=1
5002: opencv_freetype_GUID_CMAKE:INTERNAL=25F2E89C908841FEAAECCC70
I think ocv_define_module() line in opencv_contrib/module/freetype/CMakeFile.txt will cause this problem.
FREETYPE_INCLUDE_DIRS and HARFBUZZ_INCLUDE_DIRS seems to be used with clang.
But freetype2_LIBRARIES and harfbuzz_LIBRARIES do not seem to be used with ld.
ocv_define_module(freetype opencv_core opencv_imgproc PRIVATE_REQUIRED ${freetype2_LIBRARIES} ${harfbuzz_LIBRARIES} WRAP python)
ocv_include_directories( ${FREETYPE_INCLUDE_DIRS} ${HARFBUZZ_INCLUDE_DIRS} )
Following works well in Ubuntu 16.04 LTS. Would you try this fix in macOS10.12 ?
ocv_define_module(freetype opencv_core opencv_imgproc PRIVATE_REQUIRED ${FREETYPE_LIBRARIES} ${HARFBUZZ_LIBRARIES} WRAP python)
I got the same problem while compile in macos with the same env.
@Kumataro your ubuntu version solved this problem. Thanks
on line 22 of opencv-freetype CMakefile, change ${freetype2_LIBRARIES} ${harfbuzz_LIBRARIES} to ${FREETYPE_LIBRARIES} ${HARFBUZZ_LIBRARIES}
thank you @Kumataro @mikeseven ,that helped , solved the problem in ubuntu.
I am still getting the same Import Error after modifying the /home/avinashr175/opencv/opencv_contrib-3.2.0/modules/freetype/CMakeLists.txt file.
@avinashr175 did you build and installed opencv again after modifying that CMakelists.txt file ?
i build and installed opencv once again on my ubuntu 14.04 . that worked for me.
Thanks a lot @bharathkotari. I built and installed opencv once again and it worked.
The fix didn't work for me on ubuntu 16.04
Aftet making the change I get 4 warning messages for 2 directories:
WARNING: Target "opencv_freetype" requests linking to directory "/usr/include/freetype2". Targets may link only to libraries. CMake is dropping the item.
Directories:
And after changing line 22 in cmake, configure, make, make install, still get the same error:
ImportError: /usr/local/lib/libopencv_freetype.so.3.2: undefined symbol: hb_shape
Thank you and please could you tell us what timing the "ImportError" message shown ?
Step 0) execute cmake to generate Makefile
-> "WARNING .. " is shown, and cmake is failed..
Step1) fix changing line 22
Step 2) execute cmake to generate Makefile.
Step 3) make to build libraries
Step 4) make install to install libraries into your system.
Step 5) make your application with opencv_freetype module with freetype and harfbuzz libraries.
If the ImportError message is shown in step 2 or 3, could you try to remove CMakeCache.txt and rerun cmake command ? This cache file keep some partial result that cmake command executed in step 0, so that it may works wrong.
If the ImportError message is shown in step 5, could you confirm your linker option for your application ? The Linker should know the location of harfbuzz and freetype libraries to use the functions which is defined in these libraries.
Following is Makefile example.
a.out : a.cpp
g++ a.cpp -O2 -o a.out `pkg-config opencv freetype2 harfbuzz --cflags --libs`
Hey, sorry, I cannot recreate the error, I was working with docker image and tried to install it again, this time without any warnings or errors.
Thank you.
I'm experiencing this issue as well:
[0] % python
Python 2.7.12 (default, Nov 19 2016, 06:48:10)
[GCC 5.4.0 20160609] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import cv2
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: /usr/local/lib/libopencv_freetype.so.3.2: undefined symbol: FT_Set_Pixel_Sizes
>>>
I'm using OpenCV 3.2 compiled from source on a Ubuntu 16.04.
This line causes the problem on my system, as I'm using version 3.2 of the contrib modules.
But I've noticed this has been fixed on the master branch.
So please ignore my comment above.
This error still even exists in the official release of opencv in the Ubuntu/Debian repository. On a fresh ubuntu 18.04, simply doing
sudo apt-get install libopencv-dev
ldd -r /usr/lib/x86_64-linux-gnu/libopencv_freetype.so
pops out the following errors:
undefined symbol: FT_Set_Pixel_Sizes (/usr/lib/x86_64-linux-gnu/libopencv_freetype.so)
undefined symbol: hb_shape (/usr/lib/x86_64-linux-gnu/libopencv_freetype.so)
undefined symbol: FT_Load_Glyph (/usr/lib/x86_64-linux-gnu/libopencv_freetype.so)
undefined symbol: hb_buffer_guess_segment_properties (/usr/lib/x86_64-linux-gnu/libopencv_freetype.so)
undefined symbol: hb_ft_font_create (/usr/lib/x86_64-linux-gnu/libopencv_freetype.so)
undefined symbol: FT_Outline_Transform (/usr/lib/x86_64-linux-gnu/libopencv_freetype.so)
undefined symbol: hb_buffer_destroy (/usr/lib/x86_64-linux-gnu/libopencv_freetype.so)
undefined symbol: FT_Init_FreeType (/usr/lib/x86_64-linux-gnu/libopencv_freetype.so)
undefined symbol: FT_Outline_Decompose (/usr/lib/x86_64-linux-gnu/libopencv_freetype.so)
undefined symbol: FT_Outline_Translate (/usr/lib/x86_64-linux-gnu/libopencv_freetype.so)
undefined symbol: hb_font_destroy (/usr/lib/x86_64-linux-gnu/libopencv_freetype.so)
undefined symbol: FT_Done_FreeType (/usr/lib/x86_64-linux-gnu/libopencv_freetype.so)
undefined symbol: hb_buffer_add_utf8 (/usr/lib/x86_64-linux-gnu/libopencv_freetype.so)
undefined symbol: hb_buffer_get_glyph_infos (/usr/lib/x86_64-linux-gnu/libopencv_freetype.so)
undefined symbol: FT_New_Face (/usr/lib/x86_64-linux-gnu/libopencv_freetype.so)
undefined symbol: FT_Render_Glyph (/usr/lib/x86_64-linux-gnu/libopencv_freetype.so)
undefined symbol: FT_Done_Face (/usr/lib/x86_64-linux-gnu/libopencv_freetype.so)
undefined symbol: hb_buffer_create (/usr/lib/x86_64-linux-gnu/libopencv_freetype.so)
To contact with https://bugs.launchpad.net/ubuntu/+source/opencv/+bug/1753928 is helpful to fix this problem.
In 2018, "OpenCV version in bionic is old" is reported at ubuntu community ( *1 ) .
OpenCV package is updated from 3.1 to 3.2 + CVE patches for bionic, cosmic and disco.
However this patch seems to not include with it
*1 https://answers.launchpad.net/ubuntu/+source/opencv/+question/665324
Most helpful comment
on line 22 of opencv-freetype CMakefile, change ${freetype2_LIBRARIES} ${harfbuzz_LIBRARIES} to ${FREETYPE_LIBRARIES} ${HARFBUZZ_LIBRARIES}