---
title: "error while loading shared libraries的解决方法"
author: "xiaodonggm"
date: "2012-07-31T15:54:49Z"
tags: ["Linux"]
categories: ["操作系统"]
slug: "error-while-loading-shared-libraries"
draft: false
lastmod: "2012-07-31T15:55:37Z"
id: 1613743
url: "https://xiaodonggm.iteye.com/blog/1613743"
---

linux 遇到报错：

error while loading shared libraries: xxx.so.0:cannot open shared object file: No such file or directory  
那就表示系统不知道xxx.so 放在哪个目录下。

这个时候就要在/etc/ld.so.conf中加入xxx.so所在的目录。

一般而言，有很多so会在/usr/local/lib这个目录下，所以在/etc/ld.so.conf中加入/usr/local/lib这一行，可以解决此问题。  
将/etc/ld.so.conf存档后，还要执行「/sbin/ldconfig –v」来更新一下才会生效。