From: "Ara.T.Howard" Date: 2004-02-26T02:14:48+09:00 Subject: Re: Further failures On Wed, 25 Feb 2004, Gavin Kistner wrote: > After that, I needed (not unexpectedly) to explicitly specify the paths > to pgsql (built version and source includes): > > ruby extconf.rb --with-pgsql-dir=/usr/local/pgsql > --with-pgsql-srcinc=/usr/local/src/postgresql-7.4.1/src/include > > > After the above, making and installing the code worked: > make > make install be careful - if you run ldd on the postgres.so lib you'll probably see something like [ahoward@www i686-linux]$ ldd postgres.so libpq.so.3 => /usr/lib/libpq.so.3 (0x40012000) libnsl.so.1 => /lib/libnsl.so.1 (0x40027000) libdl.so.2 => /lib/libdl.so.2 (0x4003c000) libcrypt.so.1 => /lib/libcrypt.so.1 (0x4003f000) libm.so.6 => /lib/tls/libm.so.6 (0x4006c000) libc.so.6 => /lib/tls/libc.so.6 (0x42000000) libssl.so.4 => /lib/libssl.so.4 (0x4008f000) libcrypto.so.4 => /lib/libcrypto.so.4 (0x400c4000) libkrb5.so.3 => /usr/kerberos/lib/libkrb5.so.3 (0x401b5000) libresolv.so.2 => /lib/libresolv.so.2 (0x40213000) /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) libgssapi_krb5.so.2 => /usr/kerberos/lib/libgssapi_krb5.so.2 (0x40225000) libk5crypto.so.3 => /usr/kerberos/lib/libk5crypto.so.3 (0x40239000) libcom_err.so.3 => /usr/kerberos/lib/libcom_err.so.3 (0x40249000) libz.so.1 => /usr/lib/libz.so.1 (0x4024b000) except in your case you will probably see libpq.so.3 => /usr/local/lib/libpq.so.3 (0x40012000) ^^^^^ ^^^^^ that's _ok_, but on many linuxes this dir is NOT in the system search path for ld.so (cat /etc/ld.so.conf). it MAY be in your environment or it may be set globally somehow. what i'm saying is that the ruby postgres.so depends on the linker being able to find the required postgresql libraries at runtime. the way it does this is by * standard ld.so search path * contents of /etc/ld.so.conf * paths encoded into postgres.so itself * contents of LD_LIBRARY_PATH i realize your setup may be slightly different. all i'm saying is be sure the way the linker finds the postgresql is set in some _global_ way or some users (say the web using - nobody or www) may have unexpected errors when doing a require 'postgres' i'm spewing all this because i spent some time at one point determining the cause of exactly this problem when all my cgi programs failed to load the postgres lib. the easiest answer is to ~ > export LD_RUN_PATH=/usr/local/pgsql/lib ~ > ruby extconf.rb --with-pgsql-dir=/usr/local/pgsql \ --with-pgsql-srcinc=/usr/local/src/postgresql-7.4.1/src/include ~ > make ~ > make install -a -- =============================================================================== | EMAIL :: Ara [dot] T [dot] Howard [at] noaa [dot] gov | PHONE :: 303.497.6469 | ADDRESS :: E/GC2 325 Broadway, Boulder, CO 80305-3328 | URL :: http://www.ngdc.noaa.gov/stp/ | TRY :: for l in ruby perl;do $l -e "print \"\x3a\x2d\x29\x0a\"";done ===============================================================================