ubuntu 20 && RK3588 cross compile OpenCV

交叉编译opencv4.5.3遇到如下错误:

../../lib/libopencv_world.so.4.5.3: undefined reference to `png_do_expand_palette_rgb8_neon'
../../lib/libopencv_world.so.4.5.3: undefined reference to `png_init_filter_functions_neon'
../../lib/libopencv_world.so.4.5.3: undefined reference to `png_do_expand_palette_rgba8_neon'
../../lib/libopencv_world.so.4.5.3: undefined reference to `png_riffle_palette_neon'
collect2: error: ld returned 1 exit status
apps/model-diagnostics/CMakeFiles/opencv_model_diagnostics.dir/build.make:95: recipe for target 'bin/opencv_model_diagnostics' failed
make[2]: *** [bin/opencv_model_diagnostics] Error 1
CMakeFiles/Makefile2:3183: recipe for target 'apps/model-diagnostics/CMakeFiles/opencv_model_diagnostics.dir/all' failed
make[1]: *** [apps/model-diagnostics/CMakeFiles/opencv_model_diagnostics.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....

解决:
打开opencv源码目录,编辑文件 vim 3rdparty/libpng/pngpriv.h
第130行注释掉, 修改为131行

 130 /* #  if (defined(__ARM_NEON__) || defined(__ARM_NEON)) && \ */
 131 # if defined(PNG_ARM_NEON) && (defined(__ARM_NEON__) || defined(__ARM_NEON)) && \
 132    defined(PNG_ALIGNED_MEMORY_SUPPORTED)
 133 #     define PNG_ARM_NEON_OPT 2
 134 #  else
 135 #     define PNG_ARM_NEON_OPT 0
 136 #  endif
 137 #endif

1.

sudo cmake .. -D CMAKE_BUILD_TYPE=RELEASE -D
   CMAKE_INSTALL_PREFIX=../install -D ENABLE_FAST_MATH=1 -D
   WITH_OPENCL=ON -D WITH_IPP=OFF -D ITH_GTK=ON -D WITH_GTK3=ON  -D
   BUILD_SHARED_LIBS=OFF -D
   CMAKE_C_COMPILER=/home/jeffrey/360/host/bin/aarch64-buildroot-linux-gnu-gcc
   -D CMAKE_CXX_COMPILER=/home/jeffrey/360/host/bin/aarch64-buildroot-linux-gnu-g++

2.

  • sudo make -j12

3.

  • sudo make install
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值