Ruby, OSX and Postgres

Hello,

I’m looking for some help getting Postgres, Ruby and OS X working right on
OS X 10.2.6.

I’ve installed Postgres for OS X from:

http://www.entropy.ch/software/macosx/postgresql/

And then try to install the PostgresRuby modules from the RAA and I get
errors telling me that certain functions aren’t found…

Thanks for any help,

···


Sam Griffith Jr.
email: staypufd@mac.com
Web site: http://homepage.mac.com/staypufd/index.html

Can you show us some output containing these errors ?

···

On Mon, 12 May 2003 17:13:21 +0000, Sam Griffith wrote:

Hello,

I’m looking for some help getting Postgres, Ruby and OS X working right on
OS X 10.2.6.

I’ve installed Postgres for OS X from:

http://www.entropy.ch/software/macosx/postgresql/

And then try to install the PostgresRuby modules from the RAA and I get
errors telling me that certain functions aren’t found…


Simon Strandgaard

Sure can… (And this is from using Ruby-sumo package for OS X… I did it
with just the RAA files and had exactly the same results…) and I used the
PostgreSQL pkg built from this site…

http://www.entropy.ch/software/macosx/postgresql

Does it not build all the libraries or something? I did a 'nm “PQsetdbLogin”
on the libpq.a file in the /usr/local/pgsql/lib directory of postgres and it
seems that the symbol is defined as a Text symbol… I’m at a loss though.

Thanks so much for helping me…

“No make file is created”

···

\ ruby extconf.rb --with-pgsql-include-dir=/usr/local/pgsql/include
–with-pgsql-lib-dir=/usr/local/pgsql/lib?
–with-pgsql-lib-dir=/usr/local/pgsql/lib
checking for cygwin32_socket() in -lwsock32… no
checking for socket() in -lsocket… no
checking for gethostbyname() in -linet… no
checking for gethostbyname() in -lnsl… no
checking for sys/un.h… yes
checking for socket()… yes
checking for hsterror()… no
checking for gethostname()… yes
Using PostgreSQL include directory: /usr/local/pgsql/include
Using PostgreSQL lib directory: /usr/local/pgsql/lib
checking for PQsetdbLogin() in -lpq… no
Could not find PostgreSQL libraries: Makefile not created


Here are the contents of my /usr/local/pgsql/lib directory:

ascii_and_mic.so libpgtcl.so.2 utf8_and_euc_kr.so
cyrillic_and_mic.so libpgtcl.so.2.3 utf8_and_euc_tw.so
euc_cn_and_mic.so libpq.a utf8_and_gb18030.so
euc_jp_and_sjis.so libpq.so utf8_and_gbk.so
euc_kr_and_mic.so libpq.so.3 utf8_and_iso8859.so
euc_tw_and_big5.so libpq.so.3.0 utf8_and_iso8859_1.so
latin2_and_win1250.so plperl.so utf8_and_johab.so
latin_and_mic.so plpgsql.so utf8_and_sjis.so
libecpg.a pltcl.so utf8_and_tcvn.so
libecpg.so utf8_and_ascii.so utf8_and_uhc.so
libecpg.so.3 utf8_and_big5.so utf8_and_win1250.so
libecpg.so.3.4.1 utf8_and_cyrillic.so utf8_and_win1256.so
libpgtcl.a utf8_and_euc_cn.so utf8_and_win874.so
libpgtcl.so utf8_and_euc_jp.so


Thanks so much,

Sam Griffith Jr.
staypufd@mac.com

On 5/12/2003 12:40 PM, in article pan.2003.05.12.17.40.07.328640@sneakemail.com, “Simon Strandgaard” 0bz63fz3m1qt3001@sneakemail.com wrote:

On Mon, 12 May 2003 17:13:21 +0000, Sam Griffith wrote:

Hello,

I’m looking for some help getting Postgres, Ruby and OS X working right on
OS X 10.2.6.

I’ve installed Postgres for OS X from:

http://www.entropy.ch/software/macosx/postgresql/

And then try to install the PostgresRuby modules from the RAA and I get
errors telling me that certain functions aren’t found…

Can you show us some output containing these errors ?


Simon Strandgaard

Using PostgreSQL include directory: /usr/local/pgsql/include
Using PostgreSQL lib directory: /usr/local/pgsql/lib
checking for PQsetdbLogin() in -lpq… no
Could not find PostgreSQL libraries: Makefile not created

It cannot link with libpq.so… and this file exists in your lib
directory. This should work!

Maybe your libpq.so is a symlink which points at nothing (broken)…
Try do a “ls -la” on the library and post the output.

I don’t have postgres installed. But the output should be similar to this:

ls -la libcrypt.so
lrwxrwxrwx 1 root wheel 13 22 Feb 01:57 libcrypt.so@ → libcrypt.so.2

···

On Mon, 12 May 2003 19:41:04 +0000, Sam Griffith wrote:


Simon Strandgaard

Hi Simon & Sam,

Its well worth sticking with this until you get it working. I think
Ruby & PostgreSQL make great partners. I actually use both the
ruby-postgres package for access to Postgres dtbs from Ruby code, as
well as the plruby-0.3.x package. PLRuby enables you to add Ruby as
another procedural language to ProgreSQL for writing functions within
database.

I ran into the same problem trying to build ruby-postgres. I got help
from Marc Liyanage whose wonderful
http://www.entropy.ch/software/macosx site contains so many Mac OS X
builds of standard Unix tools. Marc helped me to figure out what
needed to be added.

Marc compiled his version of Postgres v7.3.2 for OS X linking to
openssl & the crypto libraries, two libraries that should be present in
Mac OS X 10.2.x. If you add the following lines to the top of your
extconf.rb file for the ruby-postgres-0.7.x package, it should build
without error.

$CFLAGS = " -I/usr/include/openssl "
$LDFLAGS = " -L/usr/lib -lssl -lcrypto "

Using the following command should then successfully build you a
functional ‘make’ file

ruby extconf.rb --with-pgsql-include-dir=/usr/local/pgsql/include
–with-pgsql-lib-dir=/usr/local/pgsql/lib

Best of luck.

Cheers,
Bill

Using PostgreSQL include directory: /usr/local/pgsql/include
Using PostgreSQL lib directory: /usr/local/pgsql/lib
checking for PQsetdbLogin() in -lpq… no
Could not find PostgreSQL libraries: Makefile not created

It cannot link with libpq.so… and this file exists in your lib
directory. This should work!

Maybe your libpq.so is a symlink which points at nothing (broken)…
Try do a “ls -la” on the library and post the output.

I don’t have postgres installed. But the output should be similar to
this:

ls -la libcrypt.so
lrwxrwxrwx 1 root wheel 13 22 Feb 01:57 libcrypt.so@ →
libcrypt.so.2


Simon Strandgaard

Bill Bug
Senior Analyst/Ontological Engineer

Computer Vision Laboratory for Vertebrate Brain Mapping
Department of Neurobiology & Anatomy
Drexel University College of Medicine
2900 Queen Lane
Philadelphia, PA 19129
215 991 8430 (ph)

···

On Monday, May 12, 2003, at 03:24 PM, Simon Strandgaard wrote:

On Mon, 12 May 2003 19:41:04 +0000, Sam Griffith wrote: