交叉编译OpenCV3.4.1报错

交叉编译OpenCV3.4.1报错

编译这玩意儿我看了半年多了,还是自己水平太差。

cmake配置如下:

General configuration for OpenCV 3.4.1 =====================================
  Version control:               unknown

  Platform:
    Timestamp:                   2021-10-30T12:55:08Z
    Host:                        Linux 5.11.0-38-generic x86_64
    Target:                      Linux
    CMake:                       3.16.3
    CMake generator:             Unix Makefiles
    CMake build tool:            /usr/bin/make
    Configuration:               Release

  CPU/HW features:
    Baseline:
      requested:                 DETECT

  C/C++:
    Built as dynamic libs?:      YES
    C++ Compiler:                /usr/local/arm/gcc-linaro-4.9.4-2017.01-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf-g++  (ver 4.9.4)
    C++ flags (Release):         -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wuninitialized -Winit-self -Wno-narrowing -Wno-delete-non-virtual-dtor -Wno-comment -fdiagnostics-show-option -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections  -fvisibility=hidden -fvisibility-inlines-hidden -O3 -DNDEBUG  -DNDEBUG
    C++ flags (Debug):           -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wuninitialized -Winit-self -Wno-narrowing -Wno-delete-non-virtual-dtor -Wno-comment -fdiagnostics-show-option -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections  -fvisibility=hidden -fvisibility-inlines-hidden -g  -O0 -DDEBUG -D_DEBUG
    C Compiler:                  /usr/local/arm/gcc-linaro-4.9.4-2017.01-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf-gcc
    C flags (Release):           -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wuninitialized -Winit-self -Wno-narrowing -Wno-comment -fdiagnostics-show-option -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections  -fvisibility=hidden -O3 -DNDEBUG  -DNDEBUG
    C flags (Debug):             -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wuninitialized -Winit-self -Wno-narrowing -Wno-comment -fdiagnostics-show-option -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections  -fvisibility=hidden -g  -O0 -DDEBUG -D_DEBUG
    Linker flags (Release):      
    Linker flags (Debug):        
    ccache:                      NO
    Precompiled headers:         NO
    Extra dependencies:          dl m pthread rt
    3rdparty dependencies:

  OpenCV modules:
    To be built:                 calib3d core dnn features2d flann highgui imgcodecs imgproc java_bindings_generator ml objdetect photo python_bindings_generator shape stitching superres ts video videoio videostab
    Disabled:                    js world
    Disabled by dependency:      -
    Unavailable:                 cudaarithm cudabgsegm cudacodec cudafeatures2d cudafilters cudaimgproc cudalegacy cudaobjdetect cudaoptflow cudastereo cudawarping cudev java python2 python3 viz
    Applications:                tests perf_tests apps
    Documentation:               NO
    Non-free algorithms:         NO

  GUI: 
    GTK+:                        NO

  Media I/O: 
    ZLib:                        build (ver 1.2.11)
    JPEG:                        libjpeg (ver 90)
    WEBP:                        build (ver encoder: 0x020e)
    PNG:                         build (ver 1.6.34)
    TIFF:                        build (ver 42 - 4.0.9)
    JPEG 2000:                   build (ver 1.900.1)
    OpenEXR:                     build (ver 1.7.1)

  Video I/O:
    DC1394:                      NO
    FFMPEG:                      YES
      avcodec:                   YES (ver 58.100.100)
      avformat:                  YES (ver 58.50.100)
      avutil:                    YES (ver 56.58.100)
      swscale:                   YES (ver 5.8.100)
      avresample:                NO
    GStreamer:                   NO
    libv4l/libv4l2:              NO
    v4l/v4l2:                    linux/videodev2.h
    gPhoto2:                     NO

  Parallel framework:            pthreads

  Trace:                         YES (built-in)

  Other third-party libraries:
    Lapack:                      NO
    Custom HAL:                  NO
    Protobuf:                    build (3.5.1)

  NVIDIA CUDA:                   NO

  OpenCL:                        YES (no extra features)
    Include path:                /home/i_2020_12/linux/opencv/opencv-3.4.1/arm/3rdparty/include/opencl/1.2
    Link libraries:              Dynamic load

  Python (for build):            /usr/bin/python2.7

  Matlab:                        NO

  Install to:                    /home/自己的路径
-----------------------------------------------------------------

Configuring done
Generating done

在make时报错如下:

/usr/local/arm/gcc-linaro-4.9.4-2017.01-x86_64_arm-linux-gnueabihf/bin/../lib/gcc/arm-linux-gnueabihf/4.9.4/../../../../arm-linux-gnueabihf/bin/ld: warning: libavcodec.so.58, needed by ../../lib/libopencv_videoio.so.3.4.1, not found (try using -rpath or -rpath-link)
/usr/local/arm/gcc-linaro-4.9.4-2017.01-x86_64_arm-linux-gnueabihf/bin/../lib/gcc/arm-linux-gnueabihf/4.9.4/../../../../arm-linux-gnueabihf/bin/ld: warning: libavformat.so.58, needed by ../../lib/libopencv_videoio.so.3.4.1, not found (try using -rpath or -rpath-link)
/usr/local/arm/gcc-linaro-4.9.4-2017.01-x86_64_arm-linux-gnueabihf/bin/../lib/gcc/arm-linux-gnueabihf/4.9.4/../../../../arm-linux-gnueabihf/bin/ld: warning: libavutil.so.56, needed by ../../lib/libopencv_videoio.so.3.4.1, not found (try using -rpath or -rpath-link)
/usr/local/arm/gcc-linaro-4.9.4-2017.01-x86_64_arm-linux-gnueabihf/bin/../lib/gcc/arm-linux-gnueabihf/4.9.4/../../../../arm-linux-gnueabihf/bin/ld: warning: libswscale.so.5, needed by ../../lib/libopencv_videoio.so.3.4.1, not found (try using -rpath or -rpath-link)
../../lib/libopencv_videoio.so.3.4.1: undefined reference to `av_init_packet@LIBAVCODEC_58'
../../lib/libopencv_videoio.so.3.4.1: undefined reference to `avformat_get_riff_video_tags@LIBAVFORMAT_58'
../../lib/libopencv_videoio.so.3.4.1: undefined reference to `avformat_get_mov_video_tags@LIBAVFORMAT_58'
../../lib/libopencv_videoio.so.3.4.1: undefined reference to `avcodec_find_decoder@LIBAVCODEC_58'
../../lib/libopencv_videoio.so.3.4.1: undefined reference to `av_frame_alloc@LIBAVUTIL_56'
../../lib/libopencv_videoio.so.3.4.1: undefined reference to `av_malloc@LIBAVUTIL_56'
../../lib/libopencv_videoio.so.3.4.1: undefined reference to `avio_open@LIBAVFORMAT_58'
../../lib/libopencv_videoio.so.3.4.1: undefined reference to `avformat_alloc_context@LIBAVFORMAT_58'
../../lib/libopencv_videoio.so.3.4.1: undefined reference to `av_sub_q@LIBAVUTIL_56'
../../lib/libopencv_videoio.so.3.4.1: undefined reference to `avformat_network_init@LIBAVFORMAT_58'
../../lib/libopencv_videoio.so.3.4.1: undefined reference to `avcodec_flush_buffers@LIBAVCODEC_58'
../../lib/libopencv_videoio.so.3.4.1: undefined reference to `avcodec_find_encoder@LIBAVCODEC_58'
../../lib/libopencv_videoio.so.3.4.1: undefined reference to `sws_getContext@LIBSWSCALE_5'
../../lib/libopencv_videoio.so.3.4.1: undefined reference to `av_write_frame@LIBAVFORMAT_58'
../../lib/libopencv_videoio.so.3.4.1: undefined reference to `avformat_close_input@LIBAVFORMAT_58'
../../lib/libopencv_videoio.so.3.4.1: undefined reference to `av_seek_frame@LIBAVFORMAT_58'
../../lib/libopencv_videoio.so.3.4.1: undefined reference to `sws_freeContext@LIBSWSCALE_5'
../../lib/libopencv_videoio.so.3.4.1: undefined reference to `av_dict_set@LIBAVUTIL_56'
../../lib/libopencv_videoio.so.3.4.1: undefined reference to `sws_scale@LIBSWSCALE_5'
../../lib/libopencv_videoio.so.3.4.1: undefined reference to `av_packet_unref@LIBAVCODEC_58'
../../lib/libopencv_videoio.so.3.4.1: undefined reference to `av_dict_parse_string@LIBAVUTIL_56'
../../lib/libopencv_videoio.so.3.4.1: undefined reference to `av_frame_get_buffer@LIBAVUTIL_56'
../../lib/libopencv_videoio.so.3.4.1: undefined reference to `av_freep@LIBAVUTIL_56'
../../lib/libopencv_videoio.so.3.4.1: undefined reference to `avformat_find_stream_info@LIBAVFORMAT_58'
../../lib/libopencv_videoio.so.3.4.1: undefined reference to `av_read_frame@LIBAVFORMAT_58'
../../lib/libopencv_videoio.so.3.4.1: undefined reference to `avformat_free_context@LIBAVFORMAT_58'
../../lib/libopencv_videoio.so.3.4.1: undefined reference to `av_register_all@LIBAVFORMAT_58'
../../lib/libopencv_videoio.so.3.4.1: undefined reference to `av_free@LIBAVUTIL_56'
../../lib/libopencv_videoio.so.3.4.1: undefined reference to `av_guess_sample_aspect_ratio@LIBAVFORMAT_58'
../../lib/libopencv_videoio.so.3.4.1: undefined reference to `avcodec_encode_video2@LIBAVCODEC_58'
../../lib/libopencv_videoio.so.3.4.1: undefined reference to `avformat_new_stream@LIBAVFORMAT_58'
../../lib/libopencv_videoio.so.3.4.1: undefined reference to `av_frame_unref@LIBAVUTIL_56'
../../lib/libopencv_videoio.so.3.4.1: undefined reference to `av_write_trailer@LIBAVFORMAT_58'
../../lib/libopencv_videoio.so.3.4.1: undefined reference to `avformat_open_input@LIBAVFORMAT_58'
../../lib/libopencv_videoio.so.3.4.1: undefined reference to `av_lockmgr_register@LIBAVCODEC_58'
../../lib/libopencv_videoio.so.3.4.1: undefined reference to `av_log_set_level@LIBAVUTIL_56'
../../lib/libopencv_videoio.so.3.4.1: undefined reference to `av_rescale_q@LIBAVUTIL_56'
../../lib/libopencv_videoio.so.3.4.1: undefined reference to `av_image_get_buffer_size@LIBAVUTIL_56'
../../lib/libopencv_videoio.so.3.4.1: undefined reference to `avcodec_open2@LIBAVCODEC_58'
../../lib/libopencv_videoio.so.3.4.1: undefined reference to `av_guess_format@LIBAVFORMAT_58'
../../lib/libopencv_videoio.so.3.4.1: undefined reference to `av_image_fill_arrays@LIBAVUTIL_56'
../../lib/libopencv_videoio.so.3.4.1: undefined reference to `sws_getCachedContext@LIBSWSCALE_5'
../../lib/libopencv_videoio.so.3.4.1: undefined reference to `av_codec_get_tag@LIBAVFORMAT_58'
../../lib/libopencv_videoio.so.3.4.1: undefined reference to `av_opt_set@LIBAVUTIL_56'
../../lib/libopencv_videoio.so.3.4.1: undefined reference to `avcodec_decode_video2@LIBAVCODEC_58'
../../lib/libopencv_videoio.so.3.4.1: undefined reference to `av_codec_get_id@LIBAVFORMAT_58'
../../lib/libopencv_videoio.so.3.4.1: undefined reference to `avformat_write_header@LIBAVFORMAT_58'
../../lib/libopencv_videoio.so.3.4.1: undefined reference to `av_mallocz@LIBAVUTIL_56'
../../lib/libopencv_videoio.so.3.4.1: undefined reference to `av_guess_codec@LIBAVFORMAT_58'
../../lib/libopencv_videoio.so.3.4.1: undefined reference to `av_dict_free@LIBAVUTIL_56'
../../lib/libopencv_videoio.so.3.4.1: undefined reference to `avio_close@LIBAVFORMAT_58'
../../lib/libopencv_videoio.so.3.4.1: undefined reference to `av_frame_free@LIBAVUTIL_56'
../../lib/libopencv_videoio.so.3.4.1: undefined reference to `avcodec_close@LIBAVCODEC_58'
../../lib/libopencv_videoio.so.3.4.1: undefined reference to `avcodec_get_context_defaults3@LIBAVCODEC_58'
collect2: 错误: ld 返回 1
make[2]: *** [apps/annotation/CMakeFiles/opencv_annotation.dir/build.make:89:bin/opencv_annotation] 错误 1
make[1]: *** [CMakeFiles/Makefile2:3823:apps/annotation/CMakeFiles/opencv_annotation.dir/all] 错误 2
make[1]: *** 正在等待未完成的任务....

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 7
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 7
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值