您尚未登录。

楼主 # 2023-08-15 04:18:41

Xiaoci
会员
注册时间: 2022-07-11
已发帖子: 24
积分: 15

使用docker环境arm交叉编译OpenCV出错

我用V3S的docker环境准备交叉编译一个OpenCV的程序去v3s
我编译成功helloworld后准备弄OpenCV
但是很奇怪的事情发生了

当我的cpp文件还是helloworld原来的样子
我单独编译arm程序可以编译
或者单独编译opencv程序也可以正常编译
当我在cmakelists.txt同时启用arm交叉编译和opencv时候就报错报错如下

/usr/local/lib/libopencv_highgui.so.4.8.0: file not recognized: File format not recognized
collect2: error: ld returned 1 exit status
CMakeFiles/Test2.dir/build.make:109: recipe for target 'Test2' failed
make[2]: *** [Test2] Error 1
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/Test2.dir/all' failed
make[1]: *** [CMakeFiles/Test2.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2

当我编译一个正常的opencv程序cmake启用opencv,不启用交叉编译时,他也能编译

#include <opencv2/highgui/highgui.hpp>
#include <opencv2/imgproc/imgproc.hpp>
#include <opencv2/core/core.hpp>
#include<iostream>
#include <string>
#include <sstream>
using namespace cv;
using namespace std;
int main()
{
// Capture the Image from the webcam
VideoCapture cap(0);

// Get the frame
Mat save_img; cap >> save_img;

if(save_img.empty())
{
  std::cerr << "Something is wrong with the webcam, could not get frame." << std::endl;
}
// Save the frame into a file
imwrite("test.jpg", save_img); // A JPG FILE IS BEING SAVED
}

最近编辑记录 Xiaoci (2023-08-15 04:19:36)

离线

#1 2023-08-24 13:39:51

lignin
会员
注册时间: 2020-03-21
已发帖子: 99
积分: 97.5

Re: 使用docker环境arm交叉编译OpenCV出错

这是链接的库不对吧,交叉编译链接到了本机的opencv

离线

楼主 #2 2023-09-10 00:11:18

Xiaoci
会员
注册时间: 2022-07-11
已发帖子: 24
积分: 15

Re: 使用docker环境arm交叉编译OpenCV出错

lignin 说:

这是链接的库不对吧,交叉编译链接到了本机的opencv

我找到问题了。是我在编译open CV的时候没有选择交叉编译,而是直接编译了x86的。

离线

页脚

工信部备案:粤ICP备20025096号 Powered by FluxBB

感谢为中文互联网持续输出优质内容的各位老铁们。 QQ: 516333132, 微信(wechat): whycan_cn (哇酷网/挖坑网/填坑网) service@whycan.cn