赞
踩
常见方法如下:
1 直接arm64平台端编译,make -j 改make 去掉-j, 单线程编译,增加交换空间swap,可能因为内存过低编译过程报c++内部编译异常或死机。编译后直接运行bin,缺库找库,find / -name "libboost_*" 拷贝到/usr/lib:/usr/local/lib下,直至跑通为止。
2 PC端交叉编译:编译架构主要是 从configure文件开始编译方式,有makefile文件编译方式,cmakelists.txt工程编译方式,meson build编译方式。configure方式需要改configure.config的gcc/g++路径, makefile方式用-I/ -L/的方式指定库和CC CXX指定arm编译器为arm-linux**gcc/g++等。cmakelists.txt方式用set()指定编译器路径,include_directories() link_directories() 等指定库目录和头文件目录。
3 常见报错:findcmake.cmake找不到库,根据提示缺少哪个库,用github下载或CSDN下载后配置arm-linux-gcc/g++编译器后编译。之后重新cmake .. 编译。
undefined reference to xxx : 找不到库,在编译100%最后链接时出现,库路径指示不对,查找对应库和头文件,指定库路径,target_link_libaries()新增库名称。
could not find some xxx.so needed by xxx.so 表示找不到某库,find / -name "xxx.so" 拷贝到/usr/lib/下,或target_link_libraries()新增库名称。
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。