darknet with opencv compile

darknet with opencv compile

https://github.com/pjreddie/darknet/issues/543


method: https://stackoverflow.com/questions/42918747/yolo-c-compilation-failure-with-debug-1

obj/captcha.o: In function `cvPointFrom32f':
/usr/local/include/opencv2/core/types_c.h:929: undefined reference to `cvRound'
/usr/local/include/opencv2/core/types_c.h:930: undefined reference to `cvRound'
obj/captcha.o: In function `cvReadInt':
/usr/local/include/opencv2/core/core_c.h:2350: undefined reference to `cvRound'
obj/captcha.o: In function `cvEllipseBox':
/usr/local/include/opencv2/imgproc/imgproc_c.h:1041: undefined reference to `cvRound'
/usr/local/include/opencv2/imgproc/imgproc_c.h:1042: undefined reference to `cvRound'
obj/lsd.o:/usr/local/include/opencv2/core/types_c.h:929: more undefined references to `cvRound' follow
collect2: error: ld returned 1 exit status
Makefile:77: recipe for target 'darknet' failed
make: *** [darknet] Error 1

method: https://www.cnblogs.com/guiguzhixing/p/6347602.html

g++  -DOPENCV `pkg-config --cflags opencv`  -Wall -Wfatal-errors -Wno-unused-result -Wno-unknown-pragmas -Og -g -DOPENCV obj/http_stream.o obj/gemm.o obj/utils.o obj/cuda.o obj/convolutional_layer.o obj/list.o obj/image.o obj/activations.o obj/im2col.o obj/col2im.o obj/blas.o obj/crop_layer.o obj/dropout_layer.o obj/maxpool_layer.o obj/softmax_layer.o obj/data.o obj/matrix.o obj/network.o obj/connected_layer.o obj/cost_layer.o obj/parser.o obj/option_list.o obj/darknet.o obj/detection_layer.o obj/captcha.o obj/route_layer.o obj/writing.o obj/box.o obj/nightmare.o obj/normalization_layer.o obj/avgpool_layer.o obj/coco.o obj/dice.o obj/yolo.o obj/detector.o obj/layer.o obj/compare.o obj/classifier.o obj/local_layer.o obj/swag.o obj/shortcut_layer.o obj/activation_layer.o obj/rnn_layer.o obj/gru_layer.o obj/rnn.o obj/rnn_vid.o obj/crnn_layer.o obj/demo.o obj/tag.o obj/cifar.o obj/go.o obj/batchnorm_layer.o obj/art.o obj/region_layer.o obj/reorg_layer.o obj/reorg_old_layer.o obj/super.o obj/voxel.o obj/tree.o obj/yolo_layer.o obj/upsample_layer.o -o darknet -lm -pthread  `pkg-config --libs opencv` 
/usr/bin/ld: warning: libpng16.so.16, needed by //home/tom/anaconda3/lib/libQt5Gui.so.5, not found (try using -rpath or -rpath-link)
/usr/bin/ld: warning: libicui18n.so.58, needed by //home/tom/anaconda3/lib/libQt5Core.so.5, not found (try using -rpath or -rpath-link)
/usr/bin/ld: warning: libicuuc.so.58, needed by //home/tom/anaconda3/lib/libQt5Core.so.5, not found (try using -rpath or -rpath-link)
/usr/bin/ld: warning: libicudata.so.58, needed by //home/tom/anaconda3/lib/libQt5Core.so.5, not found (try using -rpath or -rpath-link)
/usr/bin/ld: warning: libjpeg.so.9, needed by //home/tom/anaconda3/lib/libtiff.so.5, not found (try using -rpath or -rpath-link)
//home/tom/anaconda3/lib/libQt5Core.so.5: undefined reference to `u_errorName_58'
//home/tom/anaconda3/lib/libQt5Core.so.5: undefined reference to `ucal_setMillis_58'
//home/tom/anaconda3/lib/libQt5Gui.so.5: undefined reference to `png_set_interlace_handling@PNG16_0'
//home/tom/anaconda3/lib/libQt5Gui.so.5: undefined reference to `png_set_IHDR@PNG16_0'
//home/tom/anaconda3/lib/libQt5Core.so.5: undefined reference to `ucnv_getAlias_58'
//home/tom/anaconda3/lib/libQt5Gui.so.5: undefined reference to `png_get_io_ptr@PNG16_0'
//home/tom/anaconda3/lib/libtiff.so.5: undefined reference to `jpeg_set_quality@LIBJPEG_9.0'
//home/tom/anaconda3/lib/libtiff.so.5: undefined reference to `jpeg_abort@LIBJPEG_9.0'
//home/tom/anaconda3/lib/libQt5Gui.so.5: undefined reference to `png_get_image_width@PNG16_0'
//home/tom/anaconda3/lib/libtiff.so.5: undefined reference to `jpeg_resync_to_restart@LIBJPEG_9.0'
//home/tom/anaconda3/lib/libQt5Gui.so.5: undefined reference to `png_set_longjmp_fn@PNG16_0'
//home/tom/anaconda3/lib/libtiff.so.5: undefined reference to `jpeg_set_defaults@LIBJPEG_9.0'
//home/tom/anaconda3/lib/libQt5Gui.so.5: undefined reference to `png_set_gray_to_rgb@PNG16_0'
//home/tom/anaconda3/lib/libQt5Core.so.5: undefined reference to `ucal_inDaylightTime_58'
//home/tom/anaconda3/lib/libQt5Gui.so.5: undefined reference to `png_set_bgr@PNG16_0'
//home/tom/anaconda3/lib/libQt5Gui.so.5: undefined reference to `png_get_valid@PNG16_0'
//home/tom/anaconda3/lib/libtiff.so.5: undefined reference to `jpeg_finish_compress@LIBJPEG_9.0'
//home/tom/anaconda3/lib/libQt5Gui.so.5: undefined reference to `png_write_rows@PNG16_0'
//home/tom/anaconda3/lib/libQt5Gui.so.5: undefined reference to `png_get_PLTE@PNG16_0'
//home/tom/anaconda3/lib/libQt5Gui.so.5: undefined reference to `png_set_sig_bytes@PNG16_0'
//home/tom/anaconda3/lib/libQt5Core.so.5: undefined reference to `u_strToLower_58'
//home/tom/anaconda3/lib/libQt5Gui.so.5: undefined reference to `png_write_chunk@PNG16_0'
//home/tom/anaconda3/lib/libQt5Core.so.5: undefined reference to `ucnv_getStandardName_58'
//home/tom/anaconda3/lib/libQt5Gui.so.5: undefined reference to `png_set_pHYs@PNG16_0'
//home/tom/anaconda3/lib/libtiff.so.5: undefined reference to `jpeg_std_error@LIBJPEG_9.0'
//home/tom/anaconda3/lib/libQt5Core.so.5: undefined reference to `u_strToUpper_58'
//home/tom/anaconda3/lib/libQt5Gui.so.5: undefined reference to `png_destroy_read_struct@PNG16_0'
//home/tom/anaconda3/lib/libQt5Gui.so.5: undefined reference to `png_get_x_pixels_per_meter@PNG16_0'
//home/tom/anaconda3/lib/libQt5Gui.so.5: undefined reference to `png_read_row@PNG16_0'
//home/tom/anaconda3/lib/libQt5Core.so.5: undefined reference to `ucnv_setSubstChars_58'
//home/tom/anaconda3/lib/libQt5Core.so.5: undefined reference to `ucnv_getMaxCharSize_58'
//home/tom/anaconda3/lib/libQt5Core.so.5: undefined reference to `ucal_getTimeZoneDisplayName_58'
//home/tom/anaconda3/lib/libQt5Gui.so.5: undefined reference to `png_get_tRNS@PNG16_0'
//home/tom/anaconda3/lib/libQt5Core.so.5: undefined reference to `ucnv_fromUnicode_58'
//home/tom/anaconda3/lib/libQt5Core.so.5: undefined reference to `ucnv_open_58'
//home/tom/anaconda3/lib/libtiff.so.5: undefined reference to `jpeg_write_scanlines@LIBJPEG_9.0'
//home/tom/anaconda3/lib/libQt5Gui.so.5: undefined reference to `png_set_error_fn@PNG16_0'
//home/tom/anaconda3/lib/libtiff.so.5: undefined reference to `jpeg_read_header@LIBJPEG_9.0'
//home/tom/anaconda3/lib/libQt5Core.so.5: undefined reference to `ucnv_getDefaultName_58'
//home/tom/anaconda3/lib/libtiff.so.5: undefined reference to `jpeg_write_raw_data@LIBJPEG_9.0'
//home/tom/anaconda3/lib/libQt5Core.so.5: undefined reference to `ucal_getDefaultTimeZone_58'
//home/tom/anaconda3/lib/libtiff.so.5: undefined reference to `jpeg_start_compress@LIBJPEG_9.0'
//home/tom/anaconda3/lib/libQt5Core.so.5: undefined reference to `ucal_clone_58'
//home/tom/anaconda3/lib/libQt5Gui.so.5: undefined reference to `png_set_packing@PNG16_0'
//home/tom/anaconda3/lib/libQt5Gui.so.5: undefined reference to `png_read_end@PNG16_0'
//home/tom/anaconda3/lib/libQt5Gui.so.5: undefined reference to `png_set_read_fn@PNG16_0'
//home/tom/anaconda3/lib/libQt5Gui.so.5: undefined reference to `png_write_end@PNG16_0'
//home/tom/anaconda3/lib/libQt5Gui.so.5: undefined reference to `png_set_invert_mono@PNG16_0'
//home/tom/anaconda3/lib/libQt5Core.so.5: undefined reference to `ucal_getDSTSavings_58'
//home/tom/anaconda3/lib/libQt5Gui.so.5: undefined reference to `png_set_write_fn@PNG16_0'
//home/tom/anaconda3/lib/libQt5Gui.so.5: undefined reference to `png_set_tRNS@PNG16_0'
//home/tom/anaconda3/lib/libQt5Gui.so.5: undefined reference to `png_create_write_struct@PNG16_0'
//home/tom/anaconda3/lib/libQt5Gui.so.5: undefined reference to `png_error@PNG16_0'
//home/tom/anaconda3/lib/libQt5Gui.so.5: undefined reference to `png_destroy_write_struct@PNG16_0'
//home/tom/anaconda3/lib/libQt5Gui.so.5: undefined reference to `png_set_packswap@PNG16_0'
//home/tom/anaconda3/lib/libQt5Gui.so.5: undefined reference to `png_set_text@PNG16_0'
//home/tom/anaconda3/lib/libQt5Gui.so.5: undefined reference to `png_set_strip_16@PNG16_0'
//home/tom/anaconda3/lib/libQt5Core.so.5: undefined reference to `ucol_strcoll_58'
//home/tom/anaconda3/lib/libQt5Core.so.5: undefined reference to `ucnv_close_58'
//home/tom/anaconda3/lib/libQt5Gui.so.5: undefined reference to `png_create_read_struct@PNG16_0'
//home/tom/anaconda3/lib/libtiff.so.5: undefined reference to `jpeg_finish_decompress@LIBJPEG_9.0'
//home/tom/anaconda3/lib/libQt5Core.so.5: undefined reference to `ucnv_countAvailable_58'
//home/tom/anaconda3/lib/libQt5Core.so.5: undefined reference to `ucal_openCountryTimeZones_58'
//home/tom/anaconda3/lib/libtiff.so.5: undefined reference to `jpeg_destroy@LIBJPEG_9.0'
//home/tom/anaconda3/lib/libQt5Core.so.5: undefined reference to `ucol_open_58'
//home/tom/anaconda3/lib/libQt5Gui.so.5: undefined reference to `png_set_oFFs@PNG16_0'
//home/tom/anaconda3/lib/libtiff.so.5: undefined reference to `jpeg_read_raw_data@LIBJPEG_9.0'
//home/tom/anaconda3/lib/libtiff.so.5: undefined reference to `jpeg_CreateDecompress@LIBJPEG_9.0'
//home/tom/anaconda3/lib/libQt5Gui.so.5: undefined reference to `png_set_PLTE@PNG16_0'
//home/tom/anaconda3/lib/libQt5Core.so.5: undefined reference to `ucnv_compareNames_58'
//home/tom/anaconda3/lib/libQt5Gui.so.5: undefined reference to `png_set_compression_level@PNG16_0'
//home/tom/anaconda3/lib/libQt5Gui.so.5: undefined reference to `png_get_text@PNG16_0'
//home/tom/anaconda3/lib/libQt5Gui.so.5: undefined reference to `png_set_filler@PNG16_0'
//home/tom/anaconda3/lib/libQt5Gui.so.5: undefined reference to `png_get_gAMA@PNG16_0'
//home/tom/anaconda3/lib/libtiff.so.5: undefined reference to `jpeg_CreateCompress@LIBJPEG_9.0'
//home/tom/anaconda3/lib/libQt5Core.so.5: undefined reference to `ucal_close_58'
//home/tom/anaconda3/lib/libtiff.so.5: undefined reference to `jpeg_has_multiple_scans@LIBJPEG_9.0'
//home/tom/anaconda3/lib/libQt5Core.so.5: undefined reference to `ucnv_getAvailableName_58'
//home/tom/anaconda3/lib/libQt5Core.so.5: undefined reference to `ucal_openTimeZoneIDEnumeration_58'
//home/tom/anaconda3/lib/libQt5Core.so.5: undefined reference to `ucal_open_58'
//home/tom/anaconda3/lib/libQt5Core.so.5: undefined reference to `ucol_setAttribute_58'
//home/tom/anaconda3/lib/libQt5Core.so.5: undefined reference to `ucal_openTimeZones_58'
//home/tom/anaconda3/lib/libQt5Gui.so.5: undefined reference to `png_get_IHDR@PNG16_0'
//home/tom/anaconda3/lib/libQt5Core.so.5: undefined reference to `uenum_close_58'
//home/tom/anaconda3/lib/libtiff.so.5: undefined reference to `jpeg_start_decompress@LIBJPEG_9.0'
//home/tom/anaconda3/lib/libQt5Gui.so.5: undefined reference to `png_set_expand@PNG16_0'
//home/tom/anaconda3/lib/libtiff.so.5: undefined reference to `jpeg_suppress_tables@LIBJPEG_9.0'
//home/tom/anaconda3/lib/libQt5Gui.so.5: undefined reference to `png_write_info@PNG16_0'
//home/tom/anaconda3/lib/libtiff.so.5: undefined reference to `jpeg_write_tables@LIBJPEG_9.0'
//home/tom/anaconda3/lib/libtiff.so.5: undefined reference to `jpeg_read_scanlines@LIBJPEG_9.0'
//home/tom/anaconda3/lib/libQt5Core.so.5: undefined reference to `ucnv_countAliases_58'
//home/tom/anaconda3/lib/libQt5Core.so.5: undefined reference to `ucol_close_58'
//home/tom/anaconda3/lib/libQt5Gui.so.5: undefined reference to `png_get_oFFs@PNG16_0'
//home/tom/anaconda3/lib/libQt5Gui.so.5: undefined reference to `png_create_info_struct@PNG16_0'
//home/tom/anaconda3/lib/libQt5Core.so.5: undefined reference to `ucol_getSortKey_58'
//home/tom/anaconda3/lib/libQt5Gui.so.5: undefined reference to `png_read_update_info@PNG16_0'
//home/tom/anaconda3/lib/libQt5Gui.so.5: undefined reference to `png_write_image@PNG16_0'
//home/tom/anaconda3/lib/libQt5Gui.so.5: undefined reference to `png_set_gamma@PNG16_0'
//home/tom/anaconda3/lib/libQt5Core.so.5: undefined reference to `ucal_get_58'
//home/tom/anaconda3/lib/libQt5Gui.so.5: undefined reference to `png_get_y_pixels_per_meter@PNG16_0'
//home/tom/anaconda3/lib/libQt5Gui.so.5: undefined reference to `png_get_image_height@PNG16_0'
//home/tom/anaconda3/lib/libtiff.so.5: undefined reference to `jpeg_set_colorspace@LIBJPEG_9.0'
//home/tom/anaconda3/lib/libQt5Gui.so.5: undefined reference to `png_read_image@PNG16_0'
//home/tom/anaconda3/lib/libQt5Core.so.5: undefined reference to `uenum_next_58'
//home/tom/anaconda3/lib/libQt5Gui.so.5: undefined reference to `png_read_info@PNG16_0'
//home/tom/anaconda3/lib/libQt5Gui.so.5: undefined reference to `png_set_gAMA@PNG16_0'
//home/tom/anaconda3/lib/libQt5Gui.so.5: undefined reference to `png_get_channels@PNG16_0'
//home/tom/anaconda3/lib/libQt5Core.so.5: undefined reference to `ucnv_toUnicode_58'
collect2: error: ld returned 1 exit status
Makefile:128: recipe for target 'darknet' failed
make: *** [darknet] Error 1

issue: 

libgstvideo-0.10.so.0 => not found

libgstapp-0.10.so.0 => not found

libgstriff-0.10.so.0 => not found

libgstpbutils-0.10.20.0 => not found

reason:  /usr/lib/x86_64-linux-gnu下的版本为libgstreamer-1.0.so.0.803.0;版本号不对;(opencv的库是从其它电脑拷贝过来的)

solution:  安装0.10版本(https://github.com/toggl/toggldesktop/issues/1894)

sudo apt-get install libgstreamer0.10-dev libgstreamer-plugins-base0.10-dev

你可能感兴趣的:(darknet with opencv compile)