OS: Ubuntu 10.04 LTS
pgAdmin: 1.14 source code
Install:
./configure
make
make install
Trouble shooting:
1. configure: error: Could not find your PostgreSQL installation. You might need to use the --with-pgsql=DIR configure option
apt-get install libpg-dev
2. configure: error: Could not find your wxWidgets installation. You might need to use the --with-wx=DIR configure option
apt-get install wx-common libwxgtk2.8-dev
3. configure: error: Could not find your libxml2 installation. You might need to use the --with-libxml2=DIR configure option
apt-get install libxml2-dev
4. configure: error: Could not find your libxslt installation. You might need to use the --with-libxslt=DIR configure option
apt-get install libxslt1-dev
5. ./db/keywords.c:33:27: error: parser/kwlist.h:...
apt-get install postgresql-server-dev-8.4
解决/usr/bin/ld:cannot find -lxxx 问题
在linux环境编译应用程式或lib的sourcecode时常常会出现如下的错误讯息:
/usr/bin/ld: cannot find -lxxx
这些讯息会随着编译不同类型的source code 而有不同的结果出来如:
/usr/bin/ld: cannot find -lc
/usr/bin/ld: cannot find -lltdl
/usr/bin/ld: cannot find -lXtst
其中xxx即表示函式库文件名称,如上例的:libc.so、libltdl.so、libXtst.so。
其命名规则是:lib+库名(即xxx)+.so。
会发生这样的原因有以下三种情形:
1 系统没有安装相对应的lib
2 相对应的lib版本不对
3 lib(.so档)的symbolic link不正确,没有连结到正确的函式库文件(.so)
对于上述三种原因有一篇文章写的很棒可参考这一篇文章的第4点:
gcc命令祥解
解决方法:
(1)先判断在/usr/lib 下的相对应的函式库文件(.so) 的symbolic link是否正确
若不正确改成正确的连结目标即可解决问题。
(2)若不是symbolic link的问题引起,而是系统缺少相对应的lib安装lib即可解决。
(3)如何安装缺少的lib:
以上面三个错误讯息为例:
错误1缺少libc的LIB
错误2缺少libltdl的LIB
错误3缺少libXtst的LIB
以Ubuntu为例:
先搜寻相对应的LIB再进行安装的作业如:
apt-cache search libc-dev
apt-cache search libltdl-dev
apt-cache search libXtst-dev
实例:
在进行输入法gcin的Source Code的编译时出现以下的错误讯息:
/usr/bin/ld: cannot find -lXtst
经检查后发现是:
lib(.so档)的symbolic link 不正确
解决方法如下:
cd /usr/lib
ln -s libXtst.so.6 libXtst.so
如果在/usr/lib的目录下找不到libXtst.so档,那么就表示系统没有安装libXtst的函式库。
解法如下:
apt-get install libxtst-dev
--------------------------------------------------------------------------------
要让网上别的机子都可以访问则要修改以下东西
$vi /home/postgre/data/pg_hba.conf
在底下加入
local all trust
#允许通过本地的所有机子
host all 0.0.0.0 0.0.0.0 trust
#比如说允许网内192.168.0.96的机子
host all 192.168.1.0 255.255.255.255 trust
host all 192.168.1.96 255.255.255.255 trust)
$vi /home/postgre/data/postgresql.conf
#tcpip_socket = false 修改成 tcpip_socket = true
$ pg_ctl start #启动数据库
$ pg_ctl restart #重启数据库
$ pg_ctl stop #关闭数据库
这样,postgresql就算是安装完毕了,现在我们可以来检验一下;
打开shell输入:
# su - postgre
$ initdb
$ postmaster -i -D ~/data &
$ psql mydb
如果进入数据库,那就是OK了,在这期间比较容易出现问题的是第二步提示你已经存在,这是没有问题的;
但是在执行postmaster -i -D ~/data &,如果有Hint出现,可能是因为上一次打开数据库时没有关,
(关闭shell或是关机是不能将数据库关闭的)因此现输入命令:
$ pg_ctl stop
然后再执行: $ postmaster -i -D ~/data &
应该就可以了.
退出数据库使用: \q
