checking for ruby_init() in -lruby-static… yes
checking for catalog/pg_proc.h… yes
checking for PQsetdbLogin() in -lpq… yes
creating Makefile
[Slim:local/src/plruby-0.3.8] root# make
gcc -fno-common -I/usr/local/src/postgresql-7.4.1/src/include/
-I/usr/local/pgsql/include/postgresql/server -DPG_PL_VERSION=74 -I.
-I/usr/local/lib/ruby/1.8/powerpc-darwin
-I/usr/local/lib/ruby/1.8/powerpc-darwin -I. -DHAVE_CATALOG_PG_PROC_H
-I/usr/local/pgsql/include -c plruby.c
In file included from plruby.c:47:
plruby.h:27:32: server/utils/array.h: No such file or directory
plruby.c: In function return_array_type': plruby.c:894: error:ArrayType’ undeclared (first use in this function)
plruby.c:894: error: (Each undeclared identifier is reported only once
plruby.c:894: error: for each function it appears in.)
plruby.c:894: error: array' undeclared (first use in this function) plruby.c: In functionpl_func_handler’:
plruby.c:1380: error: ArrayType' undeclared (first use in this function) plruby.c:1380: error:array’ undeclared (first use in this function)
plruby.c:1384: error: parse error before ‘)’ token
plruby.c:1386: warning: assignment makes pointer from integer without a cast
plruby.c:1391: warning: assignment makes pointer from integer without a cast
make: *** [plruby.o] Error 1
[Slim:local/src/plruby-0.3.8] root# uname -a
Darwin Slim.local 7.2.0 Darwin Kernel Version 7.2.0: Thu Dec 11 16:20:23
PST 2003; root:xnu/xnu-517.3.7.obj~1/RELEASE_PPC Power Macintosh powerpc
I do see /src/include/utils/array.h … did the src hierarchy for
PGSQL change and the make file needs to be updated to match?
Further information:
I tried editing plruby.h to point to the array.h file I saw:
#if PG_PL_VERSION >= 74
#include “server/utils/array.h”
#include “utils/array.h” #endif
And hey! It compiled OK!
But then…awww…it fails just about every test with ‘make test’.
Output follows.
[Slim:local/src/plruby-0.3.8] root# ruby extconf.rb
–with-pgsql-dir=/usr/local/pgsql
–with-pgsql-srcinc=/usr/local/src/postgresql-7.4.1/src/include
checking for ruby_init() in -lruby-static… yes
checking for catalog/pg_proc.h… yes
checking for PQsetdbLogin() in -lpq… yes
creating Makefile
[Slim:local/src/plruby-0.3.8] root# make test
(cd test/plt ; sh ./runtest 74)
**** Destroy old database plruby_test ****
…/runtest: line 9: dropdb: command not found
**** Create test database plruby_test ****
…/runtest: line 15: createdb: command not found
**** Create procedural language plruby ****
…/runtest: line 19: psql: command not found
**** Create tables, functions and triggers ****
…/runtest: line 22: psql: command not found
**** Running test queries ****
Tests faild - look at diffs between
test.expected.74 and test.out
(cd test/plp ; sh ./runtest 74)
**** Destroy old database plruby_test ****
…/runtest: line 9: dropdb: command not found
**** Create test database plruby_test ****
…/runtest: line 15: createdb: command not found
**** Create procedural language plruby ****
…/runtest: line 19: psql: command not found
**** Create tables, functions and triggers ****
…/runtest: line 22: psql: command not found
**** Running test queries ****
Tests faild - look at diffs between
test.expected.74 and test.out
(cd test/range; sh ./runtest 74)
**** Destroy old database plruby_test ****
…/runtest: line 8: dropdb: command not found
**** Create test database plruby_test ****
…/runtest: line 11: createdb: command not found
**** Create procedural language plruby ****
…/runtest: line 15: psql: command not found
**** Running test queries ****
Tests faild - look at diffs between
test.expected.74 and test.out
[Slim:local/src/plruby-0.3.8] root# make install
install -c -p -m 0755 plruby.bundle
/usr/local/lib/ruby/site_ruby/1.8/powerpc-darwin
[Slim:local/src/plruby-0.3.8] root# make test
(cd test/plt ; sh ./runtest 74)
**** Destroy old database plruby_test ****
…/runtest: line 9: dropdb: command not found
**** Create test database plruby_test ****
…/runtest: line 15: createdb: command not found
**** Create procedural language plruby ****
…/runtest: line 19: psql: command not found
**** Create tables, functions and triggers ****
…/runtest: line 22: psql: command not found
**** Running test queries ****
Tests faild - look at diffs between
test.expected.74 and test.out
(cd test/plp ; sh ./runtest 74)
**** Destroy old database plruby_test ****
…/runtest: line 9: dropdb: command not found
**** Create test database plruby_test ****
…/runtest: line 15: createdb: command not found
**** Create procedural language plruby ****
…/runtest: line 19: psql: command not found
**** Create tables, functions and triggers ****
…/runtest: line 22: psql: command not found
**** Running test queries ****
Tests faild - look at diffs between
test.expected.74 and test.out
(cd test/range; sh ./runtest 74)
**** Destroy old database plruby_test ****
…/runtest: line 8: dropdb: command not found
**** Create test database plruby_test ****
…/runtest: line 11: createdb: command not found
**** Create procedural language plruby ****
…/runtest: line 15: psql: command not found
**** Running test queries ****
Tests faild - look at diffs between
test.expected.74 and test.out
I have Ruby 1.8.1, PostgreSQL 7.4.1, mod_ruby 1.1.2, eRuby 1.0.5,
postgres 0.7.1, and Apache 2.0.48 installed and playing nicely together.
[snip]
plruby.h:27:32: server/utils/array.h: No such file or directory
I’m not familiar with the packaging system used in Mac OS X, but have
you installed the ‘postgresql-devel’ package (which contains the
necessary *.h files)? If yes, then check the correct path for
server/utils/array.h (e.g. is it really in
/usr/local/src/postgresql-7.4.1/src/include/?)
[Slim:local/src/plruby-0.3.8] root# ruby extconf.rb
–with-pgsql-dir=/usr/local/pgsql
–with-pgsql-srcinc=/usr/local/src/postgresql-7.4.1/src/include
checking for ruby_init() in -lruby-static… yes
checking for catalog/pg_proc.h… yes
checking for PQsetdbLogin() in -lpq… yes
creating Makefile
[Slim:local/src/plruby-0.3.8] root# make test
(cd test/plt ; sh ./runtest 74)
**** Destroy old database plruby_test ****
./runtest: line 9: dropdb: command not found
**** Create test database plruby_test ****
./runtest: line 15: createdb: command not found
**** Create procedural language plruby ****
./runtest: line 19: psql: command not found
**** Create tables, functions and triggers ****
./runtest: line 22: psql: command not found
**** Running test queries ****
Tests faild - look at diffs between
test.expected.74 and test.out
(cd test/plp ; sh ./runtest 74)
**** Destroy old database plruby_test ****
./runtest: line 9: dropdb: command not found
**** Create test database plruby_test ****
./runtest: line 15: createdb: command not found
**** Create procedural language plruby ****
./runtest: line 19: psql: command not found
**** Create tables, functions and triggers ****
./runtest: line 22: psql: command not found
**** Running test queries ****
Tests faild - look at diffs between
test.expected.74 and test.out
(cd test/range; sh ./runtest 74)
**** Destroy old database plruby_test ****
./runtest: line 8: dropdb: command not found
**** Create test database plruby_test ****
./runtest: line 11: createdb: command not found
**** Create procedural language plruby ****
./runtest: line 15: psql: command not found
**** Running test queries ****
Tests faild - look at diffs between
test.expected.74 and test.out
[Slim:local/src/plruby-0.3.8] root# make install
install -c -p -m 0755 plruby.bundle
/usr/local/lib/ruby/site_ruby/1.8/powerpc-darwin
[Slim:local/src/plruby-0.3.8] root# make test
(cd test/plt ; sh ./runtest 74)
**** Destroy old database plruby_test ****
./runtest: line 9: dropdb: command not found
**** Create test database plruby_test ****
./runtest: line 15: createdb: command not found
**** Create procedural language plruby ****
./runtest: line 19: psql: command not found
**** Create tables, functions and triggers ****
./runtest: line 22: psql: command not found
**** Running test queries ****
Tests faild - look at diffs between
test.expected.74 and test.out
(cd test/plp ; sh ./runtest 74)
**** Destroy old database plruby_test ****
./runtest: line 9: dropdb: command not found
**** Create test database plruby_test ****
./runtest: line 15: createdb: command not found
**** Create procedural language plruby ****
./runtest: line 19: psql: command not found
**** Create tables, functions and triggers ****
./runtest: line 22: psql: command not found
**** Running test queries ****
Tests faild - look at diffs between
test.expected.74 and test.out
(cd test/range; sh ./runtest 74)
**** Destroy old database plruby_test ****
./runtest: line 8: dropdb: command not found
**** Create test database plruby_test ****
./runtest: line 11: createdb: command not found
**** Create procedural language plruby ****
./runtest: line 15: psql: command not found
**** Running test queries ****
Tests faild - look at diffs between
test.expected.74 and test.out
–
EMAIL :: Ara [dot] T [dot] Howard [at] noaa [dot] gov
PHONE :: 303.497.6469
ADDRESS :: E/GC2 325 Broadway, Boulder, CO 80305-3328
URL :: Solar-Terrestrial Physics Data | NCEI
TRY :: for l in ruby perl;do $l -e “print "\x3a\x2d\x29\x0a"”;done
===============================================================================
I’m not familiar with the packaging system used in Mac OS X, but have
you installed the ‘postgresql-devel’ package (which contains the
necessary *.h files)? If yes, then check the correct path for
server/utils/array.h (e.g. is it really in
/usr/local/src/postgresql-7.4.1/src/include/?)
FWIW, this was not a MacOS X specific package. It was precisely:
And hey! It compiled OK!
But then…awww…it fails just about every test with ‘make test’.
export PATH=/usr/local/pgsql/bin:$PATH
this is probably why it can’t fine the commands (assuming they are there)
Indeed, the problem (as I realized when I inspected the error messages
and thought a bit) was that the pgsql commands weren’t in my path.
When I put them there, I got new errors with ‘make test’, which I
believe had to do with the fact that it was invoking psql without a
database name, which was thus looking for a database named ‘root’ (the
user I was running as).
I decided that make test was full of bunk, and went on and installed the
compiled code. I’m happy to report, PL/Ruby is working nicely
So, in summary (for the record/archives):
In order to build PL/Ruby 0.3.8 to work with PostgreSQL 7.4.1 (the
standard .tar.gz source, not some special package for OS X) I had to
change one line in plruby.h from #include “server/utils/array.h”
to #include “utils/array.h”
After that, I needed (not unexpectedly) to explicitly specify the paths
to pgsql (built version and source includes):
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
···
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):
For PostgreSQL 7.2 the source is not required if all headers was installed.
Command (see INSTALL in the directory postgresql-7.2)
make install-all-headers
it’s not my fault if `make install-all-headers’ put the file in
include/server/utils/ and not in include/utils/
Well, there’s our confusion, then.
I didn’t make pgsql with all headers. The includes directory I was
pointing it was was not (in my case)
/usr/local/pgsql/include/
but rather
/usr/local/src/postgresql-7.4.1/src/include/
If you mean to require that postgresql be installed with all headers for
plruby to build properly, then I think the above needs rewording.
But if it is acceptable–when the user (me) hasn’t installed pgsql with
all headers–to point plruby at the headers in the original source
directory for postegresql, then something needs to change slightly in
the header to account for the fact that array.h exists in a sub
‘include/server/utils/’ directory when installed with pgsql, but is out
in the open in ‘include/utils/’ in the original source.
Anyhow, all is working now for me. Thanks for a great tool!