Professional Web Applications Themes

Failure building PL/Ruby on MacOS X 10.3 - Ruby

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. One final piece...I want PL/Ruby in my PGSQL. But it's not liking me: [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 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: ...

  1. #1

    Default Failure building PL/Ruby on MacOS X 10.3

    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.

    One final piece...I want PL/Ruby in my PGSQL. But it's not liking me:

    [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
    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 function `pl_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: p 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

    [Slim:local/src/plruby-0.3.8] root# /usr/local/pgsql/bin/postgres --version
    postgres (PostgreSQL) 7.4.1

    [Slim:local/src/plruby-0.3.8] root# ruby --version
    ruby 1.8.1 (2004-02-17) [powerpc-darwin]




    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?

    Any thoughts on how I can get this built?

    --
    (-, /\ \/ / /\/
    Gavin Guest

  2. #2

    Default Further failures

    Gavin Kistner wrote: 

    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
    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
    cc -dynamic -bundle -undefined suppress -flat_namespace
    -L'/usr/local/lib' -L'/usr/local/pgsql/lib' -o plruby.bundle plruby.o
    -lpq -lruby-static -ldl -lobjc

    [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



    --
    (-, /\ \/ / /\/
    Gavin Guest

  3. #3

    Default Re: Further failures

    On Wed, 25 Feb 2004, Gavin Kistner wrote:
     
    >
    > 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'.[/ref]

    export PATH=/usr/local/pgsql/bin:$PATH

    this is probably why it can't fine the commands (assuming they are there)

    you may also want to

    export LD_LIBRARY_PATH=/usr/local/pgsql/lib:$LD_LIBRARY_PATH

    actually - i'd do a

    export LD_RUN_PATH=/usr/local/pgsql/lib

    __before__ compiling and.

    do a man ld

    HTH.

    -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
    ================================================== =============================

    Ara.T.Howard Guest

  4. #4

    Default Re: Failure building PL/Ruby on MacOS X 10.3

    Gavin Kistner wrote: 

    [snip]
     

    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/?)

    --
    dave



    David Guest

  5. #5

    Default Re: Further failures

    Ara.T.Howard wrote: 
    > export PATH=/usr/local/pgsql/bin:$PATH
    >
    > this is probably why it can't fine the commands (assuming they are there)[/ref]

    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):

    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

    And I just had to ignore the fact that make test didn't work at all.

    --
    (-, /\ \/ / /\/
    Gavin Guest

  6. #6

    Default Re: Failure building PL/Ruby on MacOS X 10.3

    David Garamond wrote: 

    FWIW, this was not a MacOS X specific package. It was precisely:

    ftp://ftp9.us.postgresql.org/pub/mirrors/postgresql/source/v7.4.1/postgresql-base-7.4.1.tar.gz

    which has array.h inside /src/include/utils/ and *not*
    /src/include/server/utils/

    Dunno when this changed, but seems to be a minor broken part of the
    PL/Ruby install.

    --
    (-, /\ \/ / /\/
    Gavin Guest

  7. #7

    Default Re: Failure building PL/Ruby on MacOS X 10.3

    >>>>> "G" == Gavin Kistner <com> writes:

    G> which has array.h inside /src/include/utils/ and *not*
    G> /src/include/server/utils/

    svg% cat pgsql/data/PG_VERSION
    7.4
    svg%

    svg% find pgsql -name array.h
    pgsql/include/server/utils/array.h
    svg%

    G> Dunno when this changed, but seems to be a minor broken part of the
    G> PL/Ruby install.

    svg% less plruby-0.3.8/README.en
    [...]

    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
    [...]
    svg%

    it's not my fault if `make install-all-headers' put the file in
    include/server/utils/ and not in include/utils/


    Guy Decoux





    ts Guest

  8. #8

    Default Re: Further failures

    On Wed, 25 Feb 2004, Gavin Kistner wrote:
     

    be careful - if you run ldd on the postgres.so lib you'll probably see
    something like

    [ahowardwww 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
    ================================================== =============================

    Ara.T.Howard Guest

  9. #9

    Default Re: Failure building PL/Ruby on MacOS X 10.3

    ts wrote: 
     

    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! :)

    --
    (-, /\ \/ / /\/
    Gavin Guest

  10. #10

    Default Re: Failure building PL/Ruby on MacOS X 10.3

    >>>>> "G" == Gavin Kistner <com> writes:

    G> If you mean to require that postgresql be installed with all headers for
    G> plruby to build properly, then I think the above needs rewording.


    Well, the next version will test the directory. Just to give you an
    example, the include directories for 7.3 and 7.4 are

    svg% ls /home/ts/local/pg73/include
    ecpgerrno.h ecpgtype.h libpq-fe.h pg_config_os.h postgresql/ sqlca.h
    ecpglib.h libpq/ pg_config.h postgres_ext.h sql3types.h
    svg%

    svg% ls /home/ts/local/pgsql/include
    ecpg_informix.h internal/ pg_config_os.h pgtypes_timestamp.h
    ecpgerrno.h libpq/ pgtypes_date.h postgres_ext.h
    ecpglib.h libpq-fe.h pgtypes_error.h server/
    ecpgtype.h pg_config.h pgtypes_interval.h sql3types.h
    informix/ pg_config_manual.h pgtypes_numeric.h sqlca.h
    svg%

    See the directory server and postgresql, the installation was make with
    the same commands (I've just given a different directory for --prefix)

    The include tree change for each version :-(((


    Guy Decoux


    ts Guest

Similar Threads

  1. Replies: 2
    Last Post: December 3rd, 02:05 PM
  2. Fink install of Ruby under MacOS X.2.6
    By Yvon Thoraval in forum Ruby
    Replies: 0
    Last Post: September 21st, 07:32 AM
  3. Intermittent failure with VPN client on MacOS X.2
    By Jeff Frontz in forum Mac Networking
    Replies: 2
    Last Post: August 26th, 12:30 PM
  4. #24703 [Opn]: failure building sqlite extension
    By php at sjondamon dot org in forum PHP Development
    Replies: 1
    Last Post: July 18th, 03:08 PM
  5. #24703 [NEW]: failure building sqlite extension
    By php at sjondamon dot org in forum PHP Development
    Replies: 0
    Last Post: July 18th, 10:14 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139