我用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)
离线
这是链接的库不对吧,交叉编译链接到了本机的opencv
离线
这是链接的库不对吧,交叉编译链接到了本机的opencv
我找到问题了。是我在编译open CV的时候没有选择交叉编译,而是直接编译了x86的。
离线