LINUX 环境变量


编译好 postgresql的RPM 打包,运行 psql 时,出现错误:symbol lookup error..

linux 下查看程序对动态库的依赖关系


 ldd /opt/pgsql-9.3/bin/psql
        linux-vdso.so.1 =>  (0x00007fff8f1ff000)
        libpq.so.5 => /usr/lib64/libpq.so.5 (0x0000003560400000)
        libssl.so.10 => /usr/lib64/libssl.so.10 (0x000000356e000000)
        libreadline.so.6 => /lib64/libreadline.so.6 (0x0000003560800000)
        libc.so.6 => /lib64/libc.so.6 (0x000000355f400000)
        libcrypto.so.10 => /usr/lib64/libcrypto.so.10 (0x000000356a800000)
        libgssapi_krb5.so.2 => /lib64/libgssapi_krb5.so.2 (0x000000356cc00000)
        libcrypt.so.1 => /lib64/libcrypt.so.1 (0x000000356a400000)
        libldap_r-2.4.so.2 => /lib64/libldap_r-2.4.so.2 (0x0000003560000000)
        libpthread.so.0 => /lib64/libpthread.so.0 (0x000000355f800000)
        libkrb5.so.3 => /lib64/libkrb5.so.3 (0x000000356c000000)
        libcom_err.so.2 => /lib64/libcom_err.so.2 (0x0000003569c00000)
        libk5crypto.so.3 => /lib64/libk5crypto.so.3 (0x000000356bc00000)
        libdl.so.2 => /lib64/libdl.so.2 (0x000000355f000000)
        libz.so.1 => /lib64/libz.so.1 (0x000000355fc00000)
        libtinfo.so.5 => /lib64/libtinfo.so.5 (0x000000356fc00000)
        /lib64/ld-linux-x86-64.so.2 (0x000000355ec00000)
        libkrb5support.so.0 => /lib64/libkrb5support.so.0 (0x000000356c400000)
        libkeyutils.so.1 => /lib64/libkeyutils.so.1 (0x000000356c800000)
        libresolv.so.2 => /lib64/libresolv.so.2 (0x0000003561000000)
        libfreebl3.so => /lib64/libfreebl3.so (0x000000356ac00000)
        liblber-2.4.so.2 => /lib64/liblber-2.4.so.2 (0x0000003572000000)
        libssl3.so => /usr/lib64/libssl3.so (0x000000356f400000)
        libsmime3.so => /usr/lib64/libsmime3.so (0x000000356f000000)
        libnss3.so => /usr/lib64/libnss3.so (0x000000356e400000)
        libnssutil3.so => /usr/lib64/libnssutil3.so (0x000000356ec00000)
        libplds4.so => /lib64/libplds4.so (0x000000356e800000)
        libplc4.so => /lib64/libplc4.so (0x000000356dc00000)
        libnspr4.so => /lib64/libnspr4.so (0x000000356d800000)
        libsasl2.so.2 => /usr/lib64/libsasl2.so.2 (0x0000003570800000)
        libselinux.so.1 => /lib64/libselinux.so.1 (0x0000003560c00000)

[root@BSD ~]# ldd /opt/pg932/bin/psql
        linux-vdso.so.1 =>  (0x00007fff745ff000)
        libpq.so.5 => /opt/pg932/lib/libpq.so.5 (0x00007fbf202cc000)
        libreadline.so.6 => /lib64/libreadline.so.6 (0x0000003560800000)
        libc.so.6 => /lib64/libc.so.6 (0x000000355f400000)
        libpthread.so.0 => /lib64/libpthread.so.0 (0x000000355f800000)
        libtinfo.so.5 => /lib64/libtinfo.so.5 (0x000000356fc00000)
        /lib64/ld-linux-x86-64.so.2 (0x000000355ec00000)



[root @BSD x86_64]# /opt/pgsql/9.2/bin/psql -U pg924 -d postgres
/opt/pgsql/9.2/bin/psql: symbol lookup error: /opt/pgsql/9.2/bin/psql: undefined symbol: PQconnectdbParams

即找不到 PQconnectdbParams 的一个函数接口,动态库没找到

动态链接库没有找到,然后看到动态链接库和PATH环境变量有关,于是:
#export PATH=/afc/run/lib:$PATH
#ldcondig
就OK了, 我需要的动态库放在了/afc/run/lib下

你可能感兴趣的:(LINUX 环境变量)