天天看点

交叉编译opencv:undefined reference to `png_riffle_palette_neon

  • 错误
usr/lib/gcc-cross/aarch64-linux-gnu/8/../../../../aarch64-linux-gnu/bin/ld: ../../lib/libopencv_imgcodecs.so.4.2.0: undefined reference to `png_riffle_palette_neon'
collect2: error: ld returned 1 exit status
make[2]: *** [apps/annotation/CMakeFiles/opencv_annotation.dir/build.make:89:bin/opencv_annotation] 错误 1
make[1]: *** [CMakeFiles/Makefile2:3746:apps/annotation/CMakeFiles/opencv_annotation.dir/all] 错误 2      
  • 解决办法

方法一:无效

进入到3rdparty/libpng,在CMakeLists.txt顶端增加:

set(ENABLE_NEON ON)      

方法二:有效

${HOME}/

opencv

-3.3.1/3rdparty/libpng/pngpriv.h

/*# if (defined(ARM_NEON) || defined(__ARM_NEON)) && */
 
if defined(PNG_ARM_NEON) && (defined(ARM_NEON) || defined(__ARM_NEON)) && \      

如上所示,把上面的一行注释掉,增加下面一行。再次make即可。

继续阅读