pg_ctl:加载共享库时出错:libpq.so.5 [英] pg_ctl: error while loading shared libraries: libpq.so.5

查看:753
本文介绍了pg_ctl:加载共享库时出错:libpq.so.5的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试通过以下方式获取postgres服务器状态:

I'm trying to get postgres server status with:

sudo /etc/init.d/postgres status -u postgres

但是出现以下错误:

/home/alex/olddisk/usr/local/pgsql/bin/pg_ctl: error while loading shared libraries: libpq.so.5: cannot open shared object file: No such file or directory

我添加了:

export LD_LIBRARY_PATH=""
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/local/lib/"
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/home/alex/olddisk/usr/local/pgsql/lib/"

到我的 .bashrc ,但没有帮助。

谢谢。

推荐答案

当我使用--prefix标志从源代码构建postgresql时,遇到了此错误。从源代码进行构建会将必要的共享库安装到您指定的前缀目录下的libs文件夹中,而不是通常的位置安装中放置的共享库。为了解决该问题,我仅将[prefix] .libs文件夹添加到LD_LIBRARY_PATH环境变量中。例如,使用--prefix / mike / sandbox / postgres构建postgres之后,以下命令解决了该问题:

I ran into this error when I built postgresql from source using the --prefix flag. Building from source installs the necessary shared libs to the libs folder under the prefix directory you specified, instead of the usual place installations put shared libs. To solve the problem I just added the [prefix].libs folder to the LD_LIBRARY_PATH environment variable. For example, after building postgres using --prefix /mike/sandbox/postgres, the below command solved the issue:

export LD_LIBRARY_PATH = / mike / sandbox / postgres / lib :$ LD_LIBRARY_PATH

export LD_LIBRARY_PATH=/mike/sandbox/postgres/lib:$LD_LIBRARY_PATH

这篇关于pg_ctl:加载共享库时出错:libpq.so.5的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆