• Building / Cross Compiling OpenCV for Linux ARM /MIPS


    1) simple mode
    cd opencv-3.4.9
    mkdir build
    cmake ../
    -DCMAKE_C_COMPILER=mips-linux-gnu-gcc
    -DCMAKE_CXX_COMPILER=mips-linux-gnu-g++
    -DOPENCV_FORCE_3RDPARTY_BUILD=ON
    -DBUILD_ZLIB=ON
    -DCMAKE_INSTALL_PREFIX=../output
     
    2) crop mode
    cd opencv-3.4.9
    mkdir build
    cmake ../
    -DCMAKE_C_COMPILER=mips-linux-gnu-gcc
    -DCMAKE_CXX_COMPILER=mips-linux-gnu-g++
    -DOPENCV_FORCE_3RDPARTY_BUILD=ON
    -DBUILD_ZLIB=ON -DWITH_GTK=OFF -DWITH_GTK=OFF
    -DWITH_GTK_2_X=OFF -DWITH_CUDA=OFF -DWITH_IPP=OFF
    -DWITH_OPENCL=OFF -DWITH_OPENCLAMDBLAS=OFF
    -DWITH_QUIRC=OFF -DWITH_OPENCLAMDFFT=OFF
    -DWITH_1394=OFF -DWITH_FFMPEG=OFF -DWITH_WEBP=OFF
    -DWITH_TIFF=OFF -DWITH_OPENEXR=OFF -DWITH_PNG=OFF
    -DWITH_PROTOBUF=OFF -DWITH_GSTREAMER=OFF -DWITH_IMGCODEC_SUNRASTER=OFF
    -DBUILD_SHARED_LIBS=OFF -DBUILD_opencv_ts=OFF
    -DBUILD_opencv_shape=OFF -DBUILD_opencv_stitching=OFF
    -DBUILD_opencv_apps=OFF -DBUILD_opencv_calib3d=OFF
    -DBUILD_opencv_dnn=OFF -DBUILD_opencv_features2d=OFF
    -DBUILD_opencv_flann=OFF -DBUILD_opencv_highgui=OFF
    -DBUILD_opencv_ml=OFF -DBUILD_opencv_objdetect=OFF
    -DBUILD_opencv_photo=OFF -DBUILD_opencv_video=OFF
    -DBUILD_opencv_videoio=OFF -DBUILD_opencv_videostab=OFF
    -DCMAKE_BUILD_TYPE=RELEASE
    -DCMAKE_INSTALL_PREFIX=../output
    -DCMAKE_C_FLAGS=-m64 -DCMAKE_CXX_FLAGS=-m64
    -DCMAKE_CXX_FLAGS="-s -Os" -DCMAKE_C_FLAGS="-s -Os"
     
    3) Bug 20649 - [MIPS] Can't find matching LO16 reloc
    cd opencv-3.4.9/samples/cpp/example_cmake
    make
    mips-linux-gnu-g++ example.cpp -o example.o -c -Wall -I/home/zhoudd/2021/202107/cv/opencv-3.4.9/output/include/opencv -I/home/zhoudd/2021/202107/cv/ope
    ncv-3.4.9/output/include
    mips-linux-gnu-g++ example.o -o opencv_example -L/home/zhoudd/2021/202107/cv/opencv-3.4.9/output/lib -L/home/zhoudd/2021/202107/cv/opencv-3.4.9/output/
    share/OpenCV/3rdparty/lib -lopencv_imgcodecs -lopencv_imgproc -lopencv_core -lzlib -littnotify -llibjpeg-turbo -llibjasper -ldl -lm -lpthread -lrt
    /opt/mips-gcc540-glibc222-64bit-r3.3.0/bin/../lib/gcc/mips-linux-gnu/5.4.0/../../../../mips-linux-gnu/bin/ld: /home/zhoudd/2021/202107/cv/opencv-3.4.9/
    output/lib/libopencv_core.a(ocl.cpp.o): Can't find matching LO16 reloc against `_ZN2cv3oclL5crc64EPKhjy.constprop.345' for R_MIPS_GOT16 at 0x170 in sec
    tion `.text._ZN2cv3ocl13ProgramSource4Impl10updateHashEPKc[_ZN2cv3ocl13ProgramSource4Impl10updateHashEPKc]'
     
    fix
    https://sourceware.org/bugzilla/show_bug.cgi?id=20649

    copyright

    [1]Building / Cross Compiling OpenCV for Linux ARM
    https://www.ridgesolutions.ie/index.php/2013/05/24/building-cross-compiling-opencv-for-linux-arm/
    [2]Cross compilation for ARM based Linux systems
    https://docs.opencv.org/3.4.13/d0/d76/tutorial_arm_crosscompile_with_cmake.html
    [3]海思3559上移植OpenCV3.4.1 (四)在3559A上的适配
    https://blog.csdn.net/zhenglie110/article/details/87933483
    [4]海思平台OpenCV编译与进一步裁剪
    https://zhuanlan.zhihu.com/p/198457743?utm_source=org.mozilla.firefox_beta
     
  • 相关阅读:
    scikit_learn 官方文档翻译(集成学习)
    机器学习之SVM与逻辑回归的联系和区别
    有序数组寻找中位数以及寻找K大元素
    有向图算法之拓扑排序
    机器学习之离散型特征处理--独热码(one_hot_encoding)
    计算广告学(2)--广告有效性模型
    机器学习实战--k-均值聚类
    SonarQube 扫描代码,SonarQube 进行代码质量检查
    Docker 搭建 Nexus3
    informix 安装 linux 客户端
  • 原文地址:https://www.cnblogs.com/dong1/p/14958433.html
Copyright © 2020-2023  润新知