Ubuntu anaconda opencv 报错 libpng16.so.16, needed by anaconda3/lib/libcairo.so.2, not found

opencv make -j4 报错

 

/usr/bin/ld: warning: libpng16.so.16, needed by //home/lhu/anaconda3/lib/libcairo.so.2, not found (try using -rpath or -rpath-link)
/usr/bin/ld: warning: libpcre.so.1, needed by //home/lhu/anaconda3/lib/libgobject-2.0.so.0, not found (try using -rpath or -rpath-link)
//home/lhu/anaconda3/lib/libcairo.so.2: undefined reference to `png_set_interlace_handling@PNG16_0'
//home/lhu/anaconda3/lib/libcairo.so.2: undefined reference to `png_set_IHDR@PNG16_0'
//home/lhu/anaconda3/lib/libcairo.so.2: undefined reference to `png_get_io_ptr@PNG16_0'
//home/lhu/anaconda3/lib/libcairo.so.2: undefined reference to `png_set_longjmp_fn@PNG16_0'
//home/lhu/anaconda3/lib/libcairo.so.2: undefined reference to `png_set_gray_to_rgb@PNG16_0'
//home/lhu/anaconda3/lib/libcairo.so.2: undefined reference to `png_set_read_user_transform_fn@PNG16_0'
../../lib/libopencv_imgcodecs.so.3.4.7: undefined reference to `png_set_bgr@PNG16_0'
//home/lhu/anaconda3/lib/libcairo.so.2: undefined reference to `png_get_valid@PNG16_0'
../../lib/libopencv_imgcodecs.so.3.4.7: undefined reference to `png_set_rgb_to_gray@PNG16_0'
//home/lhu/anaconda3/lib/libcairo.so.2: undefined reference to `png_get_error_ptr@PNG16_0'
../../lib/libopencv_imgcodecs.so.3.4.7: undefined reference to `png_set_swap@PNG16_0'
//home/lhu/anaconda3/lib/libcairo.so.2: undefined reference to `png_destroy_read_struct@PNG16_0'
//home/lhu/anaconda3/lib/libcairo.so.2: undefined reference to `png_set_palette_to_rgb@PNG16_0'
../../lib/libopencv_imgcodecs.so.3.4.7: undefined reference to `png_get_tRNS@PNG16_0'
//home/lhu/anaconda3/lib/libcairo.so.2: undefined reference to `png_set_bKGD@PNG16_0'
//home/lhu/anaconda3/lib/libcairo.so.2: undefined reference to `png_set_write_user_transform_fn@PNG16_0'
//home/lhu/anaconda3/lib/libcairo.so.2: undefined reference to `png_set_packing@PNG16_0'
//home/lhu/anaconda3/lib/libcairo.so.2: undefined reference to `png_read_end@PNG16_0'
//home/lhu/anaconda3/lib/libcairo.so.2: undefined reference to `png_set_read_fn@PNG16_0'
//home/lhu/anaconda3/lib/libcairo.so.2: undefined reference to `png_write_end@PNG16_0'
//home/lhu/anaconda3/lib/libcairo.so.2: undefined reference to `png_set_expand_gray_1_2_4_to_8@PNG16_0'
//home/lhu/anaconda3/lib/libcairo.so.2: undefined reference to `png_set_write_fn@PNG16_0'
//home/lhu/anaconda3/lib/libcairo.so.2: undefined reference to `png_create_write_struct@PNG16_0'
//home/lhu/anaconda3/lib/libcairo.so.2: undefined reference to `png_error@PNG16_0'
//home/lhu/anaconda3/lib/libcairo.so.2: undefined reference to `png_destroy_write_struct@PNG16_0'
//home/lhu/anaconda3/lib/libcairo.so.2: undefined reference to `png_set_packswap@PNG16_0'
//home/lhu/anaconda3/lib/libcairo.so.2: undefined reference to `png_set_strip_16@PNG16_0'
//home/lhu/anaconda3/lib/libcairo.so.2: undefined reference to `png_create_read_struct@PNG16_0'
//home/lhu/anaconda3/lib/libcairo.so.2: undefined reference to `png_set_tRNS_to_alpha@PNG16_0'
../../lib/libopencv_imgcodecs.so.3.4.7: undefined reference to `png_set_compression_level@PNG16_0'
//home/lhu/anaconda3/lib/libcairo.so.2: undefined reference to `png_set_filler@PNG16_0'
../../lib/libopencv_imgcodecs.so.3.4.7: undefined reference to `png_set_filter@PNG16_0'
../../lib/libopencv_imgcodecs.so.3.4.7: undefined reference to `png_init_io@PNG16_0'
//home/lhu/anaconda3/lib/libcairo.so.2: undefined reference to `png_get_IHDR@PNG16_0'
../../lib/libopencv_imgcodecs.so.3.4.7: undefined reference to `png_set_compression_strategy@PNG16_0'
//home/lhu/anaconda3/lib/libcairo.so.2: undefined reference to `png_write_info@PNG16_0'
//home/lhu/anaconda3/lib/libcairo.so.2: undefined reference to `png_create_info_struct@PNG16_0'
//home/lhu/anaconda3/lib/libcairo.so.2: undefined reference to `png_read_update_info@PNG16_0'
//home/lhu/anaconda3/lib/libcairo.so.2: undefined reference to `png_write_image@PNG16_0'
//home/lhu/anaconda3/lib/libcairo.so.2: undefined reference to `png_read_image@PNG16_0'
//home/lhu/anaconda3/lib/libcairo.so.2: undefined reference to `png_read_info@PNG16_0'
../../lib/libopencv_imgcodecs.so.3.4.7: undefined reference to `png_set_strip_alpha@PNG16_0'
collect2: error: ld returned 1 exit status
apps/interactive-calibration/CMakeFiles/opencv_interactive-calibration.dir/build.make:234: recipe for target 'bin/opencv_interactive-calibration' failed
make[2]: *** [bin/opencv_interactive-calibration] Error 1
CMakeFiles/Makefile2:7919: recipe for target 'apps/interactive-calibration/CMakeFiles/opencv_interactive-calibration.dir/all' failed
make[1]: *** [apps/interactive-calibration/CMakeFiles/opencv_interactive-calibration.dir/all] Error 2
 

 

解决方案:

1.cd /usr/lib/x86_64-linux-gnu

2.sudo ln -s ~/anaconda3/lib/libpng16.so.16 libpng16.so.16

3.sudo ldconfig

你可能感兴趣的:(opencv,ubuntu)