On Wed, 6 Oct 2004, Thomas Yager-Madden wrote:

> Seems like I've been here before; now I'm enjoying it with upgraded
> versions of everything.
>
> Under OS X.3.5, have compiled and built Ruby 1.8.1 and PostgreSQL
> 7.4.5, and both are working fine.
>
> Based on previous experience, executed ranlib against pgsql library
> archive libpq.a before attempting to compile ruby-postgres extension.
> Appeared to have success with extconf.rb, make, and install of
> ruby-postgres, which all ran without error or complaint.
>
> Any attempt to run Ruby code with `require "postgres"` however, returns
> error "dyld: ruby Undefined symbols:" and complete list of all symbols
> in libpq.
>
> Any suggestions or reports from anybody who got this working in similar
> environment much appreciated.
> Thanks,

BEFORE you compile the ruby-postgres binding do something like

   ~ > export LD_RUN_PATH=/full/path/to/postgresql/lib/

   ~ > ruby extconf.rb && make clean && make && sudo make install

this will encode the paths to the postgresql lib (a dependancy that is
resolved at run time) into the ruby postgresql lib.  you should be able to see
this with

   ~ > ldd postgres.so

which should show the paths to your postgresql installation.  this last bit
might not work on mac but the the compile should.

you can test this before recompiling with

   ~ > export LD_LIBRARY_PATH=/full/path/to/postgresql/lib/
   ~ > irb -r postgres

which should work even now.

do a man ld.so for more info.

kind regards.

-a
--
===============================================================================
| EMAIL   :: Ara [dot] T [dot] Howard [at] noaa [dot] gov
| PHONE   :: 303.497.6469
| A flower falls, even though we love it;
| and a weed grows, even though we do not love it. 
|   --Dogen
===============================================================================