error while loading shared libraries: ../../lib/libopencv_core.so

原文:http://blog.chinaunix.net/uid-27134408-id-5122776.html

最近做OpenCV的交叉编译,参考了国内某大大的博客之后,成功编译出动态库文件,但运行时总是报错:
/rom/data/avt/test/cardetect/testso: error while loading shared libraries: ../../lib/libopencv_core.so: cannot open shared object file: No such file or directory
分析认为是运行时libopencv_highgui.so和libopencv_objdetect.so链接../../lib/libopencv_core.so时找不到库文件造成的。问题就出在libopencv_core.so前面奇怪的"../../lib/"相对路径。用readelf -d查看libopencv_highgui.so文件信息:

点击(此处)折叠或打开

  1. readelf -d libopencv_highgui.so
  2. Dynamic section at offset 0x50580 contains 30 entries:
  3. Tag Type Name/Value
  4. 0x00000001 (NEEDED) Shared library: [../../lib/libopencv_core.so]
  5. 0x00000001 (NEEDED) Shared library: [../../lib/libopencv_imgproc.so]
  6. 0x00000001 (NEEDED) Shared library: [libstdc++.so.6]
  7. 0x00000001 (NEEDED) Shared library: [libm.so.6]
  8. 0x00000001 (NEEDED) Shared library: [libgcc_s.so.1]
  9. 0x00000001 (NEEDED) Shared library: [libc.so.6]
  10. 0x0000000c (INIT) 0xa410
  11. 0x0000000d (FINI) 0x49ed4
  12. 0x00000019 (INIT_ARRAY) 0x50000
  13. 0x0000001b (INIT_ARRAYSZ) 12 (bytes)
  14. 0x0000001a (FINI_ARRAY) 0x5000c
  15. ......

果然libopencv_highgui.so链接core库的时候把../../lib也加上去了。
我研究了半天也没找到这个路径是在哪里可以设置的,突然想到,google上国外友人似乎很少遇到这个问题。于是按照这篇文章又重编了opencv:
http://processors.wiki.ti.com/index.php/Building_OpenCV_for_ARM_Cortex-A8
其中编译过程中需要在toolchain.cmake中增加一项配置:

点击(此处)折叠或打开

  1. set( CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER )

否则cmake会从root path中寻找make和gcc\g++使用,这会产生类似expect ")"的错误信息。
之后按照步骤编译出动态库,再用readelf查看一下:

点击(此处)折叠或打开

  1. readelf -d libopencv_objdetect.so
  2. Dynamic section at offset 0x107628 contains 35 entries:
  3. Tag Type Name/Value
  4. 0x00000001 (NEEDED) Shared library: [libopencv_core.so.2.4]
  5. 0x00000001 (NEEDED) Shared library: [libopencv_imgproc.so.2.4]
  6. 0x00000001 (NEEDED) Shared library: [libopencv_highgui.so.2.4]
  7. 0x00000001 (NEEDED) Shared library: [libdl.so.2]
  8. 0x00000001 (NEEDED) Shared library: [libpthread.so.0]
  9. 0x00000001 (NEEDED) Shared library: [librt.so.1]
  10. 0x00000001 (NEEDED) Shared library: [libstdc++.so.6]
  11. .........

这样放到arm下面运行,就会从当前目录下正确的找到core库了。

error while loading shared libraries: ../../lib/libopencv_core.so相关推荐

  1. ubuntu执行uci出现 uci: error while loading shared libraries: lib

    问题描述 ubuntu下测试uci出现如下错误 root@virtual-machine:/home//uci# uci uci: error while loading shared librari ...

  2. sqlplus: error while loading shared libraries

    2019独角兽企业重金招聘Python工程师标准>>> 错误: sqlplus: error while loading shared libraries: ../lib/libcl ...

  3. error while loading shared libraries: libopencv_core.so.3.4: cannot open 报错解决方法

    报错: build_release/tools/caffe: error while loading shared libraries: libopencv_core.so.3.4: cannot o ...

  4. /usr/lib/deepin-wine/wine: error while loading shared libraries: libwine.so.1

    deepin-wine安装后,安装其他应用出现一下错误: /usr/lib/deepin-wine/wine: error while loading shared libraries: libwin ...

  5. GCC 链接 xxx:No such file or directory 及运行可执行文件 error while loading shared libraries: xxx.so 解决方案

    关于 GCC 提示找不到指定库文件的这个问题,通常出现在以下 2 个场景中: 利用静态库或者动态库文件实现链接操作(生成可执行文件)时,·GCC 可能会提示 xxx:No such file or d ...

  6. error while loading shared libraries: libstdc++.so.5: wrong ELF class: ELFCLASS64

    今天部署一个探针在运行的时候报了这样一个错:error while loading shared libraries: libstdc++.so.5: wrong ELF class: ELFCLAS ...

  7. Linux/ubuntu:Chrome报错解决: error while loading shared libraries: libnss3.so libXss.so.1 libasound.so.

    下午在用nodejs在linux上操作puppeteer/chromium/chrome时报错如下: -> # node search.js count is 1 (node:15360) Un ...

  8. 报错解决:cp: error while loading shared libraries: libc.so.6: cannot open shared object file: No such fi

    我的个人博客:zhang0peter的个人博客 先说一下为什么会发生这个错误,我看这篇博客:分享Centos6.5升级glibc过程 ,里面提到了如下命令: $ rm -rf /lib64/libc. ...

  9. 安装了libevent和memcached之后却发现在执行的时候出现了 error while loading shared libraries问题...

    今天晚上心血来潮装libevent和memcached,可是却出现了奇葩的问题,结果一看越来是引导文件的路径不对! 我遇到  error while loading shared libraries: ...

最新文章

  1. delphi dbgrideh 遍历每一个单元格_用Python解数独[1]:求每个单元格的行值域
  2. UbuntuでPostgreSQLをインストールからリモートアクセスまでの手順
  3. 计算机:2014年考研大纲解析之数据结构
  4. 利用TcpClient TcpListener 实现发送图片
  5. RouteOS的DHCP服务器配置
  6. QtCreator格式化代码---Beautifier插件使用方式
  7. TensorFlow基础笔记(6) 图像风格化实验
  8. Debugging a Plug-in
  9. redis异常处理篇(持续更新中...)
  10. 票据纸张尺寸对照表_粉丝要求,这期整理一版平面设计必备各种尺寸知识(收藏版))...
  11. 方舟服务器炸了怎么修复,《方舟:生存进化》诸事不顺!退款BUG修复服务器又炸...
  12. 解决Gradle‘s dependency cache may be corrupt (this sometimes occurs after a network connection timeout
  13. iOS之安装包优化以及瘦身
  14. 如何用HTML和css实现拼图,打造自己的html5拼图小游戏
  15. tomcat运行后报错“Address localhost:1099 is already in use”
  16. 电脑计算机打不开显示远程过程,Win10打不开图片提示“远程过程调用失败”的解决方案...
  17. js代码优化8个优点
  18. git push到远程仓库时出现unable to access 'https://github.com/**': The requested URL returned error: 403
  19. Chinaren校友录所用的左边弹出式菜单
  20. 【车载开发系列】UDS诊断---OBD基础概述

热门文章

  1. Linux Shell脚本攻略学习总结:二
  2. Linux System Programming --Chapter Five
  3. UNIX中后台进程与守护进程
  4. Makefile 实际用例分析(一) ------- 比较通用的一种架构
  5. 关于伺服驱动控制的课本_西门子伺服电机驱动系列汇总,说明书参数及使用方法。...
  6. 单片机18b20c语言程序,AVR单片机控制DS18B20的示例C程序
  7. ricker 子波matlab,毕设求助!!!雷克子波合成地震信号
  8. 把代码放到服务器文件夹,怎么将本地代码传到云服务器
  9. C语言怎么读取串口的数据为,如何通过串口来读写数据,请教达人
  10. 皮一皮:皇上,他在下毒!