终端输入以下命令
cmake-gui
弹出以下界面 :
说明:
Where is the source code对应opencv的文件夹,
Where to build the binaries对应opencv存放编译好的配置文件等信息的文件夹(比如刚创建的build文件夹)
--------------------------------------------------------------------------------------------
点击Configure,弹出编译方式选择对话框
选择第四项,交叉编译
做如下配置
Operating System 输入Linux
Processor 输入 arm
C和C++填写自己的交叉编译器
Target Root填写编译器的lib
---------------------
海思平台如下配置:
Operation System --- arm-himix200-linux-gcc
gcc ----/opt/hisi-linux/x86-arm/arm-himix200-linux/bin/arm-himix200-linux-gcc
g++ ----/opt/hisi-linux/x86-arm/arm-himix200-linux/bin/arm-himix200-linux-g++
Target Root ---/opt/hisi-linux/x86-arm/arm-himix200-linux/bin
-----
点击Finish
-----
海思:
勾选Advanced
配置:CMAKE_EXE_LINKER_FLAGS:-lpthread -lrt -ldl
--------------
Search搜索BUILD_ZLIB,勾选上
Search搜搜BUILD_PNG,勾选上
同理,还有 TBB, TIFF, JPEG
==============================================
Search搜索Build_open 只留下这么几个模块
Search输入install,设置下install路径CMAKE_INSTALL_PREFIX:
Search搜 CMAKE_BUILD_TYPE,改成Release
Search搜build_sh,编译静态库:
点击Configure
点击Generate
进入build目录,执行编译
make -j8
make install
=============================================================
交叉编译: log4cpp
下载地址:https://github.com/orocos-toolchain/log4cpp/releases
编译:
./configure CC=/XXXX/bin/arm-linux-gnueabihf-gcc CXX=/XXXX/bin/arm-linux-gnueabihf-g++ --host=arm-linux --prefix=/abc/def --with-pthreads
==============================================================
交叉编译: cJSON
静态库
gcc -c cJSON.c
ar rcs libcjson.a cJSON.o
动态库
gcc -c -o cJSON.o -fPIC cJSON.c
gcc -shared -o libcjson.so cJSON.o
或直接连写:
gcc -shared -fPIC -o libcjson.so cJSON.c