/usr/bin/ld: warning: libpng16.so.16, needed by //home/syd/anaconda3/lib/libfreetype.so.6, not found

  • Post author:
  • Post category:其他




C++ OpenCV

make

编译时出现以下问题:

/usr/bin/ld: warning: libpng16.so.16, needed by //home/syd/anaconda3/lib/libfreetype.so.6, not found (try using -rpath or -rpath-link)
//home/syd/anaconda3/lib/libfreetype.so.6:对‘png_create_read_struct@PNG16_0’未定义的引用
//home/syd/anaconda3/lib/libfreetype.so.6:对‘png_set_interlace_handling@PNG16_0’未定义的引用
/usr/local/lib/libopencv_imgcodecs.so.3.4.10:对‘png_set_IHDR@PNG16_0’未定义的引用
//home/syd/anaconda3/lib/libfreetype.so.6:对‘png_get_io_ptr@PNG16_0’未定义的引用
//home/syd/anaconda3/lib/libfreetype.so.6:对‘png_set_tRNS_to_alpha@PNG16_0’未定义的引用
//home/syd/anaconda3/lib/libfreetype.so.6:对‘png_set_longjmp_fn@PNG16_0’未定义的引用
//home/syd/anaconda3/lib/libfreetype.so.6:对‘png_set_gray_to_rgb@PNG16_0’未定义的引用
/usr/local/lib/libopencv_imgcodecs.so.3.4.10:对‘png_set_compression_level@PNG16_0’未定义的引用
//home/syd/anaconda3/lib/libfreetype.so.6:对‘png_set_read_user_transform_fn@PNG16_0’未定义的引用
//home/syd/anaconda3/lib/libfreetype.so.6:对‘png_set_filler@PNG16_0’未定义的引用
/usr/local/lib/libopencv_imgcodecs.so.3.4.10:对‘png_set_bgr@PNG16_0’未定义的引用
//home/syd/anaconda3/lib/libfreetype.so.6:对‘png_get_valid@PNG16_0’未定义的引用
/usr/local/lib/libopencv_imgcodecs.so.3.4.10:对‘png_set_filter@PNG16_0’未定义的引用
/usr/local/lib/libopencv_imgcodecs.so.3.4.10:对‘png_set_rgb_to_gray@PNG16_0’未定义的引用
//home/syd/anaconda3/lib/libfreetype.so.6:对‘png_get_error_ptr@PNG16_0’未定义的引用
/usr/local/lib/libopencv_imgcodecs.so.3.4.10:对‘png_init_io@PNG16_0’未定义的引用
//home/syd/anaconda3/lib/libfreetype.so.6:对‘png_destroy_read_struct@PNG16_0’未定义的引用
/usr/local/lib/libopencv_imgcodecs.so.3.4.10:对‘png_set_swap@PNG16_0’未定义的引用
//home/syd/anaconda3/lib/libfreetype.so.6:对‘png_get_IHDR@PNG16_0’未定义的引用
//home/syd/anaconda3/lib/libfreetype.so.6:对‘png_set_palette_to_rgb@PNG16_0’未定义的引用
/usr/local/lib/libopencv_imgcodecs.so.3.4.10:对‘png_set_compression_strategy@PNG16_0’未定义的引用
/usr/local/lib/libopencv_imgcodecs.so.3.4.10:对‘png_get_tRNS@PNG16_0’未定义的引用
/usr/local/lib/libopencv_imgcodecs.so.3.4.10:对‘png_write_info@PNG16_0’未定义的引用
//home/syd/anaconda3/lib/libfreetype.so.6:对‘png_set_packing@PNG16_0’未定义的引用
//home/syd/anaconda3/lib/libfreetype.so.6:对‘png_set_read_fn@PNG16_0’未定义的引用
//home/syd/anaconda3/lib/libfreetype.so.6:对‘png_create_info_struct@PNG16_0’未定义的引用
//home/syd/anaconda3/lib/libfreetype.so.6:对‘png_read_end@PNG16_0’未定义的引用
//home/syd/anaconda3/lib/libfreetype.so.6:对‘png_read_update_info@PNG16_0’未定义的引用
/usr/local/lib/libopencv_imgcodecs.so.3.4.10:对‘png_write_image@PNG16_0’未定义的引用
/usr/local/lib/libopencv_imgcodecs.so.3.4.10:对‘png_write_end@PNG16_0’未定义的引用
//home/syd/anaconda3/lib/libfreetype.so.6:对‘png_set_expand_gray_1_2_4_to_8@PNG16_0’未定义的引用
/usr/local/lib/libopencv_imgcodecs.so.3.4.10:对‘png_create_write_struct@PNG16_0’未定义的引用
//home/syd/anaconda3/lib/libfreetype.so.6:对‘png_read_image@PNG16_0’未定义的引用
//home/syd/anaconda3/lib/libfreetype.so.6:对‘png_read_info@PNG16_0’未定义的引用
/usr/local/lib/libopencv_imgcodecs.so.3.4.10:对‘png_set_strip_alpha@PNG16_0’未定义的引用
/usr/local/lib/libopencv_imgcodecs.so.3.4.10:对‘png_set_write_fn@PNG16_0’未定义的引用
/usr/local/lib/libopencv_imgcodecs.so.3.4.10:对‘png_destroy_write_struct@PNG16_0’未定义的引用
//home/syd/anaconda3/lib/libfreetype.so.6:对‘png_error@PNG16_0’未定义的引用
//home/syd/anaconda3/lib/libfreetype.so.6:对‘png_set_strip_16@PNG16_0’未定义的引用
collect2: error: ld returned 1 exit status
CMakeFiles/main.dir/build.make:165: recipe for target 'main' failed
make[2]: *** [main] Error 1
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/main.dir/all' failed
make[1]: *** [CMakeFiles/main.dir/all] Error 2
Makefile:138: recipe for target 'all' failed
make: *** [all] Error 2



解决办法(其实只需要看上面第一行,没找到

libpng16.so.16

,且这个库在

anaconda3/lib

中):

cd /usr/lib/x86_64-linux-gnu/
sudo ln -s ~/anaconda3/lib/libpng16.so.16 libpng16.so.16
sudo ldconfig



依次输入以上三条命令,即可解决问题。



版权声明:本文为qq_49175257原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。