博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
error while loading shared libraries错误解决
阅读量:4160 次
发布时间:2019-05-26

本文共 1700 字,大约阅读时间需要 5 分钟。

出错如下:

主要错误:error while loading shared libraries: libboost_regex.so.1.51.0: cannot open shared object file: No such file or directory

错误过程如下:

[cpp] 
 
  1. [root@node07 C++]# ll  
  2. 总用量 960  
  3. -rw-r--r--. 1 root root  90915  9月 15 20:47 1.html  
  4. -rw-r--r--. 1 root root  86714  9月 15 20:48 2.html  
  5. -rw-r--r--. 1 root root  89032  9月 15 20:49 3.html  
  6. -rw-r--r--. 1 root root    239  9月 16 10:40 main.cpp  
  7. -rw-r--r--. 1 root root   5684  9月 16 10:48 main.o  
  8. -rw-r--r--. 1 root root    320  9月 16 10:28 Makefile  
  9. -rwxr-xr-x. 1 root root 256884  9月 16 10:48 target  
  10. -rw-r--r--. 1 root root      0  9月 15 20:49 test.txt  
  11. -rw-r--r--. 1 root root   4365  9月 15 20:35 TextExtractor.cpp  
  12. -rw-r--r--. 1 root root   1710  9月 15 20:58 TextExtractor.h  
  13. -rw-r--r--. 1 root root 421412  9月 16 10:48 TextExtractor.o  
  14. [root@node07 C++]# ./target  
  15. ./target: error while loading shared libraries: libboost_regex.so.1.51.0: cannot open shared object  
  16. file: No such file or directory  

那就表示系统不知道xxx.so放在哪个目录下,这个时候就要在/etc/ld.so.conf中加入xxx.so所在的目录。首先查找存在的目录,结果为/usr/local/boost_1_51_0/~/boost_install/lib/,具体操作如下:

[cpp] 
 
  1. [root@node07 C++]# find / -name libboost_regex.*  
  2. /usr/local/boost_1_51_0/bin.v2/libs/regex/build/gcc-4.4.5/release/threading-multi/libboost_regex.so.1.51.0  
  3. /usr/local/boost_1_51_0/bin.v2/libs/regex/build/gcc-4.4.5/release/link-static/threading-multi/libboost_regex.a  
  4. /usr/local/boost_1_51_0/~/boost_install/lib/libboost_regex.so.1.51.0  
  5. /usr/local/boost_1_51_0/~/boost_install/lib/libboost_regex.so  
  6. /usr/local/boost_1_51_0/~/boost_install/lib/libboost_regex.a  

一般而言,有很多so档会在/usr/local/lib这个目录下,所以在/etc/ld.so.conf中加入/usr/local/lib这一行,可以解决此问题。

将/etc/ld.so.conf存档后,还要执行/etc/ldconfig 来更新一下才会生效。

[cpp] 
 
  1. [root@node07 C++]# cd /etc/  
  2. [root@node07 etc]# ldconfig  

再次运行target 无错误。

转载地址:http://psdxi.baihongyu.com/

你可能感兴趣的文章
Multi-view People Tracking via Hierarchical Trajectory Composition
查看>>
Online Multi-Object Tracking via Structural Constraint Event Aggregation
查看>>
The Solution Path Algotithm for Identity-Aware Multi-Object Tracking
查看>>
Groupwise Tracking of Crowded Similar-Appearance Targets from Low-Continuity Image Sequences
查看>>
CDTS: Collaborative Detection, Tracking, and Segmentation for Online Multiple Object Segmentation
查看>>
Deep Network Flow for Multi-Object Tracking
查看>>
Multiple People Tracking by Lifted Multicut and Person Re-identification
查看>>
Multi-Object Tracking with Quadruplet Convolutional Neural Networks
查看>>
关于多目标跟踪的一点理解
查看>>
Learning by tracking:Siamese CNN for robust target association
查看>>
MUSTer:Multi-Store Tracker:A Cognitive Psychology Inspired Approach to Object Tracking
查看>>
Understanding and Diagnosing Visual Tracking Systems
查看>>
Multiple People Tracking by Lifted Multicut and Person Re-identification
查看>>
Visual Tracking Using Attention-Modulated Disintegration and Integration
查看>>
Action-Decision Networks for Visual Tracking with Deep Reinforcement Learning
查看>>
Multiple Object Tracking with High Performance Detection and Appearance Feature
查看>>
深度学习入门(上)-第一章 必备基础知识点
查看>>
ubuntu unzip解压时提示错误 解决方法
查看>>
sprintf函数的说明
查看>>
BOOST_TYPEOF和BOOST_AUTO 作用
查看>>