caffe编译报错lib/libopencv_imgcodecs.so: undefined reference to `png_create_read_struct@PNG16_0'等

具体错误描述:

/home/xuqiong/anaconda2/lib/libopencv_imgcodecs.so: undefined reference to `png_create_read_struct@PNG16_0'
/home/xuqiong/anaconda2/lib/libopencv_imgcodecs.so: undefined reference to `png_set_interlace_handling@PNG16_0'
/home/xuqiong/anaconda2/lib/libopencv_imgcodecs.so: undefined reference to `jas_stream_close'
/home/xuqiong/anaconda2/lib/libopencv_imgcodecs.so: undefined reference to `jas_image_writecmpt'
/home/xuqiong/anaconda2/lib/libopencv_imgcodecs.so: undefined reference to `jpeg_finish_decompress@LIBJPEG_9.0'
/home/xuqiong/anaconda2/lib/libopencv_imgcodecs.so: undefined reference to `jpeg_set_quality@LIBJPEG_9.0'
/home/xuqiong/anaconda2/lib/libopencv_imgcodecs.so: undefined reference to `png_set_IHDR@PNG16_0'
/home/xuqiong/anaconda2/lib/libopencv_imgcodecs.so: undefined reference to `png_get_io_ptr@PNG16_0'
/home/xuqiong/anaconda2/lib/libopencv_imgcodecs.so: undefined reference to `jpeg_quality_scaling@LIBJPEG_9.0'
/home/xuqiong/anaconda2/lib/libopencv_imgcodecs.so: undefined reference to `jpeg_destroy_decompress@LIBJPEG_9.0'
/home/xuqiong/anaconda2/lib/libopencv_imgcodecs.so: undefined reference to `jas_image_readcmpt'
/home/xuqiong/anaconda2/lib/libopencv_imgcodecs.so: undefined reference to `jas_image_encode'
/home/xuqiong/anaconda2/lib/libopencv_imgcodecs.so: undefined reference to `jpeg_resync_to_restart@LIBJPEG_9.0'
/home/xuqiong/anaconda2/lib/libopencv_imgcodecs.so: undefined reference to `jpeg_CreateDecompress@LIBJPEG_9.0'
/home/xuqiong/anaconda2/lib/libopencv_imgcodecs.so: undefined reference to `png_set_tRNS_to_alpha@PNG16_0'
/home/xuqiong/anaconda2/lib/libopencv_imgcodecs.so: undefined reference to `jas_image_decode'
/home/xuqiong/anaconda2/lib/libopencv_imgcodecs.so: undefined reference to `png_set_longjmp_fn@PNG16_0'
/home/xuqiong/anaconda2/lib/libopencv_imgcodecs.so: undefined reference to `jpeg_alloc_huff_table@LIBJPEG_9.0'
/home/xuqiong/anaconda2/lib/libopencv_imgcodecs.so: undefined reference to `jpeg_set_defaults@LIBJPEG_9.0'
/home/xuqiong/anaconda2/lib/libopencv_imgcodecs.so: undefined reference to `png_set_gray_to_rgb@PNG16_0'
/home/xuqiong/anaconda2/lib/libopencv_imgcodecs.so: undefined reference to `jas_cleanup'
/home/xuqiong/anaconda2/lib/libopencv_imgcodecs.so: undefined reference to `png_set_compression_level@PNG16_0'
/home/xuqiong/anaconda2/lib/libopencv_imgcodecs.so: undefined reference to `jas_image_strtofmt'
/home/xuqiong/anaconda2/lib/libopencv_imgcodecs.so: undefined reference to `jpeg_CreateCompress@LIBJPEG_9.0'
/home/xuqiong/anaconda2/lib/libopencv_imgcodecs.so: undefined reference to `png_set_bgr@PNG16_0'
/home/xuqiong/anaconda2/lib/libopencv_imgcodecs.so: undefined reference to `jpeg_stdio_src@LIBJPEG_9.0'
/home/xuqiong/anaconda2/lib/libopencv_imgcodecs.so: undefined reference to `jpeg_finish_compress@LIBJPEG_9.0'
/home/xuqiong/anaconda2/lib/libopencv_imgcodecs.so: undefined reference to `png_set_filter@PNG16_0'
/home/xuqiong/anaconda2/lib/libopencv_imgcodecs.so: undefined reference to `png_set_rgb_to_gray@PNG16_0'
/home/xuqiong/anaconda2/lib/libopencv_imgcodecs.so: undefined reference to `jas_image_create'
/home/xuqiong/anaconda2/lib/libopencv_imgcodecs.so: undefined reference to `jpeg_calc_output_dimensions@LIBJPEG_9.0'
/home/xuqiong/anaconda2/lib/libopencv_imgcodecs.so: undefined reference to `jpeg_std_error@LIBJPEG_9.0'
/home/xuqiong/anaconda2/lib/libopencv_imgcodecs.so: undefined reference to `png_init_io@PNG16_0'
/home/xuqiong/anaconda2/lib/libopencv_imgcodecs.so: undefined reference to `jpeg_default_qtables@LIBJPEG_9.0'
/home/xuqiong/anaconda2/lib/libopencv_imgcodecs.so: undefined reference to `jas_image_getcmptbytype'
/home/xuqiong/anaconda2/lib/libopencv_imgcodecs.so: undefined reference to `jas_cmprof_destroy'
/home/xuqiong/anaconda2/lib/libopencv_imgcodecs.so: undefined reference to `png_destroy_read_struct@PNG16_0'
/home/xuqiong/anaconda2/lib/libopencv_imgcodecs.so: undefined reference to `png_set_swap@PNG16_0'
/home/xuqiong/anaconda2/lib/libopencv_imgcodecs.so: undefined reference to `png_get_IHDR@PNG16_0'
/home/xuqiong/anaconda2/lib/libopencv_imgcodecs.so: undefined reference to `jpeg_start_decompress@LIBJPEG_9.0'
/home/xuqiong/anaconda2/lib/libopencv_imgcodecs.so: undefined reference to `png_set_palette_to_rgb@PNG16_0'
/home/xuqiong/anaconda2/lib/libopencv_imgcodecs.so: undefined reference to `png_set_compression_strategy@PNG16_0'
/home/xuqiong/anaconda2/lib/libopencv_imgcodecs.so: undefined reference to `jas_init'
/home/xuqiong/anaconda2/lib/libopencv_imgcodecs.so: undefined reference to `jpeg_write_scanlines@LIBJPEG_9.0'
/home/xuqiong/anaconda2/lib/libopencv_imgcodecs.so: undefined reference to `png_get_tRNS@PNG16_0'
/home/xuqiong/anaconda2/lib/libopencv_imgcodecs.so: undefined reference to `jpeg_simple_progression@LIBJPEG_9.0'
/home/xuqiong/anaconda2/lib/libopencv_imgcodecs.so: undefined reference to `jas_cmprof_createfromclrspc'
/home/xuqiong/anaconda2/lib/libopencv_imgcodecs.so: undefined reference to `jpeg_read_header@LIBJPEG_9.0'
/home/xuqiong/anaconda2/lib/libopencv_imgcodecs.so: undefined reference to `png_write_info@PNG16_0'
/home/xuqiong/anaconda2/lib/libopencv_imgcodecs.so: undefined reference to `jas_stream_fopen'
/home/xuqiong/anaconda2/lib/libopencv_imgcodecs.so: undefined reference to `jas_matrix_create'
/home/xuqiong/anaconda2/lib/libopencv_imgcodecs.so: undefined reference to `jpeg_read_scanlines@LIBJPEG_9.0'
/home/xuqiong/anaconda2/lib/libopencv_imgcodecs.so: undefined reference to `jpeg_start_compress@LIBJPEG_9.0'
/home/xuqiong/anaconda2/lib/libopencv_imgcodecs.so: undefined reference to `jpeg_destroy_compress@LIBJPEG_9.0'
/home/xuqiong/anaconda2/lib/libopencv_imgcodecs.so: undefined reference to `png_set_packing@PNG16_0'
/home/xuqiong/anaconda2/lib/libopencv_imgcodecs.so: undefined reference to `png_set_read_fn@PNG16_0'
/home/xuqiong/anaconda2/lib/libopencv_imgcodecs.so: undefined reference to `png_create_info_struct@PNG16_0'
/home/xuqiong/anaconda2/lib/libopencv_imgcodecs.so: undefined reference to `png_read_end@PNG16_0'
/home/xuqiong/anaconda2/lib/libopencv_imgcodecs.so: undefined reference to `png_read_update_info@PNG16_0'
/home/xuqiong/anaconda2/lib/libopencv_imgcodecs.so: undefined reference to `png_write_image@PNG16_0'
/home/xuqiong/anaconda2/lib/libopencv_imgcodecs.so: undefined reference to `png_write_end@PNG16_0'
/home/xuqiong/anaconda2/lib/libopencv_imgcodecs.so: undefined reference to `jas_matrix_destroy'
/home/xuqiong/anaconda2/lib/libopencv_imgcodecs.so: undefined reference to `png_set_expand_gray_1_2_4_to_8@PNG16_0'
/home/xuqiong/anaconda2/lib/libopencv_imgcodecs.so: undefined reference to `png_create_write_struct@PNG16_0'
/home/xuqiong/anaconda2/lib/libopencv_imgcodecs.so: undefined reference to `png_read_image@PNG16_0'
/home/xuqiong/anaconda2/lib/libopencv_imgcodecs.so: undefined reference to `jas_image_chclrspc'
/home/xuqiong/anaconda2/lib/libopencv_imgcodecs.so: undefined reference to `png_read_info@PNG16_0'
/home/xuqiong/anaconda2/lib/libopencv_imgcodecs.so: undefined reference to `png_set_strip_alpha@PNG16_0'
/home/xuqiong/anaconda2/lib/libopencv_imgcodecs.so: undefined reference to `png_set_write_fn@PNG16_0'
/home/xuqiong/anaconda2/lib/libopencv_imgcodecs.so: undefined reference to `jas_image_destroy'
/home/xuqiong/anaconda2/lib/libopencv_imgcodecs.so: undefined reference to `png_destroy_write_struct@PNG16_0'
/home/xuqiong/anaconda2/lib/libopencv_imgcodecs.so: undefined reference to `png_error@PNG16_0'
/home/xuqiong/anaconda2/lib/libopencv_imgcodecs.so: undefined reference to `jpeg_stdio_dest@LIBJPEG_9.0'
/home/xuqiong/anaconda2/lib/libopencv_imgcodecs.so: undefined reference to `png_set_strip_16@PNG16_0'
collect2: error: ld returned 1 exit status
Makefile:635: recipe for target '.build_release/tools/upgrade_net_proto_binary.bin' failed
make: *** [.build_release/tools/upgrade_net_proto_binary.bin] Error 1

 

解决方法:

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

 

makefile_config中,放开:USE_PKG_CONFIG := 1

 

参考:

https://blog.csdn.net/akadiao/article/details/79834086

https://github.com/BVLC/caffe/issues/5100

 

2、上述运行后,又出现:

usr/lib/libpng16.so.16: undefined reference to `inflateValidate@ZLIB_1.2.9'

git clone https://github.com/madler/zlib
cd path/to/zlib
./configure
make
make install # you may add 'sudo'

 

评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值