opencv交叉编译和遇到的问题
flyfish 环境:
Ubuntu18.04
cmake-gui
Cmake 3.10.2
opencv-4.5.5
启动cmake-gui 终端执行 cmake-gui 设置源码路径和构建二进制路径 点击config,设置交叉编译选项 设置最后安装的路径 配置CMAKE_INSTALL_PREFIX,设置最后include和lib的所在的路径 勾选BUILD_ZLIB,BUILD_opencv_world 配置完之后点击Generate
进入build目录执行make -j4
如果问题,可以尝试下面给出的解决方案 最后执行make install安装
遇到的问题 涉及更改CMakeCache.txt文件
CMAKE_CXX_FLAGS:STRING= -Wno-psabi -ldl -lpthread
问题1
include/c++/8.3.0/bits/stl_vector.h:1085:4: 附注: parameter passing for argument of type ‘__gnu_cxx::__normal_iterator<long long int*, std::vector<long long int> >’ changed in GCC 7.1
_M_realloc_insert(end(), __x);
更改CMakeCache.txt文件
CMAKE_CXX_FLAGS:STRING= -Wno-psabi
问题2
../../lib/libopencv_world.so: undefined reference to `dlsym'
collect2: 错误: ld 返回 1
apps/version/CMakeFiles/opencv_version.dir/build.make:95: recipe for target 'bin/opencv_version' failed
make[2]: *** [bin/opencv_version] Error 1
CMakeFiles/Makefile2:3026: recipe for target 'apps/version/CMakeFiles/opencv_version.dir/all' failed
解决方案 更改CMakeCache.txt文件
CMAKE_CXX_FLAGS:STRING= -ldl
问题3
libopencv_world.so: undefined reference to `png_do_expand_palette_rgb8_neon'
undefined reference to `png_init_filter_functions_neon'
undefined reference to `png_do_expand_palette_rgba8_neon'
undefined reference to `png_riffle_palette_neon'
解决方案 opencv-4.5.5/3rdparty/libpng/pngpriv.h
# if (defined(__ARM_NEON__) || defined(__ARM_NEON)) && \
更改为
# if defined(PNG_ARM_NEON) && (defined(ARM_NEON) || defined(__ARM_NEON)) && \
问题4
/arm-linux-gnueabihf/libc/lib/libpthread.so.0: error adding symbols: DSO missing from command line
collect2: 错误: ld 返回 1
modules/world/CMakeFiles/opencv_perf_dnn.dir/build.make:304: recipe for target 'bin/opencv_perf_dnn' failed
make[2]: *** [bin/opencv_perf_dnn] Error 1
CMakeFiles/Makefile2:1572: recipe for target 'modules/world/CMakeFiles/opencv_perf_dnn.dir/all' failed
make[1]: *** [modules/world/CMakeFiles/opencv_perf_dnn.dir/all] Error 2
解决方案 更改CMakeCache.txt文件
CMAKE_CXX_FLAGS:STRING= -lpthread
|