Technology-海思 HISI 平台交叉编译

海思 HISI 平台交叉编译

一些参考链接

TFTP 搭建

HISI 交叉编译

OPENCV 3.2 编译

OPENCV 4.0 编译

TFTP 搭建

FFMPEG 编译

遇到的问题及解决方案

OpenCV

1
2
3
4
5
6
opencv-4.1.0/3rdparty/libpng/pngpriv.h:
# if (defined(__ARM_NEON__) || defined(__ARM_NEON)) && \

改为
//# if (defined(__ARM_NEON__) || defined(__ARM_NEON)) && \
# if defined(PNG_ARM_NEON) && (defined(__ARM_NEON__) || defined(__ARM_NEON)) && \
1
2
3
4
5
在 CMakeLists.txt 文件中查找 OPENCV_CONFIG_FILE_INCLUDE_DIR 关键字
并在如下这句后
ocv_include_directories(${OPENCV_CONFIG_FILE_INCLUDE_DIR})
添加如下这句
ocv_include_directories(./3rdparty/zlib/)
1
2
3
4
5
6
7
8
9
在 opencv-4.1.0/modules/core/src/parallel.cpp 中查找 CV__EXCEPTION_PTR 关键字,
添加如下这句
#undef CV__EXCEPTION_PTR // Add this line, disable the EXCEPTION_PTR
在如下内容之上
#ifndef CV__EXCEPTION_PTR
# define CV__EXCEPTION_PTR 0
#elif CV__EXCEPTION_PTR
# include // std::exception_ptr
#endif
1
2
build/CMakeCache.txt下面241行:
CMAKE_CXX_FLAGS:STRING=-fpermissive
1
2
3
4
5
6
7
OpenCV是找不到NVCUVID的,原因是以前NVCUVID和CUDA放在一起的,后来NVIDIA将NVCUVID独立出来了,OpenCV的检测方式还是老的方式,所以找不到NVCUVID,解决方法也很简单,你只需要到opencv-4.5.1/cmake文件夹里找到OpenCVDetectCUDA.cmake

PATHS "${CUDA_TOOLKIT_TARGET_DIR}" "${CUDA_TOOLKIT_ROOT_DIR}"

改成

PATHS "${CUDA_TOOLKIT_TARGET_DIR}" "${CUDA_TOOLKIT_ROOT_DIR}" "/usr/local/include"

FFmpeg

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
修改 detect_ffmpeg.cmake 文件,在执行 make 时便知问题在哪里了
if(HAVE_FFMPEG AND NOT HAVE_FFMPEG_WRAPPER AND NOT OPENCV_FFMPEG_SKIP_BUILD_CHECK)
# try_compile(__VALID_FFMPEG
# "${OpenCV_BINARY_DIR}"
# "${OpenCV_SOURCE_DIR}/cmake/checks/ffmpeg_test.cpp"
# CMAKE_FLAGS "-DINCLUDE_DIRECTORIES:STRING=${FFMPEG_INCLUDE_DIRS}"
# "-DLINK_LIBRARIES:STRING=${FFMPEG_LIBRARIES}"
# OUTPUT_VARIABLE TRY_OUT
# )
# if(NOT __VALID_FFMPEG)
# message(FATAL_ERROR "FFMPEG: test check build log:\n${TRY_OUT}")
# message(STATUS "WARNING: Can't build ffmpeg test code")
# set(HAVE_FFMPEG FALSE)
# endif()
# 注释掉上面的判断检测,直接返回TRUE
set(HAVE_FFMPEG TRUE)
endif()