The unending joy of compiling ruby-postgres under Mac OS X

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,
Thomas Yager-Madden
http://syntactician.com

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

···

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,

--

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

===============================================================================

Ara,

Bless you, that was just the ticket. All is joyous and
ruby-postgresquelish now.

- Thomas

Thomas, I have a rubygem for Ruby-Postgres. Works fine for Linux, but I have
never been able to try for Mac. Mr. David Heinemeier Hansson was very
interested in this, but never got back to me on whether it worked or not.
With your new found "ticket" would you mind taking a look and seeing if you
could get it working. That would make a lot of folks happy me thinks.

T.

···

On Wednesday 06 October 2004 05:49 pm, Thomas Yager-Madden wrote:

Ara,

Bless you, that was just the ticket. All is joyous and
ruby-postgresquelish now.

- Thomas

T.-

Since I'm just trying stuff out here for the most part, I'd be happy to take your package for a spin, but I'll need a little more information how to get it. I just tried a regular "gem install ruby-postgres" and got result " Could not find ruby-postgres (> 0) in the repository"

So, if you can get me pointed the right way, I'll see what I can do. Meanwhile, I have Ruby-DBI w/ pg-dbd working now, as well as ruby-postgres, so I'm a lot happier than I was this morning.

Two weird compile difficulties solved in one day. This is a great newsgroup :slight_smile:

- Thomas

···

On 2004-10-06 17:29:50 -0500, "trans. (T. Onoma)" <transami@runbox.com> said:

Thomas, I have a rubygem for Ruby-Postgres. Works fine for Linux, but I have never been able to try for Mac. Mr. David Heinemeier Hansson was very interested in this, but never got back to me on whether it worked or not. With your new found "ticket" would you mind taking a look and seeing if you could get it working. That would make a lot of folks happy me thinks.

No problem. I have it. I will send it to you with instructions. Just give me a
few days as I am pretty busy at the moment. If you get a moment though, and
haven't already done so, you may want to read up on how to build a Gem --it's
pretty straightforward actually.

Thanks!
T.

···

On Wednesday 06 October 2004 10:04 pm, Thomas wrote:

Since I'm just trying stuff out here for the most part, I'd be happy to
take your package for a spin, but I'll need a little more information
how to get it. I just tried a regular "gem install ruby-postgres" and
got result " Could not find ruby-postgres (> 0) in the repository"

So, if you can get me pointed the right way, I'll see what I can do.
Meanwhile, I have Ruby-DBI w/ pg-dbd working now, as well as
ruby-postgres, so I'm a lot happier than I was this morning.