【问题标题】:libopencv_highgui.so.3.4: cannot open shared object file: No such file or directory in the eclipse ide for cross compilerlibopencv_highgui.so.3.4:无法打开共享对象文件:eclipse ide中没有这样的文件或目录用于交叉编译
【发布时间】:2020-08-20 18:40:48
【问题描述】:

我遇到了一个问题。我为嵌入式系统开发交叉编译。我为 arm_linux-gnueabihf 构建了 opencv。

我的 ubuntu 版本是 18.04.2 x86_64 5.3.0.51-generic。

问题

libopencv_highgui.so.3.4:无法打开共享对象文件:没有这样的文件或目录 我构建项目成功,但是当我运行项目时,我遇到了问题

这是我的代码

#include <iostream>
#include <stdio.h>
#include <cv.h>
#include <opencv2/videoio.hpp>
#include <opencv2/core.hpp>
#include <opencv2/core/mat.hpp>
#include <opencv2/highgui/highgui.hpp>
using namespace cv;
using namespace std;

int main(int, char**){
    Mat frame;
    VideoCapture cap;
    int deviceId = 0;
    int apiId = cv::CAP_ANY;
    cap.open(deviceId,apiId);
    if (!cap.isOpened()){
        cerr<<"Error! Unable to camera\n";
        return -1;
    }
    for(;;){
        // read frame
        cap.read(frame);
        if (frame.empty()){
            cerr <<" ERROR ! black frame grabbed ! \n";
            break;
        }
        imshow("Live",frame);
        if (waitKey(5) >= 0){
            break;
        }
    }
    return 0;
}

我检查了库如下:

sudo find / -name "libopencv_highgui.so.3.4"

返回的命令如下

/usr/local/lib/libopencv_highgui.so.3.4
/usr/local/lib/libopencv_highgui.so.3.4.4
/usr/local/include/lib/libopencv_highgui.so.3.4
/usr/local/include/lib/libopencv_highgui.so.3.4.4

我在 /etc/ld.so.conf.d/opencv.conf 中创建了一个包含

的文件
/usr/local/lib
/usr/local/include

然后我运行sudo ldconfig -v的命令,它返回如下

/sbin/ldconfig.real: /usr/local/lib/libopencv_highgui.so.3.4.4 is for unknown machine 40.

/sbin/ldconfig.real: /usr/local/lib/libopencv_imgproc.so is for unknown machine 40.

/sbin/ldconfig.real: /usr/local/lib/libopencv_xfeatures2d.so is for unknown machine 40.

/sbin/ldconfig.real: /usr/local/lib/libopencv_bgsegm.so.3.4.4 is for unknown machine 40.

/sbin/ldconfig.real: /usr/local/lib/libopencv_objdetect.so.3.4 is for unknown machine 40.

还有其他 opencv 的库。

我为库配置了eclipse的设置如下:

跨 G++ 编译器中的“包含”文件夹

跨 G++ 链接器中的“库”文件夹

最后,我在 Eclipse 设置的调试中添加了 LD_LIBRARY_PATH

我尝试了 sudo apt update 和 sudo apt upgrade 命令,但仍然收到错误消息。

有人有什么建议吗?

【问题讨论】:

  • 你是如何安装opencv的?
  • @YunusTemurlenk, github source'dan clone'ladım ve sonrada derlerdim arm için

标签: eclipse opencv ubuntu cross-compiling


【解决方案1】:

解决方案是将“/usr/local/lib”添加到环境中的 LD_LIBRARY_PATH。 我的是 LD_LIBRARY_PATH /usr/arm-linux-gnueabihf/lib/:usr/local/lib/

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2019-02-09
    • 1970-01-01
    • 2015-04-12
    • 2018-11-26
    • 2019-11-27
    • 2020-02-06
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多