交叉编译opencv4.5.4出现与 libpng 相关的 NEON 优化函数未能找到

编译错误:

/home/lm/software/all_toolchains/rk-linux/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf/bin/../lib/gcc/arm-linux-gnueabihf/8.3.0/../../../../arm-linux-gnueabihf/bin/ld: ../../lib/libopencv_world.so.4.5.4: undefined reference to `png_do_expand_palette_rgb8_neon'

/home/lm/software/all_toolchains/rk-linux/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf/bin/../lib/gcc/arm-linux-gnueabihf/8.3.0/../../../../arm-linux-gnueabihf/bin/ld: ../../lib/libopencv_world.so.4.5.4: undefined reference to `png_init_filter_functions_neon'

/home/lm/software/all_toolchains/rk-linux/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf/bin/../lib/gcc/arm-linux-gnueabihf/8.3.0/../../../../arm-linux-gnueabihf/bin/ld: ../../lib/libopencv_world.so.4.5.4: undefined reference to `png_do_expand_palette_rgba8_neon'

/home/lm/software/all_toolchains/rk-linux/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf/bin/../lib/gcc/arm-linux-gnueabihf/8.3.0/../../../../arm-linux-gnueabihf/bin/ld: ../../lib/libopencv_world.so.4.5.4: undefined reference to `png_riffle_palette_neon'

collect2: 错误: ld 返回 1

make[2]: *** [apps/model-diagnostics/CMakeFiles/opencv_model_diagnostics.dir/build.make:98:bin/opencv_model_diagnostics] 错误 1

make[1]: *** [CMakeFiles/Makefile2:1506:apps/model-diagnostics/CMakeFiles/opencv_model_diagnostics.dir/all] 错误 2

make[1]: *** 正在等待未完成的任务....

[100%] Building CXX object apps/interactive-calibration/CMakeFiles/opencv_interactive-calibration.dir/rotationConverters.cpp.o

[100%] Linking CXX executable ../../bin/opencv_version

/home/lm/software/all_toolchains/rk-linux/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf/bin/../lib/gcc/arm-linux-gnueabihf/8.3.0/../../../../arm-linux-gnueabihf/bin/ld: ../../lib/libopencv_world.so.4.5.4: undefined reference to `png_do_expand_palette_rgb8_neon'

/home/lm/software/all_toolchains/rk-linux/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf/bin/../lib/gcc/arm-linux-gnueabihf/8.3.0/../../../../arm-linux-gnueabihf/bin/ld: ../../lib/libopencv_world.so.4.5.4: undefined reference to `png_init_filter_functions_neon'

/home/lm/software/all_toolchains/rk-linux/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf/bin/../lib/gcc/arm-linux-gnueabihf/8.3.0/../../../../arm-linux-gnueabihf/bin/ld: ../../lib/libopencv_world.so.4.5.4: undefined reference to `png_do_expand_palette_rgba8_neon'

/home/lm/software/all_toolchains/rk-linux/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf/bin/../lib/gcc/arm-linux-gnueabihf/8.3.0/../../../../arm-linux-gnueabihf/bin/ld: ../../lib/libopencv_world.so.4.5.4: undefined reference to `png_riffle_palette_neon'

collect2: 错误: ld 返回 1

make[2]: *** [apps/version/CMakeFiles/opencv_version.dir/build.make:98:bin/opencv_version] 错误 1

make[1]: *** [CMakeFiles/Makefile2:1480:apps/version/CMakeFiles/opencv_version.dir/all] 错误 2

[100%] Linking CXX executable ../../bin/opencv_annotation

/home/lm/software/all_toolchains/rk-linux/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf/bin/../lib/gcc/arm-linux-gnueabihf/8.3.0/../../../../arm-linux-gnueabihf/bin/ld: ../../lib/libopencv_world.so.4.5.4: undefined reference to `png_do_expand_palette_rgb8_neon'

/home/lm/software/all_toolchains/rk-linux/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf/bin/../lib/gcc/arm-linux-gnueabihf/8.3.0/../../../../arm-linux-gnueabihf/bin/ld: ../../lib/libopencv_world.so.4.5.4: undefined reference to `png_init_filter_functions_neon'

/home/lm/software/all_toolchains/rk-linux/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf/bin/../lib/gcc/arm-linux-gnueabihf/8.3.0/../../../../arm-linux-gnueabihf/bin/ld: ../../lib/libopencv_world.so.4.5.4: undefined reference to `png_do_expand_palette_rgba8_neon'

/home/lm/software/all_toolchains/rk-linux/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf/bin/../lib/gcc/arm-linux-gnueabihf/8.3.0/../../../../arm-linux-gnueabihf/bin/ld: ../../lib/libopencv_world.so.4.5.4: undefined reference to `png_riffle_palette_neon'

collect2: 错误: ld 返回 1

make[2]: *** [apps/annotation/CMakeFiles/opencv_annotation.dir/build.make:98:bin/opencv_annotation] 错误 1

make[1]: *** [CMakeFiles/Makefile2:1402:apps/annotation/CMakeFiles/opencv_annotation.dir/all] 错误 2

[100%] Linking CXX executable ../../bin/opencv_visualisation

/home/lm/software/all_toolchains/rk-linux/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf/bin/../lib/gcc/arm-linux-gnueabihf/8.3.0/../../../../arm-linux-gnueabihf/bin/ld: ../../lib/libopencv_world.so.4.5.4: undefined reference to `png_do_expand_palette_rgb8_neon'

/home/lm/software/all_toolchains/rk-linux/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf/bin/../lib/gcc/arm-linux-gnueabihf/8.3.0/../../../../arm-linux-gnueabihf/bin/ld: ../../lib/libopencv_world.so.4.5.4: undefined reference to `png_init_filter_functions_neon'

/home/lm/software/all_toolchains/rk-linux/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf/bin/../lib/gcc/arm-linux-gnueabihf/8.3.0/../../../../arm-linux-gnueabihf/bin/ld: ../../lib/libopencv_world.so.4.5.4: undefined reference to `png_do_expand_palette_rgba8_neon'

/home/lm/software/all_toolchains/rk-linux/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf/bin/../lib/gcc/arm-linux-gnueabihf/8.3.0/../../../../arm-linux-gnueabihf/bin/ld: ../../lib/libopencv_world.so.4.5.4: undefined reference to `png_riffle_palette_neon'

collect2: 错误: ld 返回 1

make[2]: *** [apps/visualisation/CMakeFiles/opencv_visualisation.dir/build.make:98:bin/opencv_visualisation] 错误 1

make[1]: *** [CMakeFiles/Makefile2:1428:apps/visualisation/CMakeFiles/opencv_visualisation.dir/all] 错误 2

[100%] Linking CXX executable ../../bin/opencv_interactive-calibration

/home/lm/software/all_toolchains/rk-linux/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf/bin/../lib/gcc/arm-linux-gnueabihf/8.3.0/../../../../arm-linux-gnueabihf/bin/ld: ../../lib/libopencv_world.so.4.5.4: undefined reference to `png_do_expand_palette_rgb8_neon'

/home/lm/software/all_toolchains/rk-linux/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf/bin/../lib/gcc/arm-linux-gnueabihf/8.3.0/../../../../arm-linux-gnueabihf/bin/ld: ../../lib/libopencv_world.so.4.5.4: undefined reference to `png_init_filter_functions_neon'

/home/lm/software/all_toolchains/rk-linux/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf/bin/../lib/gcc/arm-linux-gnueabihf/8.3.0/../../../../arm-linux-gnueabihf/bin/ld: ../../lib/libopencv_world.so.4.5.4: undefined reference to `png_do_expand_palette_rgba8_neon'

/home/lm/software/all_toolchains/rk-linux/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf/bin/../lib/gcc/arm-linux-gnueabihf/8.3.0/../../../../arm-linux-gnueabihf/bin/ld: ../../lib/libopencv_world.so.4.5.4: undefined reference to `png_riffle_palette_neon'

collect2: 错误: ld 返回 1

make[2]: *** [apps/interactive-calibration/CMakeFiles/opencv_interactive-calibration.dir/build.make:178:bin/opencv_interactive-calibration] 错误 1

make[1]: *** [CMakeFiles/Makefile2:1454:apps/interactive-calibration/CMakeFiles/opencv_interactive-calibration.dir/all] 错误 2

make: *** [Makefile:166:all] 错误 2

libopencv_world.so.4.5.4 依赖了以下几个符号:

  • png_do_expand_palette_rgb8_neon
  • png_init_filter_functions_neon
  • png_do_expand_palette_rgba8_neon
  • png_riffle_palette_neon

解决:

打开opencv源码目录,编辑文件 vim 3rdparty/libpng/pngpriv.h

第130行注释掉, 修改为131行

相关推荐
陈小也~4 小时前
VMware虚拟机Ubuntu 18.04版本 磁盘扩容
linux·ubuntu
Huazzi.9 小时前
Linux(Ubuntu)命令大全——已分类整理,学习、查看更加方便直观!(2024年最新编制)
linux·学习·ubuntu
Algorithm157611 小时前
linux/ubuntu安装Prometheus&Grafana
linux·ubuntu·prometheus
龚建波12 小时前
记录:virt-manager配置Ubuntu arm虚拟机
linux·ubuntu·virt-manager
zhy2956313 小时前
【UBUNTU 20】环境变量
linux·运维·ubuntu
Crime_man13 小时前
Ubuntu系统安装MySQL
mysql·ubuntu·adb
vvw&14 小时前
如何在 Ubuntu 22.04 上安装 JupyterLab 环境教程
linux·运维·服务器·ubuntu·jupyter·开源·python3.11
zengshitang52014 小时前
Intel-ECI之Codesys PLC + Ethercat 远端IO + Codesys IDE编程
linux·windows·ubuntu
freesky16 小时前
Ubuntu安装及删除httpd(Apache)
linux·运维·服务器·ubuntu·apache