今天在我的ubuntu16.04上编译opencv-3.4.* 时,发现如下错误:
//usr/lib/i386-linux-gnu/libharfbuzz.so.0: undefined reference to `FT_Reference_Face'
collect2: error: ld returned 1 exit status
modules/highgui/CMakeFiles/opencv_test_highgui.dir/build.make:104: recipe for target 'bin/opencv_test_highgui' failed
make[2]: *** [bin/opencv_test_highgui] Error 1
CMakeFiles/Makefile2:4937: recipe for target 'modules/highgui/CMakeFiles/opencv_test_highgui.dir/all' failed
make[1]: *** [modules/highgui/CMakeFiles/opencv_test_highgui.dir/all] Error 2
Makefile:162: recipe for target 'all' failed
make: *** [all] Error 2
提示找不到“FT_Reference_Face”,谷歌之,发现它是 freetype 库的内容。因此怀疑我的 freetype 版本较旧,于是下载 freetype-2.10.0.tar,输入以下命令安装:
# tar xf freetype-2.10.0.tar
# cd freetype-2.10.0
# mkdir build
# cd build
# ../configure --prefix=/usr/local
# make
...
# make install
然后再编译 opencv,发现一切正常了。