2021-05-12 14:32:11
解決一個Ubuntu中編譯NEON優化的OpenCV的錯誤
在Ubuntu 16.04中編譯開啟NEON優化的Opencv時,遇到libpng編譯是使用組合程式碼的錯誤,完整錯誤見文章末尾。通過查詢發現解決方案是安裝跨平台編譯器,安裝程式碼如下:
sudo apt-get install gcc-arm-linux-gnueabi
sudo apt-get install gcc-arm-linux-gnueabihf
sudo apt-get install g++-arm-linux-gnueabihf
在參考1中說的是用OCV原始碼中的toolchain_file,但是我用這個編譯出來的會導致各種undefin reference,還是要用NDK中的toolchai_file才行
[ 17%] Building C object 3rdparty/libpng/CMakeFiles/libpng.dir/arm/arm_init.c.o
[ 17%] Building ASM object 3rdparty/libpng/CMakeFiles/libpng.dir/arm/filter_neon.S.o
<instantiation>:18:9: error: unknown directive
.func png_read_filter_row_sub4_neon
^
/home/willhua/opencv/opencv-3.4.1/3rdparty/libpng/arm/filter_neon.S:65:1: note: while in macro instantiation
func png_read_filter_row_sub4_neon, export=1
^
<instantiation>:2:9: error: unknown directive
.endfunc
^
/home/willhua/opencv/opencv-3.4.1/3rdparty/libpng/arm/filter_neon.S:79:1: note: while in macro instantiation
endfunc
^
<instantiation>:18:9: error: unknown directive
.func png_read_filter_row_sub3_neon
^
/home/willhua/opencv/opencv-3.4.1/3rdparty/libpng/arm/filter_neon.S:81:1: note: while in macro instantiation
func png_read_filter_row_sub3_neon, export=1
^
<instantiation>:2:9: error: unknown directive
.endfunc
^
/home/willhua/opencv/opencv-3.4.1/3rdparty/libpng/arm/filter_neon.S:105:1: note: while in macro instantiation
endfunc
^
<instantiation>:18:9: error: unknown directive
.func png_read_filter_row_up_neon
^
/home/willhua/opencv/opencv-3.4.1/3rdparty/libpng/arm/filter_neon.S:107:1: note: while in macro instantiation
func png_read_filter_row_up_neon, export=1
^
<instantiation>:2:9: error: unknown directive
.endfunc
^
/home/willhua/opencv/opencv-3.4.1/3rdparty/libpng/arm/filter_neon.S:118:1: note: while in macro instantiation
endfunc
^
<instantiation>:18:9: error: unknown directive
.func png_read_filter_row_avg4_neon
^
/home/willhua/opencv/opencv-3.4.1/3rdparty/libpng/arm/filter_neon.S:120:1: note: while in macro instantiation
func png_read_filter_row_avg4_neon, export=1
^
<instantiation>:2:9: error: unknown directive
.endfunc
^
/home/willhua/opencv/opencv-3.4.1/3rdparty/libpng/arm/filter_neon.S:139:1: note: while in macro instantiation
endfunc
^
<instantiation>:18:9: error: unknown directive
.func png_read_filter_row_avg3_neon
^
/home/willhua/opencv/opencv-3.4.1/3rdparty/libpng/arm/filter_neon.S:141:1: note: while in macro instantiation
func png_read_filter_row_avg3_neon, export=1
^
<instantiation>:2:9: error: unknown directive
.endfunc
^
/home/willhua/opencv/opencv-3.4.1/3rdparty/libpng/arm/filter_neon.S:174:1: note: while in macro instantiation
endfunc
^
<instantiation>:18:9: error: unknown directive
.func png_read_filter_row_paeth4_neon
^
/home/willhua/opencv/opencv-3.4.1/3rdparty/libpng/arm/filter_neon.S:192:1: note: while in macro instantiation
func png_read_filter_row_paeth4_neon, export=1
^
<instantiation>:2:9: error: unknown directive
.endfunc
^
/home/willhua/opencv/opencv-3.4.1/3rdparty/libpng/arm/filter_neon.S:213:1: note: while in macro instantiation
endfunc
^
<instantiation>:18:9: error: unknown directive
.func png_read_filter_row_paeth3_neon
^
/home/willhua/opencv/opencv-3.4.1/3rdparty/libpng/arm/filter_neon.S:215:1: note: while in macro instantiation
func png_read_filter_row_paeth3_neon, export=1
^
<instantiation>:2:9: error: unknown directive
.endfunc
^
/home/willhua/opencv/opencv-3.4.1/3rdparty/libpng/arm/filter_neon.S:250:1: note: while in macro instantiation
endfunc
^
3rdparty/libpng/CMakeFiles/libpng.dir/build.make:446: recipe for target '3rdparty/libpng/CMakeFiles/libpng.dir/arm/filter_neon.S.o' failed
make[2]: *** [3rdparty/libpng/CMakeFiles/libpng.dir/arm/filter_neon.S.o] Error 1
CMakeFiles/Makefile2:655: recipe for target '3rdparty/libpng/CMakeFiles/libpng.dir/all' failed
make[1]: *** [3rdparty/libpng/CMakeFiles/libpng.dir/all] Error 2
Makefile:162: recipe for target 'all' failed
make: *** [all] Error 2
Linux公社的RSS地址:https://www.linuxidc.com/rssFeed.aspx
本文永久更新連結地址:https://www.linuxidc.com/Linux/2018-09/154272.htm
相關文章