Friday, July 04, 2008

Install ruby-pg (PostgreSQL ruby driver) On Leopard

It is not so easy to install ruby-pg in Leopard

Felix:~ sunfmin$ sudo gem install ruby-pg
Building native extensions.  This could take a while...
ERROR:  Error installing pg:
    ERROR: Failed to build gem native extension.

/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby extconf.rb install pg

        ===========   WARNING   ===========

        You are building this extension on OS X without setting the 
        ARCHFLAGS environment variable, and PostgreSQL does not appear 
        to have been built as a universal binary. If you are seeing this 
        message, that means that the build will probably fail.

        Try setting the environment variable ARCHFLAGS 
        to '-arch i386' before building.

        For example:
        (in bash) $ export ARCHFLAGS='-arch i386'
        (in tcsh) % setenv ARCHFLAGS '-arch i386'

        Then try building again.

        ===================================
        checking for main() in -lpq... yes
checking for libpq-fe.h... yes
checking for libpq/libpq-fs.h... yes
checking for PQconnectionUsedPassword()... no
checking for PQisthreadsafe()... no
checking for PQprepare()... no
checking for PQexecParams()... no
checking for PQescapeString()... no
checking for PQescapeStringConn()... no
checking for lo_create()... no
checking for pg_encoding_to_char()... no
checking for PQsetClientEncoding()... no
creating Makefile

make
gcc -I. -I. -I/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/universal-darwin9.0 -I. -DHAVE_LIBPQ_FE_H -DHAVE_LIBPQ_LIBPQ_FS_H -I/opt/local/include/postgresql82  -fno-common -arch ppc -arch i386 -Os -pipe -fno-common  -c compat.c
In file included from compat.c:16:
compat.h:38:2: error: #error PostgreSQL client version too old, requires 7.3 or later.
In file included from compat.c:16:
compat.h:121: error: redefinition of typedef 'PQnoticeReceiver'
/opt/local/include/postgresql82/libpq-fe.h:136: error: previous declaration of 'PQnoticeReceiver' was here
compat.h:125: error: redeclaration of enumerator 'PQERRORS_TERSE'
/opt/local/include/postgresql82/libpq-fe.h:97: error: previous definition of 'PQERRORS_TERSE' was here
compat.h:126: error: redeclaration of enumerator 'PQERRORS_DEFAULT'
/opt/local/include/postgresql82/libpq-fe.h:98: error: previous definition of 'PQERRORS_DEFAULT' was here
compat.h:128: error: redeclaration of enumerator 'PQERRORS_VERBOSE'
/opt/local/include/postgresql82/libpq-fe.h:100: error: previous definition of 'PQERRORS_VERBOSE' was here
compat.h:128: error: conflicting types for 'PGVerbosity'
/opt/local/include/postgresql82/libpq-fe.h:100: error: previous declaration of 'PGVerbosity' was here
compat.h:132: error: redeclaration of enumerator 'PQTRANS_IDLE'
/opt/local/include/postgresql82/libpq-fe.h:88: error: previous definition of 'PQTRANS_IDLE' was here
compat.h:133: error: redeclaration of enumerator 'PQTRANS_ACTIVE'
/opt/local/include/postgresql82/libpq-fe.h:89: error: previous definition of 'PQTRANS_ACTIVE' was here
compat.h:134: error: redeclaration of enumerator 'PQTRANS_INTRANS'
/opt/local/include/postgresql82/libpq-fe.h:90: error: previous definition of 'PQTRANS_INTRANS' was here
compat.h:135: error: redeclaration of enumerator 'PQTRANS_INERROR'
/opt/local/include/postgresql82/libpq-fe.h:91: error: previous definition of 'PQTRANS_INERROR' was here
compat.h:137: error: redeclaration of enumerator 'PQTRANS_UNKNOWN'
/opt/local/include/postgresql82/libpq-fe.h:93: error: previous definition of 'PQTRANS_UNKNOWN' was here
compat.h:137: error: conflicting types for 'PGTransactionStatusType'
/opt/local/include/postgresql82/libpq-fe.h:93: error: previous declaration of 'PGTransactionStatusType' was here
compat.h:142: error: conflicting types for 'PQtransactionStatus'
/opt/local/include/postgresql82/libpq-fe.h:258: error: previous declaration of 'PQtransactionStatus' was here
compat.h:143: error: conflicting types for 'PQparameterStatus'
/opt/local/include/postgresql82/libpq-fe.h:260: error: previous declaration of 'PQparameterStatus' was here
compat.h:157: error: conflicting types for 'PQsetErrorVerbosity'
/opt/local/include/postgresql82/libpq-fe.h:277: error: previous declaration of 'PQsetErrorVerbosity' was here
compat.h:169:2: error: #error unsupported postgresql version, requires 7.3 or later.
compat.c: In function 'PQsetClientEncoding':
compat.c:21: error: syntax error before '{' token
compat.c:282: error: storage class specified for parameter 'query'
compat.c:282: error: parameter 'query' is initialized
compat.c:286: error: syntax error before 'if'
compat.c:341: error: parameter 'target' is initialized
compat.c:341: error: 'to' undeclared (first use in this function)
compat.c:341: error: (Each undeclared identifier is reported only once
compat.c:341: error: for each function it appears in.)
compat.c:342: error: parameter 'remaining' is initialized
compat.c:342: error: 'length' undeclared (first use in this function)
compat.c:344: error: syntax error before 'while'
compat.c:396: error: syntax error before 'len'
compat.c:470: error: redefinition of parameter 'i'
compat.c:390: error: previous definition of 'i' was here
compat.c:473: error: syntax error before 'if'
In file included from compat.c:16:
compat.h:38:2: error: #error PostgreSQL client version too old, requires 7.3 or later.
In file included from compat.c:16:
compat.h:121: error: redefinition of typedef 'PQnoticeReceiver'
/opt/local/include/postgresql82/libpq-fe.h:136: error: previous declaration of 'PQnoticeReceiver' was here
compat.h:125: error: redeclaration of enumerator 'PQERRORS_TERSE'
/opt/local/include/postgresql82/libpq-fe.h:97: error: previous definition of 'PQERRORS_TERSE' was here
compat.h:126: error: redeclaration of enumerator 'PQERRORS_DEFAULT'
/opt/local/include/postgresql82/libpq-fe.h:98: error: previous definition of 'PQERRORS_DEFAULT' was here
compat.h:128: error: redeclaration of enumerator 'PQERRORS_VERBOSE'
/opt/local/include/postgresql82/libpq-fe.h:100: error: previous definition of 'PQERRORS_VERBOSE' was here
compat.h:128: error: conflicting types for 'PGVerbosity'
/opt/local/include/postgresql82/libpq-fe.h:100: error: previous declaration of 'PGVerbosity' was here
compat.h:132: error: redeclaration of enumerator 'PQTRANS_IDLE'
/opt/local/include/postgresql82/libpq-fe.h:88: error: previous definition of 'PQTRANS_IDLE' was here
compat.h:133: error: redeclaration of enumerator 'PQTRANS_ACTIVE'
/opt/local/include/postgresql82/libpq-fe.h:89: error: previous definition of 'PQTRANS_ACTIVE' was here
compat.h:134: error: redeclaration of enumerator 'PQTRANS_INTRANS'
/opt/local/include/postgresql82/libpq-fe.h:90: error: previous definition of 'PQTRANS_INTRANS' was here
compat.h:135: error: redeclaration of enumerator 'PQTRANS_INERROR'
/opt/local/include/postgresql82/libpq-fe.h:91: error: previous definition of 'PQTRANS_INERROR' was here
compat.h:137: error: redeclaration of enumerator 'PQTRANS_UNKNOWN'
/opt/local/include/postgresql82/libpq-fe.h:93: error: previous definition of 'PQTRANS_UNKNOWN' was here
compat.h:137: error: conflicting types for 'PGTransactionStatusType'
/opt/local/include/postgresql82/libpq-fe.h:93: error: previous declaration of 'PGTransactionStatusType' was here
compat.h:142: error: conflicting types for 'PQtransactionStatus'
/opt/local/include/postgresql82/libpq-fe.h:258: error: previous declaration of 'PQtransactionStatus' was here
compat.h:143: error: conflicting types for 'PQparameterStatus'
/opt/local/include/postgresql82/libpq-fe.h:260: error: previous declaration of 'PQparameterStatus' was here
compat.h:157: error: conflicting types for 'PQsetErrorVerbosity'
/opt/local/include/postgresql82/libpq-fe.h:277: error: previous declaration of 'PQsetErrorVerbosity' was here
compat.h:169:2: error: #error unsupported postgresql version, requires 7.3 or later.
compat.c: In function 'PQsetClientEncoding':
compat.c:21: error: syntax error before '{' token
compat.c:282: error: storage class specified for parameter 'query'
compat.c:282: error: parameter 'query' is initialized
compat.c:286: error: syntax error before 'if'
compat.c:341: error: parameter 'target' is initialized
compat.c:341: error: 'to' undeclared (first use in this function)
compat.c:341: error: (Each undeclared identifier is reported only once
compat.c:341: error: for each function it appears in.)
compat.c:342: error: parameter 'remaining' is initialized
compat.c:342: error: 'length' undeclared (first use in this function)
compat.c:344: error: syntax error before 'while'
compat.c:396: error: syntax error before 'len'
compat.c:470: error: redefinition of parameter 'i'
compat.c:390: error: previous definition of 'i' was here
compat.c:473: error: syntax error before 'if'
lipo: can't open input file: /var/tmp//ccxi5qM7.out (No such file or directory)
make: *** [compat.o] Error 1


Gem files will remain installed in /Library/Ruby/Gems/1.8/gems/pg-0.7.9.2008.03.18 for inspection.
Results logged to /Library/Ruby/Gems/1.8/gems/pg-0.7.9.2008.03.18/ext/gem_make.out
Felix:~ sunfmin$ 



Felix:~ sunfmin$ sudo env ARCHFLAGS="-arch i386" gem install --remote ruby-pg
Building native extensions.  This could take a while...
Successfully installed ruby-pg-0.7.9.2008.01.28
1 gem installed
Installing ri documentation for ruby-pg-0.7.9.2008.01.28...
Installing RDoc documentation for ruby-pg-0.7.9.2008.01.28...
Felix:~ sunfmin$

No comments: